This article is about implementation design & issues, later there will be source code as well, perhaps.
To determine the route in the Internet that the packets go through, we can send message(-s) with TTL (Time to Live) field set to 1 then increase it by 1 until packets reach their destination.
That way we'll receive ICMP messages 'Time to live exceeded' from each of routers on the packet's way.
Traceroute program does just that, as 'far' as i know.
If we have 'proxy servers' on the way, we can be more sure that the data is not falsified.
This can be expensive however.
Source: , , , perhaps more.