6

I have installed the 18.04 ubuntu docker image, and in it, I installed the following packages:

 apt-get install traceroute
 apt-get install net-tools
 apt-get install iputils-ping
 apt-get install netbase

But when I use traceroute, all packets beyond docker seem to be filtered:

#traceroute google.com
traceroute to google.com (172.217.16.206), 30 hops max, 60 byte packets

 1  172.17.0.1 (172.17.0.1)  0.397 ms  0.309 ms  0.286 ms
 2  * * *
 3  * * *
 4  * * *
 5  * * *
 6  * * *

Is there a workaround to make it work? Note that in the windows host, tracert works.

user2468170
  • 1,234
  • 2
  • 15
  • 19

1 Answers1

1

According to this, others have noticed that "traceroute doesn't work on Linux Containers running on Docker for Windows". If it's indeed an issue with ICMP (traceroute uses UDP as a default protocol), you should be able to force traceroute to use ICMP and/or "ICMP ECHO as a probe" by following traceroute's doc.

Here 192.168.1.254 is the IP of the gateway of a Windows machine running Docker for Windows and 10.0.0.1 is the gateway of a Docker custom network:

root@a6b6fc6aa0f5:/usr/local/apache2# traceroute 192.168.1.254
traceroute to 192.168.1.254 (192.168.1.254), 64 hops max
1   10.0.0.1  0.004ms  0.002ms  0.002ms
2   *  *  *
3   *  *  *

One should use:

root@a6b6fc6aa0f5:/usr/local/apache2# traceroute --icmp 192.168.1.254
traceroute to 192.168.1.254 (192.168.1.254), 64 hops max
  1   10.0.0.1  0.005ms  0.002ms  0.002ms
  2   192.168.1.254  1.217ms  0.984ms  0.853ms

or:

root@a6b6fc6aa0f5:/usr/local/apache2# traceroute --type=icmp 192.168.1.254
traceroute to 192.168.1.254 (192.168.1.254), 64 hops max
  1   10.0.0.1  0.003ms  0.002ms  0.001ms
  2   192.168.1.254  1.410ms  1.005ms  1.507ms

With www.google.com as a target traceroute still have an issue on my machine but eventually reaches something. Not exactly a "route" though... Maybe it's now about WinNAT, TTL, TCP forwarding or some Docker inside parameters.

root@f5d952a9119f:/usr/local/apache2# traceroute --icmp www.google.com
traceroute to www.google.com (142.250.74.228), 64 hops max
  1   10.0.0.1  0.019ms  0.002ms  0.002ms
  2   *  *  *
  3   *  *  *
  4   *  *  *
  5   *  *  *
  6   *  *  *
  7   *  *  *
  8   142.250.74.228  8.304ms  7.595ms  7.027ms

Version : traceroute (GNU inetutils) 2.0

pastalord
  • 21
  • 3