dimanche 8 mars 2015

Setup public IP address on LXC container


Can anyone tell me how to setup a network interface for each LXC container so that each container can have its own dedicated IP address?


Here's what the /etc/network/interfaces file on my host node looks like:



# 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


Here's what my LXC container config file looks like:



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


Can anyone show me how to give the container "francis" its own public IP address, like 160.201.8.32 for example?


My host node is running Ubuntu 14.04 Server.



Aucun commentaire:

Enregistrer un commentaire