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

Fajar A. Nugraha list at fajar.net
Thu Aug 14 02:06:43 UTC 2014


On Thu, Aug 14, 2014 at 3:52 AM, m.byryn1u <m.bryn1u at gmail.com> wrote:
>

> I created first lxc by lxc-create -t ubuntu -n Oksymoron and works fine.
> And now i want to add additional ip which i bought - 91.121.239.228
>
> I tried fast add alias /sbin/ifconfig eth0:X IP.FAIL.OVER netmask
> 255.255.255.255 broadcast IP.FAIL.OVER
> In my case:
> sbin/ifconfig eth0:0 91.121.239.228 netmask 255.255.255.255 broadcast
> 91.121.239.228
>
> I tried ping and connet by ssh and works perfect.
>
> eth0: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
>           Interrupt:16 Memory:fbce0000-fbd00000
>
> But still don't know how to add or redirect "ip" to lxc called Oksymoron.
> Nothing ways work.
> I lost faith that it will work.

(sigh)

If you're asking questions to a public list, please at least try to do
what was suggested. Ignoring them and say "Nothing ways work. I lost
faith that it will work" is simply rude.


For example, I wrote this earlier

"
the EASY way would be to put 91.121.239.228 as an alias
in host's interface (I'd just use eth0, no need to use a bridge there)
and setup a static NAT to whatever IP the container has (e.g.
10.0.3.251, connected to host's lxcbr0 bridge)
"

You've done the first part, adding 91.121.239.228 as an alias to eth0.
Is there any reason why you didn't bother dong the second part? If you
don't know how to do NAT, there's plenty of examples just from Google
search, like http://www.dd-wrt.com/wiki/index.php/Static_NAT



If you don't want to use NAT, when you say

> Or as bridge:
>
>
> /etc/network/interfaces
> auto lo eth0
> iface lo inet loopback
> iface eth0 inet static
> address IP.FAIL.OVER
> netmask 255.255.255.255
> broadcast IP.FAIL.OVER
> post-up route add IP..SERWERA.254 dev eth0
> post-up route add default gw IP.SERWERA.254
> post-down route del IP..SERWERA.254 dev eth0
> post-down route del default gw IP.SERWERA.254
>

I wrote this:

"
If that snippet work, you can use it as the container's
/etc/network/interfaces. ONLY put the additional IP there. Do NOT put
the ip address in the host's bridge.
"

Have you tried that? when using bridge in the host (you already have
br0 in your first post), assign the container to that bridge, and use
the snippet you wrote INSIDE the container? Note that the new IP is
ONLY assigned inside the container.

-- 
Fajar


More information about the lxc-users mailing list