Ping is a simple but widely used utility for testing network performance. Every networking professional knows about ping and uses it regularly. Networking connections need the source and destination address of the two computers in the connection and also the source and destination application address. The application address is called a port number. As ping is a networking application, it requires a port number to perform its task. The surprising answer is that ping does not have a port number. To understand why, it is necessary to understand how different networking protocols operate.
Ping is an application within the TCP/IP protocol stack. All Internet communications use TCP/IP, which stands for Transmission Control Protocol/Internet Protocol. The name of the stack includes the names of its two most important element: the Transmission Control Protocol and the Internet Protocol. The Transmission Control Protocol is a Transport Layer protocol. TCP/IP groups protocols together by characteristics and represents these groups as layers in a stack. The Transport Layer is just beneath the Application Layer. Below the Transport Layer is the Internet Layer, where the Internet Protocol is found, and below that is the Network Access Layer.
Each layer in the stack in the sending computer talks to its equivalent layer in the stack in the receiving computer. So the transport protocol in the sending computer communicates with the transport protocol in the receiving computer and the Internet protocol in the sending computer talks to the Internet protocol in the receiving protocol. Transport layer protocol use port numbers to identify themselves and their correspondent. The transport layer protocol forms a segment of data into a packet, which contains its header on the front of the data containing the source and destination address of the applications involved in the communication. These addresses are called ports. The transport layer protocol passes the packet to the Internet Layer for transmission. The Internet Layer puts its own header on the front of the packet, which includes the source and destination address of the computers involved in the connection. These addresses are called IP addresses after the Internet Protocol.
A port is defined as a transport protocol plus a port number. The Transmission Control Protocol is one of the transport protocols of TCP/IP, the other is the User Datagram Protocol. These are known as TCP and UDP and they each have their own set of ports, so UDP port 123 is not the same as TCP port 123.
The Internet Protocol has no mechanism for reporting back errors in transmission and so this function is performed by the Internet Control Message Protocol. Ping uses the functions of this protocol to get back a packet reporting on the status of a transmission and analyzes the speed of its return. ICMP is an Internet Layer protocol. It operates at a lower level than the layer that deals with ports. Ping cannot use port numbers because it operates at a level where port numbers are irrelevant. It is not concerned with passing data from one application to another over the network, only from one computer to another.