"Computer Networking - Top-Down Approach" Reading Notes - Network Layer (IP, ICMP, DHCP, RIP, OSPF, etc.)

1. Overview of the network layer

    The main functions of the network layer are forwarding (transferring data from the router input interface to the appropriate output interface) and routing (end-to-end path selection).

    The network layer of the Internet provides unreliable services, mainly including IP protocol, routing protocol (RIP, OSPF, BGP), control message protocol (ICMP) and so on.


2. IP protocol

    The IPV4 packet header is divided into a fixed part of 20 bytes and a variable part (the maximum variable part is 40 bytes).

    

    Service type: distinguish special requirements such as low latency, high throughput, and reliability

    Identifier, Flag, Fragment Offset: Used for IP fragmentation. The identifier uniquely identifies each datagram sent by the host; the flag indicates whether it is fragmented and whether it is the last fragment; the fragment offset indicates the offset of the fragment in the original data packet

    Lifespan TTL: The number of hops of the router, when it is 0, the datagram is discarded

    The IP protocol requires each host and router interface to have its own IP address, using Classless Inter-Domain Routing (CIDR): abcd/x, ABC class networks are /8, /16, /24, 0.0.0.0 is Use when you don't know your own IP address, 255.255.255.255 is the broadcast address

    

    The IPV6 header is fixed at 40 bytes , and there is no checksum (error checking at the transport layer and link layer) and fragmentation fields. IPV6 does not allow fragmentation and reassembly on intermediate routers. If the packet is too large, the router will drop the datagram and return an ICMPV6 packet with a "packet too large". If the IPV6 datagram is to pass through the IPV4 router, it must be encapsulated in the IPV4 datagram.

    

    Traffic class: IPV4-like traffic type, identifying the priority of datagrams

    Flow labels: mark those datagrams that require special handling

    The next header: the upper layer protocol


3、DHCP

    Dynamic Host Configuration Protocol, which connects a host to a network and assigns it an IP address. is a LAN network protocol that uses UDP .

    

    A DHCP client may send a Discover message to multiple DHCP servers, and the client selects an IP address from multiple responses received and sends a Request message to the server.


4、NAT

    Network Address Translation Protocol. NAT can make the router look like a device with a single IP address to the outside world. There is a NAT translation table on the router, which records the port numbers and IP addresses of the WAN side and the LAN side. When the datagram arrives from the WAN side, it is forwarded to the host on the LAN side according to the port number. .

    Using the port number can alleviate the problem of insufficient subnet IP addresses, but it is not appropriate to use the port number at the network layer.


5、ICMP

    Internet Control Message Protocol, used by the host and the network layer to communicate network information, as the payload of IP

    


6. Routing algorithm

    LS algorithm (global type), that is, link state algorithm. Global information is obtained by broadcasting, using Dijkstra's algorithm (O(n2)).

    DV algorithm (distributed), i.e. distance vector algorithm, for each node x, maintain (1) the cost to each neighbor c(x, v) (2) the distance vector of node x Dx = [Dx(y), y ∈ N], containing the cost estimates from x to all destinations y in N (3) The distance vector Dv of neighbor v.

    Then you can use Dx(y) = MINv{ c(x, v) +  Dv(y) } to update the distance from x to each point y, where v is all neighbor nodes, and y is all nodes in the network.

    The DV algorithm has slow convergence, and will encounter problems such as selection loops and infinite counts (if the cost of a certain path suddenly increases significantly, the route will oscillate); the LS algorithm is more robust because it maintains global information.


7. Hierarchical routing

    AS: Autonomous system, consisting of a group of routers, usually under the same administrative control, running the same routing algorithm, with gateway routers (and routers connected to other ASs) forwarding packets to destinations outside the AS.

    Each router receives information about routing protocols within the AS and routing protocols between ASs, and configures its own forwarding table.

    A router within an AS only needs to know the routers within the AS, and the routing between ASs is solved by the gateway router.

    The interior gateway protocol includes (1) RIP (Routing Information Protocol), which uses the DV algorithm (the cost is determined according to the number of router hops, which is equivalent to an unweighted graph), and the routers use port 520 on UDP to send RIP request and response packets to each other and encapsulate them. The transmission of UDP segments in IP datagrams is implemented as an application layer process.

    (2) OSPF, Open Shortest Path First, uses the LS algorithm.

    BGP is Border Gateway Protocol. The minimum spanning tree algorithm can be used to prevent broadcast flooding.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326947808&siteId=291194637