How to Explain IP address, Port and Subnet

IP Address

Every computer connected to the internet has an Internet Protocol or IP address which identifies the computer on the internet.

In the currently most widely used version of the Internet Protocol – version 4 – IP addresses are 4 bytes long and are expressed in the form nn.nn.nn.nn. Each nn is a number between 0 and 255.

IP address, port and subnet mask

Port

In order to handle multiple simultaneous connections with the same computer, your computer must be able to distinguish them. To do so, each connection is assigned two port numbers, one at each end point of the connection.

A connection is then uniquely identified with four pieces of information: (1) local address, (2) local port, (3) remote address, (4) remote port. Valid port numbers are between 1 and 65535.

Other well-known destination ports are:

  • 21 – FTP (control connection)
  • 22 – SSH
  • 23 – Telnet
  • 25 – SMTP
  • 80 – HTTP
  • 110 – POP3
  • 143 – IMAP4
  • 443 – HTTPS (HTTP over TLS or SSL)
  • 1080 – SOCKS proxy

Subnet

No computer is directly connected to every other computer on the internet. Instead, each computer is a member of one or more subnets.

Subnets, in turn, are connected to each other by machines called routers or gateways, which belong to multiple subnets, forwarding internet traffic from one subnet to the other and reverse.

In order to successfully communicate with other computers throughout the internet, your computer must know what subnet it is part of, so that it knows what IP addresses are outside your local subnet and must be relayed through the gateway.

In addition, your computer must of course also know the IP address of the gateway.

Typically, a subnet is a group of consecutive IP addresses, such as all IP addresses from 11.22.33.0 to 11.22.33.255

References

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.