Michał Bryniarski

Michał Bryniarski Akademia Górniczo
Hutniczka Kraków

Temat: Konfiguracja Ubuntu z LXC i 1 IP failover z OVH .

Witam serdecznie,

Mecze sie od paru dni z konfiguracja LXC pod ubuntu a dokladnie z siecia. Chce dodac jedno IP failover (server w ovh) do LXC. Niestety po konfiguracji nie dziala internet z poziomu LXC. Korzystalem z tego poradnika, zrobilem dokladnie to samo z tym, ze zastapilem swoim ip:

# 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

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 :-)

Z poziomu LXC probuje apt-get update i:
root@Oksymoron:~# apt-get update
0% [Connecting to cdn.debian.net]
0% [Connecting to cdn.debian.net]
0% [Connecting to cdn.debian.net]

root@Oksymoron:~# ifconfig
eth0 Link encap:Ethernet HWaddr 00:16:3e:36:fe:87
inet addr:91.121.239.228 Bcast:255.255.255.255 Mask:0.0.0.0
inet6 addr: fe80::216:3eff:fe36:fe87/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:420 errors:0 dropped:2 overruns:0 frame:0
TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:36144 (35.2 KiB) TX bytes:2160 (2.1 KiB)

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:28 errors:0 dropped:0 overruns:0 frame:0
TX packets:28 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2408 (2.3 KiB) TX bytes:2408 (2.3 KiB)

Route:
root@Oksymoron:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface

Nie ma nic, ale dlaczego :( Pomoze ktos, bede wdzieczny
Z gory dziekuje,
Pozdrawiam,
Adrian Czerniak

Adrian Czerniak Administrator
Systemów Uniksowych

Temat: Konfiguracja Ubuntu z LXC i 1 IP failover z OVH .

Resolv.conf w gościu masz popranwy? Wirtualny MAC wygenerowałeś w managerze OVH i go używasz w gościu? lxc.network.ipv4.gateway nie ustawiłeś widzę.Ten post został edytowany przez Autora dnia 21.08.14 o godzinie 13:19
Michał Bryniarski

Michał Bryniarski Akademia Górniczo
Hutniczka Kraków

Temat: Konfiguracja Ubuntu z LXC i 1 IP failover z OVH .

Hej,

Dzieki za zainteresowanie tematem. Przeinstalowalem na szybko na Debian 7.6. Przekompilowalem jajko, podmontowalem cgroup, stworzylem kontener, zalogowalem sie wpisalem apt-get update i dziala. Ustawienia mnie zaskoczyly bo wszystko dziala bez bridge i sa minimalne a mianowicie:
root@Server:~# 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:52320 errors:0 dropped:2 overruns:0 frame:0
TX packets:7700 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:76394261 (72.8 MiB) TX bytes:720126 (703.2 KiB)
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:492 errors:0 dropped:0 overruns:0 frame:0
TX packets:492 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:66637 (65.0 KiB) TX bytes:66637 (65.0 KiB)

root@Server:~# cat /etc/network/interfaces
# 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 eth0
iface eth0 inet static
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

Z poziomu LXC:

root@Server:~# lxc-console -n Oksymoron

Type <Ctrl+a q> to exit the console, <Ctrl+a Ctrl+a> to enter Ctrl+a itself

root@Oksymoron:~# 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:52526 errors:0 dropped:2 overruns:0 frame:0
TX packets:7897 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:76444999 (72.9 MiB) TX bytes:749236 (731.6 KiB)
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:498 errors:0 dropped:0 overruns:0 frame:0
TX packets:498 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:67345 (65.7 KiB) TX bytes:67345 (65.7 KiB)

root@Oksymoron:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default vss-gw-6k.fr.eu 0.0.0.0 UG 0 0 0 eth0
94.23.237.0 * 255.255.255.0 U 0 0 0 eth0

root@Oksymoron:~# cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

root@Oksymoron:~# apt-get update
Hit http://cdn.debian.net wheezy Release.gpg
Hit http://cdn.debian.net wheezy Release
Hit http://cdn.debian.net wheezy/main amd64 Packages
Hit http://cdn.debian.net wheezy/main Translation-en
Reading package lists... Done

W ogole to jestem w szoku bo nie ma ustawien kontenera w /var/lib/lxc/Oksymoron/config jesli chodzi o network tak jak w przypadku ubuntu. Config z debiana:
root@Server:~# cat /var/lib/lxc/Oksymoron/config
lxc.rootfs = /var/lib/lxc/Oksymoron/rootfs
lxc.tty = 4
lxc.pts = 1024
lxc.arch = amd64
lxc.utsname = Oksymoron
lxc.cap.drop = sys_module mac_admin mac_override sys_time

# When using LXC with apparmor, uncomment the next line to run unconfined:
#lxc.aa_profile = unconfined

lxc.cgroup.devices.deny = a
# /dev/null and zero
lxc.cgroup.devices.allow = c 1:3 rwm
lxc.cgroup.devices.allow = c 1:5 rwm
# consoles
lxc.cgroup.devices.allow = c 5:1 rwm
lxc.cgroup.devices.allow = c 5:0 rwm
lxc.cgroup.devices.allow = c 4:0 rwm
lxc.cgroup.devices.allow = c 4:1 rwm
# /dev/{,u}random
lxc.cgroup.devices.allow = c 1:9 rwm
lxc.cgroup.devices.allow = c 1:8 rwm
lxc.cgroup.devices.allow = c 136:* rwm
lxc.cgroup.devices.allow = c 5:2 rwm
# rtc
lxc.cgroup.devices.allow = c 254:0 rm

# mounts point
lxc.mount.entry = proc proc proc nodev,noexec,nosuid 0 0
lxc.mount.entry = sysfs sys sysfs defaults 0 0

A /etc/lxc/config w ogole nie istnieje. Gdzie sa jakiekolwiek ustawienia kontenera w debianie ? I jak w takim przypadku dodac ip do LXC. Z tego wynika,ze mac chyba w ogole nie jest potrzebny. Czy wystarczy ip addr add ip_failover dev etho ? Jestem juz po prostu zmieszany czytam czytam i jeszcze raz czytam i juz wszystko mi sie wymieszalo. Prosze o pomoc

Następna dyskusja:

Konfiguracja iplus pod Ubuntu




Wyślij zaproszenie do