[lxc-users] Networking in Ubuntu with 2 ip failover in LXC

bryn1u85 . m.bryn1u at gmail.com
Wed Aug 13 07:47:10 UTC 2014


Hey everyone,

I've been trying to configure Ubuntu LXC with 2 ip failover from OVH but i
failed :(
I've been reading many howto's and still nothing. I have found on this list
same cool tutorial which has written by Olivier. There is a link:
https://lists.linuxcontainers.org/pipermail/lxc-users/2011-May/001980.html

I don't know why i still can't get access to internet from LXC.

My host ip: 94.23.237.216
My ip fail over ip 1: 91.121.239.228

I'll focus on one failover ip.
I did as Olivier has subscribed.

Host:
root at ns321124:~# cat /etc/network/interface
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
        iface eth0 inet static

auto br0
        iface br0 inet static
        bridge_ports eth0
        bridge_stp off
        bridge_maxwait 0
        bridge_fd 0
        address 94.23.237.216
        netmask 255.255.255.0
        network 94.23.237.0
        broadcast 94.23.237.255
        gateway 94.23.237.254

post-up /sbin/ifconfig br0:0 91.121.239.228 netmask 255.255.255.255
broadcast 91.121.239.228
post-down /sbin/ifconfig br0:0 down


root at ns321124:~# cat /var/lib/lxc/Oksymoron/config
# Template used to create this container:
/usr/share/lxc/templates/lxc-ubuntu
# Parameters passed to the template:
# For additional config options, please look at lxc.container.conf(5)

# Common configuration
lxc.include = /usr/share/lxc/config/ubuntu.common.conf

# Container specific configuration
lxc.rootfs = /var/lib/lxc/Oksymoron/rootfs
lxc.mount = /var/lib/lxc/Oksymoron/fstab
lxc.utsname = Oksymoron
lxc.arch = amd64

# Network configuration
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.ipv4 = 91.121.239.228
lxc.network.hwaddr = 00:16:3e:3e:35:9e

root at ns321124:~# /sbin/ifconfig br0:0 91.121.239.228 netmask
255.255.255.255 broadcast 91.121.239.228
root at ns321124:~# ifconfig
br0       Link encap:Ethernet  HWaddr 00:30:48:bd:ee:08
          inet addr:94.23.237.216  Bcast:94.23.237.255  Mask:255.255.255.0
          inet6 addr: fe80::230:48ff:febd:ee08/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:973 errors:0 dropped:2 overruns:0 frame:0
          TX packets:652 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:158619 (158.6 KB)  TX bytes:110737 (110.7 KB)

br0:0     Link encap:Ethernet  HWaddr 00:30:48:bd:ee:08
          inet addr:91.121.239.228  Bcast:91.121.239.228
 Mask:255.255.255.255
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0      Link encap:Ethernet  HWaddr 00:30:48:bd:ee:08
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1043 errors:0 dropped:0 overruns:0 frame:0
          TX packets:659 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:180915 (180.9 KB)  TX bytes:114099 (114.0 KB)
          Interrupt:16 Memory:fbce0000-fbd00000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:44 errors:0 dropped:0 overruns:0 frame:0
          TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4964 (4.9 KB)  TX bytes:4964 (4.9 KB)

Now LXC:

root at ns321124:~# cat /var/lib/lxc/Oksymoron/rootfs/etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        adress 91.121.239.228
        netmask 255.255.255.255
        broadcast 91.121.239.228

        post-up route add 94.23.237.254 dev eth0
        post-up route add default gw 94.23.237.254
        post-down route del 94.23.237.254 dev eth0
        post-down route del default gw 94.23.237.254

For sure i did reboot and lunch lxc.

Checking ifconfig in LXC called Oksymoron

root at Oksymoron:/home/ubuntu# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:16:3e:3e:35:9e
          inet addr:91.121.239.228  Bcast:255.255.255.255  Mask:0.0.0.0
          inet6 addr: fe80::216:3eff:fe3e:359e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:109 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9448 (9.4 KB)  TX bytes:648 (648.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:16 errors:0 dropped:0 overruns:0 frame:0
          TX packets:16 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:1248 (1.2 KB)  TX bytes:1248 (1.2 KB)

Now try update.
root at Oksymoron:/home/ubuntu# apt-get update
Err http://archive.ubuntu.com trusty InRelease

Err http://archive.ubuntu.com trusty-updates InRelease

Err http://security.ubuntu.com trusty-security InRelease

Err http://security.ubuntu.com trusty-security Release.gpg
  Could not resolve 'security.ubuntu.com'
Err http://archive.ubuntu.com trusty Release.gpg
  Could not resolve 'archive.ubuntu.com'
Err http://archive.ubuntu.com trusty-updates Release.gpg
  Could not resolve 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/InRelease

W: Failed to fetch
http://archive.ubuntu.com/ubuntu/dists/trusty-updates/InRelease

W: Failed to fetch
http://security.ubuntu.com/ubuntu/dists/trusty-security/InRelease

W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/trusty/Release.gpg
 Could not resolve 'archive.ubuntu.com'

W: Failed to fetch
http://archive.ubuntu.com/ubuntu/dists/trusty-updates/Release.gpg  Could
not resolve 'archive.ubuntu.com'

W: Failed to fetch
http://security.ubuntu.com/ubuntu/dists/trusty-security/Release.gpg  Could
not resolve 'security.ubuntu.com'

W: Some index files failed to download. They have been ignored, or old ones
used instead.

I tried many ways but i have no idea what's wrong ! I have been reading
forums, asked on forums, always without answers.

I think none use public ip/ip failover for LXC !  Is there any why to
resolve it ? I would by very very gratefully and i'll subscribed solution
on forums when i asked.

Greetz !
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxcontainers.org/pipermail/lxc-users/attachments/20140813/570783ee/attachment.html>


More information about the lxc-users mailing list