Computer Networking basically uses four primary types of addressing, namely Physical addresses, IP addresses, IP Protocol Type and Transport layer Port Numbers, to uniquely reach networking devices, end nodes and end node application processes. Each of these addresses are briefly described below:
Physical and Data link Layer addressing :
At the physical and data link layers, communicating nodes (end nodes and intermediate devices) are identified by addresses usually termed as Physical Addresses. In fact, every interface (NIC) of a communicating device usually has a unique physical address, that helps in uniquely identifying and communicating with the interface at the physical and data link layers. These physical addresses are used in the data link layer frame headers, for carrying frames between neighbouring nodes belonging to the same network. At the data link layer, intermediate devices like Layer 2 Switches use physical addresses to switch the frame to the destination node, within a single network. In the journey of an end-to-end IP packet, as the type of data link layer and physical layer interfaces may vary from hop to hop, the physical layer addresses keep changing in the different frame headers carrying the same IP packet.
If the underlying interface is Ethernet, then the physical layer address is termed as a MAC address and it consists of 6 bytes. The 6 byte MAC address usually has a hierarchy with place holders for public or private, Organization Identifier, Broadcast or Unicast etc. Such a hierarchical structure ensures that each interface (NIC) of a communicating node has a globally unique MAC address. Examples of MAC addresses represented in hexadecimal form are 0x0101010203FF, 0xFFFFFFFFFFFF etc.
Other types of physical addresses include DLCI (Data Link Connection Identifier) for Frame-Relay interfaces, VPI/VCI (Virtual Path Identifier/Virtual Channel Identifier) for ATM/X.25 interfaces, Labels for MPLS interfaces, VLAN tags for VLAN interfaces etc.
IP addresses :
While physical addresses help in uniquely identifying nodes and their interfaces within a single network/sub-network, they cannot be used to uniquely identify interfaces and nodes across the whole internet. This is primarily due to the fact that there are a wide variety/types of physical layer interfaces like Ethernet, ATM, Optical etc. in use and each of these interfaces have a different form of address at the physical layer and they also do not follow a standard convention or length. To overcome this problem, logical addresses known as IP addresses are used at the network layer (layer 3), to uniquely identify interfaces of communicating nodes globally. Just like Physical addresses, each interface of a communicating end node would have a unique IP address. IP version 4 (IPV4) have 4 byte IP addresses in the form A.B.C.D and IP version 6 (IPV6) have 16 byte IP addresses. Each communicating node on the Internet MUST have at least one unique public IP address, in order to successfully communicate on the Internet. IP addresses, unlike physical addresses, have end to end significance. An IP packet containing application layer data is carried end to end across the network, from the source node to a remote destination node, using mainly the destination IP address. Examples of IPV4 addresses are 10.0.0.1, 126.96.36.199 etc.
Transport Layer addressing :
Using the IP addresses, a packet reaches the network layer of the receiving node. The next task is to hand over the packet to the appropriate Transport layer protocol.
The protocol type field in the IP header is used to identify the transport layer protocol used by a particular datagram/packet. TCP, UDP, SCTP, ICMP etc. are examples of typical transport layer protocols and each such protocol has a unique value in the IP protocol type field. For example: TCP has an IP protocol type value of 0x06, UDP has an IP protocol type value of 0x11.
Application layer addressing :
After a packet reaches the transport layer protocol stack of the receiving node, the next task is to forward the application data contained in the packet to the appropriate application layer protocol/process. Multiple application layer protocols can use the same transport layer protocol. For example, application layer protocols HTTP, SMTP, FTP all use TCP as the underlying transport layer protocol. Hence, an entity known as the Transport layer Port Number is used to uniquely identify each application layer protocol. For example, HTTP uses the reserved TCP port number 80, SMTP uses the reserved TCP port number 25, FTP control connection uses the reserved port number 21 etc. Similarly, DNS uses the reserved UDP port number 53, SNMP uses the reserved UDP port numbers 161 and 162. Normally, the transport layer header contains fields named as source port number and destination port number to uniquely identify the sending and the receiving processes respectively.
- IP addresses are used to carry end-end IP packets/datagrams (containing application data), from the source node to the destination node across the Internet.
- Once IP packets reach the destination node, IP protocol type and transport protocol port numbers are used together to hand over the application data to the appropriate application layer protocol process.
- At each intermediate hop during the journey of an IP packet, once an appropriate neighbouring node is identified using the destination IP address of the packet, physical addresses are used to carry the packets (encapsulated inside frames) to the appropriate next hop.