jpetazzo / pipework

Software-Defined Networking tools for LXC (LinuX Containers)
Apache License 2.0
4.22k stars 727 forks source link

No network in docker container #121

Closed legomind closed 9 years ago

legomind commented 9 years ago

I figure I must be missing something.

On host:


cory@tserver:~/dockerfiles/docker-transmission$ docker start transmission
transmission

cory@tserver:~$ sudo pipework br0 transmission 172.16.0.48/24@172.16.0.1

cory@tserver:~$ ping -c4 172.16.0.1
PING 172.16.0.1 (172.16.0.1) 56(84) bytes of data.
64 bytes from 172.16.0.1: icmp_seq=1 ttl=64 time=0.773 ms
64 bytes from 172.16.0.1: icmp_seq=2 ttl=64 time=0.883 ms
64 bytes from 172.16.0.1: icmp_seq=3 ttl=64 time=1.03 ms
64 bytes from 172.16.0.1: icmp_seq=4 ttl=64 time=0.853 ms

In docker container:

root@00168923ddbd:/# ifconfig
eth1      Link encap:Ethernet  HWaddr 0a:87:8f:4c:a0:48
          inet addr:172.16.0.48  Bcast:0.0.0.0  Mask:255.255.255.0
          inet6 addr: fe80::887:8fff:fe4c:a048/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:31 errors:0 dropped:0 overruns:0 frame:0
          TX packets:103 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4613 (4.6 KB)  TX bytes:5141 (5.1 KB)

root@00168923ddbd:/# ping -c4 172.16.0.1
PING 172.16.0.1 (172.16.0.1) 56(84) bytes of data.
From 172.16.0.48 icmp_seq=1 Destination Host Unreachable
From 172.16.0.48 icmp_seq=2 Destination Host Unreachable
From 172.16.0.48 icmp_seq=3 Destination Host Unreachable
From 172.16.0.48 icmp_seq=4 Destination Host Unreachable
pierrecdn commented 9 years ago

You missed to describe what is br0. Depending of the nature of this interface you may have to connect the host to the bridge where your guest container is connected itself.

Honestly, for use-cases where you've got only one host and no specific needs for networking integration, the native docker0 bridge just works, without any pipework tweaking !

legomind commented 9 years ago

Thanks! Stupid mistake! docker0 worked great for me!