TCP/IPherIP compile and addressIP subnetwork(Subnets) have a classIP addressIP Subnetting and Subnet Masking
IP分组首部中有两个极其重要的字段,就是源地址和目的地址
接口(interface): 主机/路由器与物理链路的连接
IP address: 32-bit (IPv4) number identifies the interface of the host, router ** IP address associated with each interface **
Paste_Image.png
How do I assign an IP address to an interface?
Instead of directly assigning an ip address to each host, we continue to borrow the idea of common divisions, first classifying them and then subdividing them specifically within classes, so this leads to the concept of subnets.
We divide the ip address into two parts, the high bit part, we treat as the network number, all the same, then belong to the same subnet, the status bit is divided into the host number, distinguishing between different specific host interfaces.
IP address:
Paste_Image.png
Paste_Image.png
Paste_Image.png
For further segmentation, sometimes we need more classifications, so it is also a question of how to divide the subnets further. 我们采取与之前相同的策略,将主机号的一部分比特位提出来作为子网号
IP address:
image.png
如果我们拿两个比特位作为子网号,那么就可以分出四个子网
image.png
So the question is again, how to determine whether the subnet is divided? How many bits are used to divide subnets? Answering this question requires the use of subnet masks, which is a very important concept Subnet mask Shaped like an IP address:
取值:
Subnet address + subnet mask → accurate subnet size determination
例如:
例如:
image.png
How does a router determine which subnet it should forward IP packets to? Extract the subnet address by bitwise summing the destination IP address of the IP group with the subnet mask
例如:
image.png