Calculating the network distance between two hosts

I want to calculate some metrics regarding the "distance" between two hosts in a network application. I came up with the following naive solution, inspired ping.

  • Sending UDP packets of various sizes.
  • Wait for another node to respond.
  • Calculate the time between sending and receiving.
  • Normalize this data and calculate my indicators over it.

I would like to avoid managing raw sockets, but if this is the best option, let me know.

Would you recommend a different solution?

EDIT:

I think I did not quite understand this. I know what TTL is and traceroute, and that is not what I am looking for.

What I'm looking for is the best metric combining latency, bandwidth and yes, the traditional distance between hosts (because, in my opinion, it’s traceroutenot very useful for managing the protocol). This is the motivation for using ping-like measures.

+5
source share
5 answers

The question is, can you change the existing protocol or be more hardworking and fix the RTT from the existing response message responders?

, , . , , - .

, .

+3

- , .

, distance(A, B). , A B:

distance(A, B) = f(bandwidth(A, B), latency(A, B))

f() - . :

distance(A, B) = alpha * bandwidth + beta * latency

, , . , , (), :

performance(A, B) ~ alpha * bandwidth(A, B) + beta * latency(A, B)

, . :

distance(A, B) + distance(B, C) >= distance(A, C)

, .

+3

"" . , . traceroute, , , TTL.

: , - . , ( ).

, RTT . - , TCP, RTT . , " RTT" .

+2

IMHO .

  • "" , - VOIP. , .
  • ( "" ), , - ,
  • , (, ). " " , , " t " .

, , . .

+2

, :

(TTL)

8- (, ) . . , 1 1. , . TTL . TTL , . , ICMP ( , ) , , . ICMP , traceroute.

In short, you can send serial IP packets, reducing the lifetime for each one you send. Once you stop receiving a response, you know roughly how many hepas should exist between the source and target hosts.

If you do not want to work with sockets on your own, you can simply use the ping command , which provides a feature that allows you to specify a lifetime value to use for ping packets.

+1
source

All Articles