Networking Services and Ports
There are two general types of network services, which are connection less and connection oriented. Connection oriented service performs connection establishment, data transfer, and connection termination.
The "ping" program uses ICMP echo message requests and listens for ICMP echo message reply messages from its intended host. Using the -R option with ping enables the record route feature. If this option is used ping will set the record route (RR) in the outgoing ICMP IP datagram
The "traceroute" program uses ICMP messaging and the time to live (TTL) field in the IP header. It works by sending a packet to the intended host with a TTL value of 1. The first router will send back the ICMP "time exceeded" message to the sending host. Then the traceroute program will send a message with a TTL of 2, then 3, etc. This way it will get information about each router using the information received in the ICMP packets. To get information about the receiving host, the message is sent to a port that is not likely to be serviced by that host. A ICMP "port unreachable" error message is generated and sent back.
Some telnet command codes and their meanings