Computer Network (7th Edition) Chapter 4 (Network Layer) Knowledge Points Collection

computer network

参考书目:《计算机网络(第7版)》:谢希仁——电子工业出版社 《精通Windows Sockets网络开发--基于Visual C++实现》:孙海民——人民邮电出版社



1. Classified Addressing IP Address

IP address

An IP address
       is a globally unique 32-bit identifier assigned to each interface of each host (or router) connected to the Internet.

Network Interface

  • A router has multiple interfaces
  • The host may have one or multiple interfaces
  • The IP address is only related to the network interface of the device

IP address addressing

  • Classified IP address
  • Subnetting
  • form a supernet

1. Classified IP addresses

       The two-level IP address is recorded as: IP address::= { <network number>, <host number>}

  • Network number net-id: identifies the network to which the host/router is connected
  • Host number host-id: identifies the host/router

Note: IP addresses are unique across the Internet

The network number field and the host number field in the IP address
Insert image description here

注:1.A类地址的网络号字段 net-id 为 1 字节,A类地址的主机号字段 host-id 为 3 字节
    2.B类地址的网络号字段 net-id 为 2 字节,B类地址的主机号字段 host-id 为 2 字节
    3.C类地址的网络号字段 net-id 为 3 字节,C类地址的主机号字段 host-id 为 1 字节
    4.D类地址是多播地址
    5.E类地址保留为今后使用

IP address usage range
Insert image description here

Special IP address in dotted decimal notation
Insert image description here
(cannot be assigned to users)
1. Loopback address/loopback address

  • IP addresses starting with 127 - reserved addresses
  • Used for testing network software and communication between local processes.
  • Once any program receives data that uses the loopback address as the destination address, it will no longer forward the data, but will immediately send it back to the source address.
  • Use "ping 127.0.0.1" to test the communication between local network card processes through ping software.

2. Direct broadcast address

  • An IP whose host number is all “1”
  • Mainly used for broadcasting. When used, it is used to represent all hosts on the network.
  • For example, 202.112.144 is a Class C network identifier, and the broadcast address of the network is 202.112.144.255; when a host in the network needs to send a broadcast, it can use this address to send messages to all hosts on the network. .

3. Limited broadcast address

  • An IP address with all 32 bits set to "1" (255.255.255.255) is a "limited broadcast address".
  • Mainly used for broadcasting on this network . When you need to broadcast within this network and do not know the network number of this network, you can use the "limited (restricted) broadcast address".

4.This website address

  • The IP address in which the host address bits in the IP address are all "0".
  • Used to represent "the network to which this host is connected".
  • For example, use "128.16.0.0" to represent the Class B network "128.16".
  • This network address is also called the "0" address.

Reserved IP address
Insert image description here

Public IP
       can be used throughout the wide area network (Internet) and can be accessed by networked hosts around the world.
Private IP
       can only be used in a LAN, and its scope is a LAN (it will be invalid outside the LAN). Therefore, the IP addresses of hosts in different LANs can be the same.

注:在A、B、C  3类地址中各有一段地址作为保留地址不在全网分配,而作为私有地址只可在一个网络内部使用,不可进入外网。
私有地址范围:
    1个A类地址:10.0.0.0
    16个B类地址: 172.16.0.0 ~ 172.31.0.0
    256个C类地址: 192.168.0.0 ~ 192.168.255.0    

2.Important characteristics of IP addresses

hierarchical address structure

  • The IP address management agency only allocates the network number when allocating the IP address, and the remaining host number is allocated by the unit that obtains the network number.
  • The router only forwards packets based on the network number to which the destination host is connected (without considering the destination host number), which greatly reduces the number of items in the routing table, thereby reducing the storage space occupied by the routing table.

IP address flag

  • When a host is connected to two networks at the same time, the host must have two corresponding IP addresses at the same time, and its network number net-id must be different. This type of host is called a multi-homed host.

  • The router should have at least two different IP addresses.

    注:1.在同一个局域网上的主机或路由器的IP 地址中的网络号必须是一样的。
        2.路由器总是具有两个或两个以上的 IP 地址。路由器的每一个接口都有一个不同网络号的 IP 地址。 
        3.两个路由器直接相连的接口处,可指明也可不指明 IP 地址。
    

2. Subnet division

In the early days of ARPANET, the design of IP addresses was not reasonable enough.

  • IP address space utilization is sometimes very low.
  • Assigning a network number to each physical network can make routing tables too large and degrade network performance.
    • Increased router cost
    • It takes more time to find routes
    • Increased routing information exchanged between routers
  • Two levels of IP addresses are not flexible enough
    • Unable to make full use of the applied address resources to expand new networks

1. Third-level IP address

       The third-level IP address is recorded as: IP address::= {<network number>, <subnet number>, <host number>}

example:Insert image description here

注:从主机号借用若干个位作为子网号 subnet-id,而主机号 host-id 也就相应减少了若干个位。划分子网纯属一个单位内部的事情。单位对外仍然表现为没有划分子网的网络。把 IP 地址的主机号 host-id 这部分进行再划分,而不改变 IP 地址原来的网络号 net-id。

After being divided into three subnets, it is still one network to the outside world.
Insert image description here

2. Subnet mask

The role of subnet mask

  • Enable computers within the network to understand the structure of subnetting
  • Enable edge routers to understand the structure of subnetting.
    The format of the subnet mask.
  • The subnet mask is also a 32-bit long binary number, consisting of a series of continuous 1s followed by a series of continuous 0s;
  • The first 1 corresponds to the network number and subnet number, and the following 0 corresponds to the host number. As in the previous example:
    • The subnet structure is: 10011100 00001100 ss xxxxxx xxxxxxxx
    • The subnet mask is: 11111111 11111111 11 xxxxxx xxxxxxxx
      written in decimal is: 255.255.192.0

Default subnet mask
Insert image description here

Network address=(IP address) AND (subnet mask)
Insert image description here

  • The subnet mask is an important attribute of a network or a subnet.
  • When exchanging routing information with neighboring routers, a router must tell the neighboring routers the subnet mask of its own network (or subnet).
  • For each item in the router's routing table, in addition to the destination network address, the subnet mask of the network must also be given.
  • If a router is connected to two subnets, it has two network addresses and two subnet masks.

3.Gateway

       A gateway is an IP address that connects a network to other network nodes. If the host in network A finds that the destination host of the data packet is not in the local network, it forwards the data packet to its own gateway, and then the gateway forwards it to the gateway of network B. , the gateway of network B then forwards it to a host of network B. vice versa. Therefore, a computer's default gateway must be specified correctly, otherwise data packets cannot be sent to the gateway computer and cannot communicate with computers on other networks.Insert image description here

Set default gateway

  • manual setting
    • It is suitable for situations where the number of computers is relatively small and the TCP/IP parameters are basically unchanged.
    • The default gateway must be the IP address in the network segment where the computer is located, and IP addresses in other network segments cannot be filled in.
  • auto configuration
    • Use the DHCP server to automatically assign IP addresses, subnet masks, and default gateways to computers on the network.
    • This method is suitable for networks with large network scale and possible changes in TCP/IP parameters.
    • The advantage of this is that once the default gateway of the network changes, as long as the default gateway settings in the DHCP server are changed, all computers in the network will obtain the IP address of the new default gateway.

4.Router

router

  • A specialized computer with multiple input ports and multiple output ports.
  • The task is to forward packets.
  • The packet received by an input port of the router is forwarded from a suitable output port of the router to the next-hop router according to the destination of the packet (i.e., the destination network).
  • The next-hop router also processes the packet in this way until the packet reaches the end point.

Router structure
Insert image description here

Forward

  • The router forwards the user's IP datagram out of the appropriate port according to the forwarding table.
  • Only one router is involved.

Routing

  • According to the distributed algorithm, the selected route is dynamically changed based on changes in network topology obtained from adjacent routers.
  • Multiple routers are involved.
    Insert image description here

input port

  • After the data link layer strips off the header and trailer of the frame, it sends the packet to the queue of the network layer to wait for processing.
    • produce a certain delay
    • Duplicate forwarding table in each input port - decentralized switching function
      Insert image description here

Output port

  • When the packet is transmitted from the switching fabric, it is buffered first. The data link layer processing module adds the header and tail of the link layer to the packet, passes it to the physical layer, and then sends it to the external line.
    Insert image description here

packet discard

  • If the rate at which the router processes packets cannot keep up with the rate at which packets enter the queue, the queue's storage space will eventually be reduced to zero, which will cause subsequent packets that enter the queue to be discarded because there is no storage space.
  • Overflow of input or output queues in routers is an important cause of packet loss.

switching fabric
Insert image description here

Guess you like

Origin blog.csdn.net/weixin_43312470/article/details/127303080