Authors Top

If you have a few years of experience in Computer Science or research, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

1. Overview

In this tutorial, we’ll discuss the IP address and port in networking. We’ll present some key differences between them.

2. IP Address

The full form of IP is an Internet protocol. A computer connected to the Internet can send and receive information from any other networking devices using an IP address. The main purpose of the IP address is to enable communication.

All devices connected to the internet require a unique IP address. With the increase of networking devices, there is a requirement for billions of IP addresses. Either IPv4 or IPv6 fulfills this requirement.

The first version of IP is IPv\mathsf{4}. It uses a \mathbf{32}-bit addressing scheme allowing to store \mathbf{2^{32}} addresses which are more than 4 billion addresses.

At the starting of IPv\mathsf{4} addressing, due to the low number of networking devices used in day-to-day life, the Internet users were very less. Most of the networks were private. When the Internet erupted, it became a risk that we might run out of unique IP addresses with IPv\mathsf{4} addressing scheme as it’s limited to 32-bit.

IPv6 is the latest version of IP. IPv6 is a 128-bits addressing scheme and offers many features that are not present in IPv\mathsf{4}. We present an IPv6 in hexadecimal format.

These features are built-in security, scoped addresses, auto-configuration, quality of service (QoS), new header format, and larger address space. Most operating systems released since 2000 supports IPv6 either directly or indirectly.

Let’s look at an example of IPv\mathsf{4} and IPv6 address:

IP addresses can be classified into four categories: public, private, static, and dynamic. Public IP address routes over the Internet and provides remote access to the computer. The private IP addresses can’t be routed over the Internet and don’t allow traffic from it. These are uses as reserve IP addresses and only work within a local network:

Static IP addresses are assigned to any networking device by Internet Service Providers (ISPs), and they can be both IPv\mathsf{4} or IPv6. This type of IP address doesn’t change unless we change the network architecture. The Dynamic Host Configuration Protocol (DHCP) servers allocate the dynamic IP addresses, and they are subject to change:

3. Port Number

In networking, a port is a virtual communication endpoint. Each process in an operating system has a specific port number associated with it. Port numbers make it easy for a computer to identify incoming traffic and send them to the appropriate processes. It’s also a docking point that helps in sharing information over the internet.

In the OSI model, ports are part of the transport layer. All the networking devices support ports. We use different port numbers in networking to determine the correct protocol to which the OS forwards the incoming traffic. For example, all incoming Hypertext Transfer Protocol (HTTP) traffic goes to port \mathsf{80}.

The primary purpose of a port is to help a computer understand incoming traffic and send them. Suppose Sam wants to send an MP3 file to Mike. Sam uses the File Transfer Protocol (FTP) to transfer the MP3 file to Mike. Now let’s assume that after receiving Sam’s file, Mike’s computer doesn’t identify the MP3 file and sends it to an email application.

In such a case, the email application won’t be able to open the MP3 file. But Sam uses port \mathsf{21} allotted to FTP while transferring the MP3 file. Hence Mike’s computer will identify the file using the port number used here and send it to the appropriate process. Also, parallel Mike can load HTTP webpages on his computer that uses port number \mathsf{80}.

In a modern-day computer, \mathbf{65,535} possible port numbers are available. Some of the popular and commonly used port numbers are: \mathsf{20} and \mathsf{21} for FTP, \mathsf{22} for Secure Shell (SSH), \mathsf{23} for Telnet, \mathsf{25} for Simple Mail Transfer Protocol (SMTP), \mathsf{53} for Domain Name System (DNS) etc.

Let’s look at an example. Here a client computer is trying to create a virtual connection with the server using the port number \mathsf{23}. Telnet uses port number \mathsf{23}, a protocol used to establish a remote connection over a TCP/IP connection. As soon as the request reaches the server and the server identifies the port number \mathsf{23}, it stars a telnet connection:

4. IP Address vs. Port Number

We now know the basics of IP address and port. Let’s see the differences between an IP address and a port:

Rendered by QuickLaTeX.com

5. Conclusion

In this tutorial, we learned the IP address and port in detail. We also presented some significant differences between an IP address and a port number.

Authors Bottom

If you have a few years of experience in Computer Science or research, and you’re interested in sharing that experience with the community, have a look at our Contribution Guidelines.

Comments are closed on this article!