Tracing route to 203.94.12.54 over a maximum of 30 hops
1 abc.netzero.com (232.61.41.251) 2 ms 1 ms 1 ms
2 xyz.Netzero.com (232.61.41.0) 5 ms 5 ms 5 ms
3 232.61.41.10 (232.61.41.251) 9 ms 11 ms 13 ms
4 we21.spectranet.com (196.01.83.12) 535 ms 549 ms 513 ms
5 isp.net.ny (196.23.0.0) 562 ms 596 ms 600 ms
6 196.23.0.25 (196.23.0.25) 1195 ms1204 ms
7 backbone.isp.ny (198.87.12.11) 1208 ms1216 ms1233 ms
8 asianet.com (202.12.32.10) 1210 ms1239 ms1211 ms
9 south.asinet.com (202.10.10.10) 1069 ms1087 ms1122 ms
10 backbone.vsnl.net.in (203.98.46.01) 1064 ms1109 ms1061 ms
11 newdelhi-01.backbone.vsnl.net.in (203.102.46.01) 1185 ms1146 ms1203 ms
12 newdelhi-00.backbone.vsnl.net.in (203.102.46.02) ms1159 ms1073 ms
13 mtnl.net.in (203.194.56.00) 1052 ms 642 ms 658 ms
I need to know the path from my computer to a host on the Internet with the ip address is 203.94.12.54. I need to tracert to it! As you can see above, packets from the machine I want to reach 203.94.12.54 must go through 13 hops (links) on the network. This is the path of packets: Netzero (ISP has sent data) -> Spectranet (a Backbone Provider) -> New York ISP -> New York Backbone -> Asia -> South Asia -> India Backbone -> New Delhi Backbone -> another router in New Delhi Backbone -> New Delhi ISP.
So, the host has ip address 203.94.12.54 located in New Delhi, India, South Asia! You can also telnet to 203.94.12.54 on port 13 to determine the GMT time by which you can know the location of this host (requires that a host of 203.94.12.54 must run the datetime daemon and be properly configured about time)!
How does Traceroute work?
First of all, you need to know about ICMP, TTL and how routers work!
ICMP basic knowledge - Internet Control Message Protocol.
ICMP is used to report errors that occur during the transmission of data packets on the network. ICMP is a transport layer - Transpoort Layer! Floor application HTTP FTP Telnet Finger SSH DNS
POP3 / IMAP SMTP Gopher BGP
Time / NTP Whois TACACS + SSL DNS SNMP RIP
RADIUS Archie
Traceroute tftp Ping
Shipping floor
TCP
UDP
ICMP
OSPF
Internet floor
IP
ARP
Ethernet / 802.3 Token Ring (802.5) SNAP / 802.2 X.25 FDDI ISDN
Frame Relay SMDS Wireless ATM (WAP, CDPD, 802.11)
DDS Fiber Channel / DS0 / T-carrier / E-carrier SONET / SDH DWDM
PPP HDLC SLIP / CSLIP xDSL Cable Modem (DOCSIS)
All ICMP messages are shipped with IP datagrams. Each ICMP message wrapped in the IP datagram will look like this:
+ --------------------- + ------------------------- +
| IP Header (20 bytes) | ICMP message (32 bytes) |
+ --------------------- + ------------------------- +
The following is the structure of an IMCP message: (refer to RFC792 for more!)
0 7 8 15 16 31
+ ----------------- + ----------------- + ------------- ---- +
| Type (0 or 8) | Code (0) | 16-bit Checksum |
+ ----------------- + ----------------- + ------------- ---- +
| Indentifier | sequence number |
+ ----------------- + ----------------- + ------------- ---- +
| |
| Optional Data (content depends on Type and Code) |
| |
+ ------------------------------------------------- ---- +
The type field has 15 different values, depending on the specific ICMP error message type. For example, type = 3 to specify "Destination unreachable" error message!
The code = sub-error field is used to determine the exact error. For example, type = 3 and code = 0 means "Network Unreachable"; if type = 3, code = 1 means "Host Unreachable" .
TTL - Time to Live. TTL is an 8-bit field in the IP header (please review the structure of IP header!). TTL is the time when a packet exists on the network before it is ignored. The sender of the data will determine a previous TTL value, usually between 32 and> 64. This value will be reduced once once transferred via a network router. When this value is 0, this datagram will be ignored and the ICMP protocol will report an error to the sender. This will prevent this datagram from entering an endless loop through the routers. Each router when receiving an IP datagram will reduce the TTL value of this datagram to one. Most routers do not retain this datagram for more than 1 second before transferring this datagram. So the TTL value can be treated as hop (counter) = the number of routers that this datagram has just passed. When the router receives a datagram with a TTL field of 0 or 1, it will not forward this datagram. Instead, it ignores this datagram and sends an "Time Exceeded" ICMP message back to the person who sent this datagram! Because the ICMP message that the router sends back to the sender has the source address - source address is the ip address of this router so the sender can know the IP address of this router!
The way of traceroute!
Traceroute sends an IP datagram with TTL = 1 to the target system. The first router to receive this datagram will reduce the TTL value by one -> TTL = 0 and this router will ignore this datagram (don't send it again!) And send an ICMP error message with the source IP address of it comes to you. So the router can determine the IP address of the first router! After that, the traceroute will send a new datagram with the value TTL = 2 (1 + 1 = 2) to the target system. The first router will reduce the value of a TTL -> TTL = 1 (2-1 = 1) and transfer this datagram to the second router.
The second router receiving the datagram with TTL = 1 will reduce TTL = 0. If I see TTL = 0, it will not move this datagram. Router 2 will send you an ICMP error message with the source ip address as its ip address (router 2). So the traceroute on the machine will know the second router that the datagram has passed. Traceroute will continue to send another datagram with TTL = 3 (2 + 1 = 3) and repeat the process until the datagram reaches the target system!
If now the IP datagram has reached the destination, TTL = 1. The destination host will ignore this datagram and it will not send an "Time Exceeded" ICMP error message. So you will not be able to know if you have reached your destination yet ?! Traceroute uses another mechanism as follows: Traceroute sends UDP datagrams to the destination host on UDP ports with large numbers (> 30000). The reason it chooses ports is great because there are usually no applications listening at these ports. When the destination host receives this UDP datagram, it sends back an ICMP error message "Port Unreachable" (not reaching the port) for traceroute. Now, traceroute can distinguish the difference between ICMP error message "Time Exceeded" with "Port Unreachable" to know if it has reached the destination or not ?!
Note: ICMP error message "Time Exceeded" has type = 1 and code = 0; ICMP eror message "Port Unreachable" has type = 3 and code = 3
Summary: traceroute sends UDP datagrams to the destination host with a TTL value of 1 and is incremented each time to determine which routers the datagrams went through. Each router sends back an "Time Exceeded" ICMP message. The target system will return for traceroute an ICMP message "Port Unreachable". Traceroute relies on this difference to determine if the destination has arrived yet ?!
Final example!
host2 # traceroute xyz.com traceroute to xyz.com (202.xx.12.34), 30 hops max, 40 bytes packets
1 isp.net (202.xy.34.12) 20ms 10ms 10ms 2
xyz.com (202.xx.12.34) 130ms 130ms 130ms
The first line indicates the hostname and IP address of the target system. This line also tells us the TTL value of <= 30 and the size of the datagram is 40 bytes (20-bytes IP Header + 8-bytes UDP Header + 12-bytes user data).
The second line indicates that the first router that received the datagram is 202.xy.34.12, the value of TTL when sent to this router is 1. This router sends back the program traceroute an ICMP message error "Time Exceeded". Traceroute will forward one datagram to the target system.
The third line, xyz.com (202.xx.12.34) received a TTL datagram with 1 = (the first router dropped one before - TTL = 2-1 = 1). However, xyz.com is not a router, it sends back for traceroute an ICMP error message "Port Unreachable". Upon receiving this ICMP message, traceroute will know that it has reached the target xyz.com system and ends the task here. In case the router does not respond after 5 seconds, the traceroute will print a "*" asterisk (unknown) and continue sending another datagram to the destination host!
See more:
Author: Fantomas311 - Vietnam Security