I want to get all route info when user request to server. When user open my application then user enter domain name or IP-address then after click on trace route then it show the route to the destination and even information about all hop between source to destination.so how to achieve tracing of path and its in between devices info like IP-address , host name, time to live, turn around trip time.
Share
The normal way to achive that is to send out ICMP packages with a TTL (time to live) of 1 and increasing them until you reach your desired ip address.
The TTL is decreased at every hop. So the router where the TTL gets zero will answer that the package cannot be routed to your destination. With this small trick all traceroutes work.
To get the host name you need to make a reverse lookup of that ip. In linux this is simply done with
dig -x [ip-address]. Of cause that won’t help you but so you may find more detailed help. Technically this works with RDNS (Reverse DNS) where you just resolve an special domain to get the domain name (if set).To get the RTT (round-trip time) you just need to measure the time for getting the icmp response and divide it with two.