No Internet connectivity to linux container on Debian

Posted by kirankumar on Server Fault See other posts from Server Fault or by kirankumar
Published on 2013-11-09T03:30:04Z Indexed on 2013/11/09 3:59 UTC
Read the original article Hit count: 424

Filed under:
|
|

I have created a linux container with debian-wheezy template. I am not able to have internet connectivity from the container. Below is my network configuration. Could some one please help me in figuring out the issue ? I can ping to the eth0 ip address in the container from the host. Similarly, i can ping from container to br0 ip address on the host.

/etc/network/interfaces on host
===============================

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug eth0
auto eth0
iface eth0 inet dhcp


# bridge configuration
auto br0
iface br0 inet dhcp
bridge_ports eth0 vethCE2
bridge_fd 0
bridge_stp off
bridge_maxwait 0

ifconfig -a output on host
==========================
ifconfig -a
br0       Link encap:Ethernet  HWaddr 08:00:27:bd:61:5e 
      inet addr:10.0.0.11  Bcast:10.0.0.255  Mask:255.255.255.0
      inet6 addr: fe80::a00:27ff:febd:615e/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:422 errors:0 dropped:0 overruns:0 frame:0
      TX packets:266 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:174110 (170.0 KiB)  TX bytes:31582 (30.8 KiB)

eth0      Link encap:Ethernet  HWaddr 08:00:27:bd:61:5e 
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:13017 errors:0 dropped:0 overruns:0 frame:0
      TX packets:6210 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:7944745 (7.5 MiB)  TX bytes:1368421 (1.3 MiB)

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:16436  Metric:1
      RX packets:835 errors:0 dropped:0 overruns:0 frame:0
      TX packets:835 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:91148 (89.0 KiB)  TX bytes:91148 (89.0 KiB)

vethCE2   Link encap:Ethernet  HWaddr fe:3a:43:52:14:49 
      inet6 addr: fe80::fc3a:43ff:fe52:1449/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:52 errors:0 dropped:0 overruns:0 frame:0
      TX packets:205 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:2660 (2.5 KiB)  TX bytes:31133 (30.4 KiB)

brctl show output on host
==========================
bridge name    bridge id        STP enabled    interfaces
br0        8000.080027bd615e    no        eth0
                                       vethCE2

/etc/network/interfaces on container
=======================================
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 10.0.0.99
netmask 255.255.255.0
network 10.0.0.0

ifconfig -a output on container
===============================

root@CE2:~# ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:11:22:33:44:00 
      inet addr:10.0.0.99  Bcast:10.0.0.255  Mask:255.255.255.0
      inet6 addr: fe80::211:22ff:fe33:4400/64 Scope:Link
      UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
      RX packets:198 errors:0 dropped:0 overruns:0 frame:0
      TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:1000
      RX bytes:30121 (29.4 KiB)  TX bytes:2660 (2.5 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:16436  Metric:1
      RX packets:26 errors:0 dropped:0 overruns:0 frame:0
      TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
      collisions:0 txqueuelen:0
      RX bytes:2366 (2.3 KiB)  TX bytes:2366 (2.3 KiB)

Networking content of /var/lib/lxc/CE2/config
==============================================
# networking
lxc.network.type = veth
lxc.network.flags = up
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.veth.pair = vethCE2
# It is fine to be commented out
#lxc.network.ipv4 = 192.168.10.21/24
# Change this
lxc.network.hwaddr = 00:11:22:33:44:00

Let me know if you need any other details.

Thanks, Kiran Kumar

© Server Fault or respective owner

Related posts about linux

Related posts about networking