NOSintro – TCP/IP over Packet Radio

An Introduction to the KA9Q Network Operating System

by Ian Wade, G3NRW

Chapter 33: PING AND HOP

 

One of the very first TCP/IP commands which you’re likely to use on-air is ping, which sends test packets to another station. If that station is within range and operational, it should reply to those packets. Ping then displays the round-trip time (rtt) between sending each test packet and getting a reply.

If the rtt is low (of the order of a few seconds for a 1200 bps radio link), you know that all is well. Hence, if you’re not certain that you can talk to another TCP/IP station, ping is the command to use.

The ping command tells you how long it took to send out a test packet and get a reply, but it doesn’t tell you which route it took in doing so. Sometimes it’s useful to know this, particularly if the rtt is unexpectedly long — someone could have changed their routing tables, so that your packets are now travelling over completely different terrain. The command to find out which way your packets are going is hop.

This chapter explains in detail how to use the ping and hop commands.

 

The ping Command

The syntax of the ping command depends on the version of NOS which you are using. It will be one of the following:

ping host [ length [ milliseconds [ incflag ] ] ] {or}

ping
host [ length [ seconds [ incflag ] ] ]

The only difference between them is the way you specify the time interval between sending out test packets. This should be about 5000 milliseconds, or 5 seconds. If you get the units wrong, you will either send out packets every 5000 seconds or every 5 milliseconds — neither of these are particularly helpful!

To find out which version you have, try pinging yourself, with the ping loopback command:

net> ping loopback 0 1000 {or}
net>
ping loopback 0 1

(The digit 0 is the number of additional bytes to include in each test packet — there is usually no need to increase this).

A new session will start, and you will see an output something like this:

Resolving loopback... Pinging loopback (127.0.0.1); data 0 interval 1000 ms:

sent rcvd % rtt avg rtt mdev
1 1 100 32 32 0
2 2 100 15 30 4
3 3 100 14 28 7
4 4 100 14 26 9

To stop the ping, escape back to the Session Manager and give the reset command.

Note that the rtt values are short (just tens of milliseconds). This is because the loopback path is entirely within your system.

If you ping a real station (Fig 33-1), you’ll find the times are very much longer:

net> ping ns9mxa 0 5000

Resolving ns9mxa... Pinging ns9mxa (44.199.41.90); data 0 interval 5000 ms:

sent rcvd % rtt avg rtt mdev
1 1 100 4923 4923 0
2 2 100 2305 4596 655
3 3 100 2818 4374 936
4 4 100 2399 4127 1196

Fig 33-1: The ping command checks that a remote station is active. If the sending station does not know the AX.25 callsign of the target, an ARP request is sent out first to get the callsign.

 

Note here that the rtt for the first ping (4923 ms) is about twice as long as the remaining rtt values. This is because the AX.25 callsign for ns9mxa is unknown at the start (there is no ARP table entry), and so ns9bob needs to send out an ARP Request to get it. Station ns9mxa responds with an ARP Reply containing its callsign (NS9MXA-5), giving ns9bob the necessary AX.25 destination address for the ping packets.

The incflag parameter in the ping command is an experimental feature to allow a group of stations to be pinged. If you set the flag to a non-zero value, the Internet address will be incremented by one after each ping.

 

The hop commands

There are several hop commands:

hop check:   This command initiates a hop check session to the specified target host. It sends a series of UDP probe packets to determine the sequence of gateways in the path to the target.
For example:

net> hop check ns9liz

A new session starts, reporting the progress of the probe packets through the network to the target:

Resolving ns9liz... hopcheck to 44.199.45.17:33434
1: 44.199.41.1 ns9bob.ampr.org. (20 ms) (12 ms)
2: 44.199.41.2 ns9ken.ampr.org. (2047 ms) (1946 ms)
3: 44.199.45.17 ns9liz.ampr.org. (4237 ms) (4163 ms)
hopcheck done: normal (Unreachable Port)

This shows that there is a route from Bob to Liz via Ken. Exactly how this works is described in detail below.

 

hop maxttl:   This command sets the limit of your search; i.e. the maximum number of IP gateways through which the probe packets pass on their way to the target. For example, to limit the search to 10 gateways:

net> hop maxttl 10

 

hop maxwait:   This command lets you set the maximum time in seconds that a hop check session will wait for responses at each stage of the trace. For example:

net> hop maxwait 60

 

hop queries:   This command sets the number of UDP probes that will be sent at each stage of the trace. For example:

net> hop queries 2

 

hop  trace:   You can record the progress of the check with this command. For example:

net> hop trace on

The trace goes into the session log file (/dump/session.log). Predictably, the command hop trace off turns the trace off.

 

How hop check works

The hop check command works by sending a series of UDP probe packets to the target, with progressively increasing values of the time-to-live (ttl) parameter — see Fig 33-2. That is, the first packet has a ttl value of 1, the second has a value of 2, and so on, up to the maxttl value. Each packet is addressed to a dummy UDP port number (33434) at the target.

As each probe packet passes through a gateway, the gateway decrements the ttl value by one. If this results in a value of zero, the gateway sends an ICMP Time Exceeded packet back to the originating station, ns9bob.

 


Fig 33-2: The hop check command sends a series of UDP probe packets towards the target. As each probe passes through a gateway, the time-to-live is decremented by one. If the ttl becomes zero, the gateway returns Time Exceeded. When the final target receives a probe, it returns Unreachable Port.

The first probe passes to ns9bob’s own gateway, which decrements the ttl to zero and returns a Time Exceeded packet. The second probe reaches ns9ken, which likewise returns Time Exceeded.

The third probe gets as far as the target, ns9liz. As the packet is addressed to ns9liz, an attempt is now made to connect to UDP port 33434. This port doesn’t actually exist, so ns9liz sends an ICMP Unreachable Port packet back to ns9bob. This tells ns9bob that the hop check is complete, and it can finally display the complete report.

 

Back to Contents Page

Back to NOSintro Main Page.


[Copyright 1992-2009 Dowermain Ltd. All Rights Reserved. This page last modified: 21 May 2009]