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

m.byryn1u m.bryn1u at gmail.com
Wed Aug 13 20:52:16 UTC 2014


W dniu 2014-08-13 18:43, Fajar A. Nugraha pisze:
> On Wed, Aug 13, 2014 at 10:55 PM, m.byryn1u <m.bryn1u at gmail.com> wrote:
>> 94.23.237.254 is not part of 91.121.239.0/24.
>>
>> @Bryn, how is the ROUTER (i.e. 94.23.237.254) setup? Is it configured
>> to route the additional IP (91.121.239.228) thru host's IP
>> (94.23.237.216), the way some dedicated server provider does (e.g.
>> serverloft)?
>>
>> If yes, then 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)
>>
>> Hey,
>>
>> It's server dedicated in OVH.
>>
>> Then ask OVH how to use that IP.
>>
>> I have one ip like  94.23.237.216 and i bought one more called "ip failover"
>> like 91.121.239.228. You say as an alias and setup static NAT. But what
>> about 2 ip failover ?
>>
>> If my guess is right, it's similar to serverloft. They will say
>> "simply put it as an IP alias/additional IP on your server".
>>
>> As in, the additional IP is routed to ONE of your server's IP.
>> Permanently. Can't be used on other server. Thus, there can be NO
>> failover.
>>
>> It's not a standard failover setup where two or more physical servers
>> each have an IP in the same network segment, and you can have one or
>> more virtual IP for your services that can fail over to any of the
>> servers.
>>
>> I had a server on FreeBSD-10 before and i had 2 jails with 1 failover ip per
>> jail, work well.
> To prevent confusion and wasting everyone's time, what do you mean by
> "failover IP"?
>
> That simply looks like addtional IP (i.e. you only have one server),
> not an IP that can be failed over between two physical servers.
>
>
>> OVH says :
>>
>> post-up /sbin/ifconfig eth0:X IP.FAIL.OVER netmask 255.255.255.255 broadcast
>> IP.FAIL.OVER
>> post-down /sbin/ifconfig eth0:X down
>>
>> 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
> 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.
Ehhhh This LXC doesn't work.  I don't know what to do. Don't know how to 
add secondary ip to lxc.
There are settings by default after install dedicated server (ubuntu 14.04):

root at Host:~# ifconfig
eth0      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: 2001:41d0:2:70d8::/64 Scope:Global
           inet6 addr: fe80::230:48ff:febd:ee08/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:10138 errors:0 dropped:11 overruns:0 frame:0
           TX packets:4474 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:8616516 (8.6 MB)  TX bytes:1121846 (1.1 MB)
           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:238 errors:0 dropped:0 overruns:0 frame:0
           TX packets:238 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:29523 (29.5 KB)  TX bytes:29523 (29.5 KB)

lxcbr0    Link encap:Ethernet  HWaddr fe:a1:3c:60:a1:a7
           inet addr:10.0.3.1  Bcast:10.0.3.255  Mask:255.255.255.0
           inet6 addr: fe80::f025:12ff:fe20:a50d/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:193 errors:0 dropped:0 overruns:0 frame:0
           TX packets:64 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
           RX bytes:13928 (13.9 KB)  TX bytes:8339 (8.3 KB)

vethNW6I9M Link encap:Ethernet  HWaddr fe:a1:3c:60:a1:a7
           inet6 addr: fe80::fca1:3cff:fe60:a1a7/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:62 errors:0 dropped:0 overruns:0 frame:0
           TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:5656 (5.6 KB)  TX bytes:2422 (2.4 KB)

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.


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


More information about the lxc-users mailing list