I have a requirement that networking has to be managed by lxc container, so the Ethernet interface(eth0, which is the source of internet) is assigned to container.

I am able to ping "" from the container.

To access the internet from host, created veth type network configuration for the container.

lxc.net.3.type = veth

lxc.net.3.flags = up

lxc.net.3.veth.pair = lxc0

lxc.net.3.hwaddr = 4a:49:43:49:79:bf

lxc.net.3.ipv4.address =

then forwarded the packets from eth1 to eth0 and eth0 to eth1 as mentioned in https://superuser.com/questions/938805/how-forward-packets-from-network-interface-to-another

but the "ping -I lxc0" is not working from the host.

tcpdump on eth1 interface(tcpdump -i eth1) shows that the ping request is received in the container.

tcpdump shows the output as

ARP, Request who-has tell is lxc0's ip in host)

eth0 is the default gateway inside the container.

  • iptables doesn't route. So whatever you mean by "routed ... using iptables" you'll have to edit your question to clarify what you did (adding missing IPs, routes, iptables rules) – A.B Jan 15 at 22:39
  • @A.B edited the question – enthu Jan 16 at 19:55
  • There are still missing informations: what is the IP assigned on host0? it can't be XX.XX.XX.XX it should be 192.168.1.Y. I'll give clues for you to find the issue else I fear I'll find there are still missing informations: the container has to NAT the host: you need a MASQUERADE rule on the container. the host needs a gateway: its default route must be via or you get those strange ARPs – A.B Jan 16 at 20:46
  • @A.B ip on host0 is and ip for lxc0 is, somehow its not taking the for lxc0 i just now tried superuser.com/questions/938805/…, still it does not work default route on host is – enthu Jan 16 at 20:50
  • Well fix your host's host0 to be in the range (I don't know what's the problem), and fix the container in LXC by not configuring at all lxc0 by the container's OS: LXC already configured it. don't even declare an lxc0 interface. There are too many small issues at once. Try to solve them then rework your question to have all those informations ready – A.B Jan 16 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.