Internet Protocol

 

See this article in another language:

Internet Protocol

IP stands for Internet Protocol. The most important task of the IP protocol is to route and specify the origin and destination of a packet. IP, like many other protocols in the network, has different versions and standards.

Currently, what is very common in computer networks is IPv4. Naturally, IPv6 should have been used in all computer networks by the end of 2022.

In fact, one of IPv4's big problems is how small it is compared to computers around the world. The structure of IPv4 is different from IPv6. The IPv4 structure consists of four 8-bit sections, with a period between each 8 bit; That is, in general, IPv4 is a 32-bit address.

That is, in the real world, you will be able to have 4,294,967,296 IPv4 numbers, which is very small compared to the number of computers in the world. The IP address consists of two parts NetID and HostID.

NetID or net id determines the extent of your computer network and host ID makes your computer unique in a computer network. Unlike the story we had in different sections of MAC address, in IP address, the value of net id and host id may not be same in one IP address.

What I mean is that in the 48-bit MAC address we said, it consists of two parts: OUI and Device ID, each of these parts is 24 bits, that is, the number of their bits is equal to each other. But in IP address, in most cases, network id and host id are not same number of bits.

Subnet mask

The important question here is: what determines how many bits of each IP address are related to the host ID and how many bits are related to the network ID?

Next to each IP address, another component called a subnet is specified, which determines the Net ID bits. In computer networks, the network administrator determines what IP address each computer on which subnet will have.

The subnet mask actually determines how much of an IP address belongs to the Net ID. For example, you need to enter a subnet mask when setting the IP on your computer.

If you enter the value 255.255.255.0 in this field, it means that your Net id contains 24 bits and your Host id contains 8 bits. In some systems, this value is also referred to as 24.

That is, the high value is displayed as "192.168.100.1/24" in some systems. After the "/" sign, the number of bits belonging to the net id is placed. In fact, everything is related to the conversion of decimal numbers to binary.

You can't have any subnet mask you want. Actually, since the bits are added one by one, no desired subnet mask can be created.
In the table below, I have written for you the available subnet masks for IPv4:

 

Subnet mask

Binary mask

CIDR

255.0.0.0

11111111.00000000.00000000.00000000

/8

255.128.0.0

11111111.10000000.00000000.00000000

/9

255.192.0.0

11111111.11000000.00000000.00000000

/10

255.224.0.0

11111111.11100000.00000000.00000000

/11

255.240.0.0

11111111.11110000.00000000.00000000

/12

255.248.0.0

11111111.11111000.00000000.00000000

/13

255.252.0.0

11111111.11111100.00000000.00000000

/14

255.254.0.0

11111111.11111110.00000000.00000000

/15

255.255.0.0

11111111.11111111.00000000.00000000

/16

255.255.128.0

11111111.11111111.10000000.00000000

/17

255.255.192.0

11111111.11111111.11000000.00000000

/18

255.255.224.0

11111111.11111111.11100000.00000000

/19

255.255.240.0

11111111.11111111.11110000.00000000

/20

255.255.248.0

11111111.11111111.11111000.00000000

/21

255.255.252.0

11111111.11111111.11111100.00000000

/22

255.255.254.0

11111111.11111111.11111110.00000000

/23

255.255.255.0

11111111.11111111.11111111.00000000

/24

255.255.255.128

11111111.11111111.11111111.10000000

/25

255.255.255.192

11111111.11111111.11111111.11000000

/26

255.255.255.224

11111111.11111111.11111111.11100000

/27

255.255.255.240

11111111.11111111.11111111.11110000

/28

255.255.255.248

11111111.11111111.11111111.11111000

/29

255.255.255.252

11111111.11111111.11111111.11111100

/30

255.255.255.254

11111111.11111111.11111111.11111110

/31

255.255.255.255

11111111.11111111.11111111.11111111

/32

 

If you use subnet mask 255.255.255.252 in your network then two bits left for hostid and you can generate 4 IPs with these two bits.

If you use subnet mask 255.255.255.248 in your network, you will have three bits for hostid and you can generate 8 ip with these three bits. And likewise, if you use the /24 subnet, you can have 256 IPs in total.

It means you can produce 0 to 255 numbers with 8 bits. This means that, in total, we will have 256 one-octet numbers. If all host ID bits in an IP address are zero, this IP address is called a network ID.

And if all hostid bits in an IP address are equal to one, this IP address is called IP broadcast. It means that it is true that we have the ability to create 256 IP addresses with 8 bits, but we cannot assign this number to hosts on the network.

Out of these 256 IP addresses, we have two IP addresses related to Broadcast IP and Network ID. Consequently, out of these 256 IP addresses, we can only assign 254 IP addresses to hosts in the network.

That is, if you use the /30 subnet mask, you can only have two hosts in your network.

IP Address version 6

The main reason for producing IPv6 was that there was a limit on the number of IPs in IPv4. Of course, IPv4 had other flaws that we haven't seen in IPv6.
IP is actually the logical address used in the third layer of the alleged OSI model.

انصراف از نظر