谁能告诉我如何为每个 LXC 容器设置一个网络接口,以便每个容器都可以拥有自己的专用 IP 地址?
/etc/network/interfaces
我的主机节点上的文件如下所示:
# Generated by SolusVM
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 160.201.10.167
gateway 160.201.8.1
netmask 255.255.252.0
dns-nameservers 8.8.8.8 8.8.4.4
auto eth0:0
iface eth0:0 inet static
address 160.201.8.32
gateway 160.201.8.1
netmask 255.255.252.0
dns-nameservers 8.8.8.8 8.8.4.4
auto eth0:1
iface eth0:1 inet static
address 160.201.8.36
gateway 160.201.8.1
netmask 255.255.252.0
dns-nameservers 8.8.8.8 8.8.4.4
auto eth0:2
iface eth0:2 inet static
address 160.201.8.37
gateway 160.201.8.1
netmask 255.255.252.0
dns-nameservers 8.8.8.8 8.8.4.4
我的 LXC 容器配置文件如下所示:
lxc.include = /usr/share/lxc/config/ubuntu.common.conf
lxc.rootfs = /var/lib/lxc/francis/rootfs
lxc.mount = /var/lib/lxc/francis/fstab
lxc.utsname = francis
lxc.arch = amd64
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = eth0
lxc.network.hwaddr = 00:16:3e:de:53:6f
lxc.network.ipv4 = 160.201.8.32
lxc.cgroup.memory.limit_in_bytes = 256M
lxc.cgroup.memory.memsw.limit_in_bytes = 256M
任何人都可以告诉我如何为容器“francis”提供自己的公共 IP 地址,例如160.201.8.32
?
我的主机节点正在运行 Ubuntu 14.04 Server。