Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed LXC in ubuntu server 12.04 using this link. It was installed successfully and i am able login using ubutu/ubuntu as username and password. Then I tried to setup network for LXC container.

I changed in /etc/network/interface as

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

Content of /var/lib/lxc/mycontainer/config is:

lxc.utsname = mycontainer
lxc.mount = /var/lib/lxc/test/fstab
lxc.rootfs = /var/lib/lxc/test/rootfs = veth = up = br0 = eth0 = vethmycontainer = 02:00:00:86:5b:11

lxc.devttydir = lxc
lxc.tty = 4
lxc.pts = 1024
lxc.arch = amd64
lxc.cap.drop = sys_module mac_admin mac_override
lxc.pivotdir = lxc_putold

Containers etc/network/interface

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

This is how my configuration is

-------------        -----------         -----------   
| LXC       | -----> | Host OS | ------> | Gateway |
| Container |        | Ubuntu  |         |         | 
-------------        -----------         ----------- 
eth0   br0 <-> eth0        NAT GW:        
gw       br0    

Ping   ping
ok                   OK
Ping     ping
FAIL                 OK

LXC container is not know outside host, any idea what i made wrong here?

Additional info

user@host$cat /proc/sys/net/ipv4/ip_forward is 1

I have added Nat rule

ip_tables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE

Note: IPs I have used above is not original

share|improve this question
Same trouble I'm having. On top of that, I've tried all kinds of iptables routing. No success. – Dragunov Dec 30 '13 at 17:29
what does on host command brctl show shows? – philippe Dec 30 '13 at 22:26

Maybe this link will answer your question:

Seems like you should configure br0 instead of eth0 on the host (the first code block in your example).

I'm only guessing, though!

Your broadcast address does not match the network, I would use in the above examples.

share|improve this answer

Your br0 should be the gateway of your container. Check about syntax too. Maybe you should put subnet mask.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.