[lxc-users] Using lxc Container on Fedora/Centos
Denis Müller
d.mueller2 at rto.de
Wed Oct 22 14:36:38 UTC 2014
Hi all,
i'm trying to manage lxc container on Fedora/Centos but i have issues on
networking. My whole idea is to use Centos 6.5 with lxc 1.0.6 like a
hypervisor with web/mail-server Container on it.I'm doing following Steps:
1. yum install lxc-extras lxc lxc-templates (on this point Ubuntu is a bit
comfortable, you just have to type apt-get install lxc and you'll get all
Packages you need like "lxc-templates" etc.)
2.brctl addbr br0 ( using brctl to manage bridges more comfortable as
editing configs)
3.ifconfig br0 192.168.3.1 netmask 255.255.255.0
4.ifconfig br0 up
-------------------------------------------------------------------------------------------------------------------------------
now ifconfig:
br0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 10.0.3.1 netmask 255.255.255.0 broadcast 10.0.3.255
inet6 fe80::3435:eff:fe2f:77f0 prefixlen 64 scopeid 0x20<link>
ether 00:00:00:00:00:00 txqueuelen 0 (Ethernet)
RX packets 64 bytes 11068 (10.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 37 bytes 4841 (4.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Lokale Schleife)
RX packets 4 bytes 240 (240.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 4 bytes 240 (240.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
p4p1: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 00:21:27:fb:0e:c2 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
p5p1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.6 netmask 255.255.252.0 broadcast 192.168.3.255
inet6 fe80::8e89:a5ff:fe3f:c263 prefixlen 64 scopeid 0x20<link>
ether 8c:89:a5:3f:c2:63 txqueuelen 1000 (Ethernet)
RX packets 19070316 bytes 6158412139 (5.7 GiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1924578 bytes 210429625 (200.6 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
I want that all future containers use br0 as a Bridge to communicate with
internet.
-------------------------------------------------------------------------------------------------------------------------------
/etc/dnsmasq.conf:
listen-address=10.0.3.1
bind-interfaces
dhcp-range=192.168.3.1,192.168.3.10,12h
Containers schould get their ip's from dhcp on br0
-------------------------------------------------------------------------------------------------------------------------------
/etc/lxc/default.conf:
lxc.network.type = veth
lxc.network.link = br0
lxc.network.flags = up
-----------------------------------------------------------------------------------------------------------------------------
/var/lib/lxc/centos/config
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.hwaddr = fe:51:96:6e:67:dd
lxc.rootfs = /var/lib/lxc/centos/rootfs
lxc.include = /usr/share/lxc/config/centos.common.conf
lxc.arch = x86_64
lxc.utsname = centos.xxx-media.com
lxc.autodev = 0
-----------------------------------------------------------------------------------------------------------------------------
I'm still not getting IP Address from DHCP. And if i give manually an ip
like 192.168.3.9 inside of the container "centos" for eth0 i am not able
to ping 192.168.3.1 or use network. If i try to restart network, it stucks
on ip.
ifconfig of my container:
eth0 Link encap:Ethernet Hardware Adresse FE:51:96:6E:67:DD
inet6 Adresse: fe80::fc51:96ff:fe6e:67dd/64
Gültigkeitsbereich:Verbindung
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:9 errors:0 dropped:0 overruns:0 frame:0
TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:1000
RX bytes:1254 (1.2 KiB) TX bytes:1010 (1010.0 b)
lo Link encap:Lokale Schleife
inet Adresse:127.0.0.1 Maske:255.0.0.0
inet6 Adresse: ::1/128 Gültigkeitsbereich:Maschine
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
Kollisionen:0 Sendewarteschlangenlänge:0
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
-----------------------------------------------------------------------------------------------------------------------------
route -n is missing! No Routers here.
It would be greate if somebody could help me. Because on Ubuntu it is no
Problem, the lxc-deamon do all the Stuff for you, but on Centos no...
Thank you
More information about the lxc-users
mailing list