How to simulate traceroute using ping?
5,229
There is a way to do this.
In Linux or Cygwin:
for i in {1..30}; do ping -t $i -c 1 google.com; done | grep "Time to live exceeded"
In Windows:
for /l %i in (1,1,30) do @ping -i %i -n 1 google.com | find "TTL expired"
Sample output from an Amazon EC2 VPS:
From 100.64.16.93 icmp_seq=1 Time to live exceeded
From 205.251.232.220 icmp_seq=1 Time to live exceeded
From 205.251.232.202 icmp_seq=1 Time to live exceeded
From 205.251.232.75 icmp_seq=1 Time to live exceeded
From 205.251.225.181 icmp_seq=1 Time to live exceeded
From 72.14.219.251 icmp_seq=1 Time to live exceeded
From 209.85.249.32 icmp_seq=1 Time to live exceeded
From 216.239.51.159 icmp_seq=1 Time to live exceeded
Ping isn't allowed for that instance, that's why it times out.
Related videos on Youtube
Author by
Kabachok
Updated on September 18, 2022Comments
-
Kabachok over 1 year
I am learning computer networks and looking for a way to simulate traceroute using the
ping
command. I think it has something to do with ttl, but I don't know how to develop that further.-
slhck almost 9 yearsCan you elaborate on what exactly you mean by "simulating" a traceroute with ping? Do you have a specific assignment given?
-
-
td512 almost 9 yearsNo probs, enjoy
-
td512 almost 9 yearsnothing, but I hardly use windows anymore, so I defaulted to the linux command line
-
td512 almost 9 years@Karan, oh, I didn't know that I needed the @ :D you taught me something new. No, I defaulted because I couldn't think of the windows version. feel free to update the answer if you think it's appropriate. :P
-
Karan almost 9 yearsDone. :) (filler)
-
td512 almost 9 years@Karan Thank you. I think Windows is a necessary evil for games, otherwise, it's linux on an SSD :P
-
Karan almost 9 yearsBoth have pros and cons and I use whatever suits the job at hand best. It's not a religious debate for me like it is for some. :)