IP addressing of TCP/IP

There are two extremely important fields in the IP header, which are the source address and the destination address

  • Source address (SA) – where does it come from?
  • Destination address (DA) – where to?

Interface (Interface): connection between host / router and physical link

  • Network layer function
  • Routers usually have multiple interfaces
  • The host usually has only one or two interfaces (e.g., wired Ethernet interface, wireless 802.11 interface)

IP address: 32 bit (IPv4) number identifies the host, the router’s interface, and the
IP address is associated with each interface

IP addressing of TCP/IP
Paste_Image.png

How do I assign an IP address to the interface?

We do not assign IP addresses directly to each host, but instead we draw on the usual idea of partitioning, first classifying, and then subdividing in the class, which leads to the concept of subnet.

IP subnet (Subnets)

  • IP address the device interface with the same network number
  • An interface that can be physically communicated with one another without crossing routers (third and above network devices)

We divide the IP address into two parts, the high bit part, we regard the network number as the same, which means that we belong to the same subnet, the status bits are divided into host numbers, and different specific host interfaces are distinguished.

IP address:

  • Network number (NetID) – high bit
  • Host number (HostID) – low bit
IP addressing of TCP/IP
Paste_Image.png

Class IP address

IP addressing of TCP/IP
Paste_Image.png
IP addressing of TCP/IP
Paste_Image.png

IP subnet partition and subnet mask

In order to further subdivide, sometimes we need more classification, so it is also a problem how to further classify the sub networks.
we take the same strategy as before, and we put a part of the host number bit as the subnet number

IP address:

  • Network number (NetID) – high bit
  • Subnet number (SubID) – primary network host number, part bit
  • Host number (HostID) – low bit
IP addressing of TCP/IP
image.png

If we take two bits as the subnet number, we can divide the four subnets

IP addressing of TCP/IP
image.png

So, here comes the question, how do you decide if the subnet is divided? How many bits are used to partition the subnet?
answers this problem by using subnet mask, which is a very important concept,
subnet mask
, such as IP address:

  • 32
  • Dotted decimal form

Value:

  • The NetID and SubID bits are all taken from 1
  • HostID bits all take 0

Subnet address + subnet mask > accurately determine subnet size

Such as:

  • The default subnet mask for the A network is: 255.0.0.0
  • The default subnet mask for the B network is: 255.255.0.0
  • C the default subnet mask: 255.255.255.0
  • The subnet mask of the B network that uses 3 bit subnet division is 255.255.224.0

Such as:

  • Subnet 201.2.3.0255.255.255.0, divided into 4 subnets of equal length
    , uses two bits:
IP addressing of TCP/IP
image.png

How does the router determine which subnet should be forwarded to the IP packet?
extracts the subnet address from the destination, IP address, subnet mask, bitwise, and operation of the IP packet

Such as:

  • Destination IP address: 172.32.1.112, subnet mask: 255.255.254.0
IP addressing of TCP/IP
image.png
  • Subnet address: 172.32.0.0 (subnet mask: 255.255.254.0)
  • Address range: 172.32.0.0~172.32.1.255
  • Distributable address range: 172.32.0.1~172.32.1.254
  • Broadcast address: 172.32.1.255