Debian LXC dodatkowe publiczne IP dla LXC.

Masz problemy z siecią bądź internetem? Zapytaj tu
bryn1u
Posty: 64
Rejestracja: 01 lutego 2009, 23:51
Lokalizacja: /dev/null

Debian LXC dodatkowe publiczne IP dla LXC.

Post autor: bryn1u »

Witam serdecznie,

Od kilku dni strasznie się męczę z konfiguracją IP pod LXC (ktore mam od OVH jak i serwer) i nie mogę dojść do ładu i składu. Posiadam serwer w OVH z IP: 94.23.237.216. Dokupiłem też jedno IP zwane failover: 91.121.239.228. Failover chciałbym podpiąć pod LXC.

Kod: Zaznacz cały


[B]root@Server:~# cat /etc/network/interfaces[/B]
# The loopback network interface  
auto lo
iface lo inet loopback   
auto br0 iface br0 inet static        
 bridge_ports eth0        
 bridge_fd 0         
bridge_stp off         
bridge_maxwait 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
Jak mam dodac dodatkowe ip, żeby było w pełni obsługiwane przez kontener ? Jako alias wystarczy dopisać:

Kod: Zaznacz cały


post-up /sbin/ifconfig eth0:0 IP.FAIL.OVER netmask 255.255.255.255 broadcast IP.FAIL.OVER 
post-down /sbin/ifconfig eth0:0 down
Probowalem przeróżnych poradników, pisałem w liście mailingowej LXC, ale dalej bez żadnych rezultatów. Może ktoś podesłać jakiś sprawdzony, działający link do tutka ?
Z góry dziękuję,
Pozdrawiam,

P.S
Korzystałem min. z:


1) IP failover and virtual Mac address Let's consider your host public IP address is 91.123.123.123, and your guests public IP failover addresses are 91.2.2.2 (GUEST1) and 91.3.3.3 (GUEST2). >From your OVH Manager, assign a virtual Mac address to each of your IP failover. Select the "VMware type" ("OVH type" should also work, but I haven't yet tested). Let's assume your virtual Mac addresses for each IP failover are :

GUEST1: 91.2.2.2 <---> 00:50:56:0a:2a:aa
GUEST2: 91.3.3.3 <---> 00:50:56:0b:3b:bb

2) Host network configuration Then, set up your host network by editing the /etc/network/interfaces, and replacing the eth0 by a br0 interface.
Your file should look like this:

# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo iface lo inet loopback


auto br0 iface br0 inet static
address 91.123.123.123
netmask 255.255.255.0
gateway 91.123.123.254
network 91.123.123.0
broadcast 91.123.123.255
bridge_ports eth0
bridge_stp off
bridge_maxwait 5
bridge_fd 0


Don't forget to restart your network (/etc/init.d/networking restart).
3) Guest configuration file Once your host network new configuration is up, edit the network part of your guest's configuration file (/var/lib/lxc/GUEST/config) with the IP failover and Mac adresses :

lxc.utsname = GUEST1
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.veth.pair = vethGUEST1
lxc.network.ipv4 = 91.2.2.2
lxc.network.hwaddr = 00:50:56:0a:2a:aa

And for GUEST2:
lxc.utsname = GUEST2
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.veth.pair = vethGUEST2
lxc.network.ipv4 = 91.3.3.3
lxc.network.hwaddr = 00:50:56:0b:3b:bb


4) Guest network configuration Then, add eth0 interface to your guest's /etc/network/interfaces file. The default gateway IP address should be the same as your host's one (for OVH servers, just replace the last byte of your host IP address by 254 (91.123.123.254 in my example) :

auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 91.2.2.2
netmask 255.255.255.255
broadcast 91.2.2.2
post-up route add 91.123.123.254 dev eth0
post-up route add default gw 91.123.123.254
post-down route del 91.123.123.254 dev eth0
post-down route del default gw 91.123.123.254

That's it :-)

Niestety nie bardzo chce działać.
ODPOWIEDZ