Skip to content

Instantly share code, notes, and snippets.

Created September 19, 2015 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/fee07975022b529717ae to your computer and use it in GitHub Desktop.
Save anonymous/fee07975022b529717ae to your computer and use it in GitHub Desktop.
Debugging Kubernetes network
# /etc/systemd/system/docker.service
[Unit]
Description=Docker Application Container Engine
Documentation=http://docs.docker.com
After=docker.socket early-docker.target network.target setup-network-environment.service
Requires=docker.socket early-docker.target setup-network-environment.service
[Service]
Environment=TMPDIR=/var/tmp
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
ExecStart=/usr/lib/coreos/dockerd --daemon --host=fd:// --bridge=cbr0 --iptables=false --ip-masq=false
[Install]
WantedBy=multi-user.target
core@pc-10368 ~ $ docker exec -ti 3b6 /bin/bash
root@test-0ocfk:/# ping -c 1 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
ping: sending packet: Network is unreachable
root@test-0ocfk:/# ping -c 1 192.168.1.6
PING 192.168.1.6 (192.168.1.6): 56 data bytes
ping: sending packet: Network is unreachable
root@test-0ocfk:/# ping -c 1 www.google.com
ping: unknown host
root@test-0ocfk:/# ifconfig
bash: ifconfig: command not found
root@test-0ocfk:/# exit
core@pc-10368 ~ $
core@pc-10368 ~ $ ifconfig cbr0
cbr0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::d8c5:1fff:fe59:42ff prefixlen 64 scopeid 0x20<link>
ether da:c5:1f:59:42:ff txqueuelen 0 (Ethernet)
RX packets 71 bytes 5132 (5.0 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 326 bytes 17297 (16.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
core@pc-10368 ~ $ docker run -ti ubuntu
root@5159bdfd3d36:/# ping -c 1 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.053 ms
--- 192.168.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.053/0.053/0.053/0.000 ms
root@5159bdfd3d36:/# ifconfig
eth0 Link encap:Ethernet HWaddr 02:42:c0:a8:01:08
inet addr:192.168.1.8 Bcast:0.0.0.0 Mask:255.255.255.0
inet6 addr: fe80::42:c0ff:fea8:108/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:27 errors:0 dropped:0 overruns:0 frame:0
TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2300 (2.3 KB) TX bytes:898 (898.0 B)
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:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
root@5159bdfd3d36:/# ping -c 1 www.google.com
PING www.google.com (173.194.40.82) 56(84) bytes of data.
64 bytes from zrh04s06-in-f18.1e100.net (173.194.40.82): icmp_seq=1 ttl=52 time=1.09 ms
--- www.google.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.098/1.098/1.098/0.000 ms
root@5159bdfd3d36:/#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment