I'm learning ROS recently. I'm using docker to install ros-kinetic and have been working on it for a week. The problem showed up today when I tried to install tofrodos in docker container via apt-get. I redo all the operation from restarting the wsl and found internet was not accessible after I start the docker service.
ping google.com
PING google.com (142.251.40.142) 56(84) bytes of data.
64 bytes from lga25s80-in-f14.1e100.net (142.251.40.142): icmp_seq=1 ttl=113 time=21.6 ms
64 bytes from lga25s80-in-f14.1e100.net (142.251.40.142): icmp_seq=2 ttl=113 time=20.0 ms
^C
--- google.com ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 20.014/20.819/21.625/0.805 ms
sudo service docker start
[sudo] password for jonathan:
* Starting Docker: docker [ OK ]
ping google.com
ping: google.com: Temporary failure in name resolution
ping 142.251.40.142
PING 142.251.40.142 (142.251.40.142) 56(84) bytes of data.
64 bytes from 142.251.40.142: icmp_seq=1 ttl=113 time=21.6 ms
64 bytes from 142.251.40.142: icmp_seq=2 ttl=113 time=22.4 ms
^C
--- 142.251.40.142 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 21.614/22.023/22.432/0.409 ms
Everything works fine after I restarted the wsl. I could ping google.com, and failed after I start the docker service. Ping the ip is working. Then I throught something is wrong with dns. Dns is working on host machine. I tried to add 8.8.8.8 to /etc/resolv.conf. Ping google.com works but it reponsed slowly and apt update still not working.
cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.17.0.1
sudo vim /etc/resolv.conf
cat /etc/resolv.conf
# This file was automatically generated by WSL. To stop automatic generation of this file, add the following entry to /etc/wsl.conf:
# [network]
# generateResolvConf = false
nameserver 172.17.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4
sudo service network-manager restart
* Stopping network connection manager NetworkManager [ OK ]
* Starting network connection manager NetworkManager [ OK ]
ping google.com
PING google.com (142.251.41.14) 56(84) bytes of data.
64 bytes from lga34s40-in-f14.1e100.net (142.251.41.14): icmp_seq=1 ttl=55 time=21.1 ms
64 bytes from lga34s40-in-f14.1e100.net (142.251.41.14): icmp_seq=2 ttl=55 time=24.8 ms
64 bytes from lga34s40-in-f14.1e100.net (142.251.41.14): icmp_seq=3 ttl=55 time=21.5 ms
^C
--- google.com ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 21.135/22.477/24.838/1.674 ms
sudo apt update
0% [Working]^C
ping baidu.com
ping: baidu.com: Temporary failure in name resolution
nslookup google.com
;; connection timed out; no servers could be reached
Iptables changed after starting docker service. I'm not familiar with it so I'm not sure if there are any problem with it.
sudo iptables -L
[sudo] password for jonathan:
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
sudo service docker start
[sudo] password for jonathan:
* Starting Docker: docker [ OK ]
sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy DROP)
target prot opt source destination
DOCKER-USER all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain DOCKER (2 references)
target prot opt source destination
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target prot opt source destination
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-2 all -- anywhere anywhere
RETURN all -- anywhere anywhere
Chain DOCKER-ISOLATION-STAGE-2 (2 references)
target prot opt source destination
DROP all -- anywhere anywhere
DROP all -- anywhere anywhere
RETURN all -- anywhere anywhere
Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere
I'm really frustrated that I haven't found any similar problem. Please help me...