Sunday, March 20, 2016

networking - eth0 on lxc does not work

I am facing some problems that the eth0 on lxc container does not work. I already tried
Bridging LXC containers to host eth0 so they can have a public IP, but it does not help.



On my host (Ubuntu on virtualbox):



# cat /proc/sys/net/ipv4/ip_forward
1


config




# cat /var/lib/lxc/config
lxc.config
lxc.utsname=ubuntu
lxc.network.type=veth
lxc.network.link=br0
lxc.network.flags=up


I created a container with the above config




# lxc-create -t centos -f config -n centos1


then launch



# lxc-start -d -n centos1
# lxc-console -n centos1



It seems veth is properly connected because the host machine says



# brctl show
bridge name bridge id STP enabled interfaces
br0 8000.080027bb0aca no eth0
veth48BKPz
lxcbr0 8000.000000000000 no


And the default gateway seems also be set correctly on the host




# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.11.1 0.0.0.0 UG 100 0 0 br0
10.0.3.0 0.0.0.0 255.255.255.0 U 0 0 0 lxcbr0
192.168.11.0 0.0.0.0 255.255.255.0 U 0 0 0 br0


On the lxc container




# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.11.1 0.0.0.0 UG 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1009 0 0 eth0
192.168.11.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0


Any help?

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...