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. It uses a -bit addressing scheme allowing to store addresses which are more than billion addresses.
At the starting of IPv 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 addressing scheme as it’s limited to -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. 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 supports IPv6 either directly or indirectly.
Let’s look at an example of IPv 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 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 .
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 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 .
In a modern-day computer, possible port numbers are available. Some of the popular and commonly used port numbers are: and for FTP, for Secure Shell (SSH), for Telnet, for Simple Mail Transfer Protocol (SMTP), 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 . Telnet uses port number , 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 , 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:
IP Address
Port Number
IP address is used for identifying a particular device or a host in a network.
Port number identifies an application or process on a user’s computer.
IP address can be either IPv4 or IPv6. IPv4 can be at most 32 bits and IPv6 can be at most 128 bits.
Port number can be at most 16 bits.
It’s associated with the network layer of the OSI model.
It’s associated with the transport layer of the OSI model.
An IP address is facilitated by the network administrator.
Port number is facilitated by the OS.
To find the IP address, we can use “ipconfig” command.
All the TCP ports can be viewed by applying the command “netstat”.
IP address helps to send information from a sender machine to a receiver machine.
Port number helps the OS to direct the information to the correct application running on the receiver’s machine.
195.165.0.5 is an example of IP address.
An example of port number is port 25 reserved for SMTP.
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.