directory

Tasks and services at the network layer

1. Packet forwarding

2. Route selection

2. Principle of ARP

1. The destination physical address is in the ARP Cache

2. The destination physical address is not in the ARP cache

3. Four typical cases of ARP

Tasks and services at the network layer

Computer network learning has reached the network layer part, from the physical layer, data link layer, gradually close to the upper layer of the five-layer protocol structure.

The network layer is the upper layer of the data link layer. Its work task and core function are altogether two: packet forwarding and routing.

1. Packet forwarding

The main task of the network layer is to transfer packets from the source host to the destination host, and the core device is nothing more than the router. The router maintains a forwarding table. When forwarding packets, the router queries the forwarding table according to the header identifier of packet data and forwards the packets to the destination address.

2. Route selection

When packets are sent from the sender to the receiver, the network layer decides which path these packets will take. This is called Routing. The result of routing is to generate a forwarding table.

The route selection modes include centralized and distributed. Distributed automatic routing requires running routing protocol on routers to exchange routing information and calculate routes. In fact, this process directly generates a routing table, which is regenerated into a forwarding table.

At the network layer, connection-oriented and connectionless services are provided.

The connection-oriented network becomes the virtual circuit network. A connectionless network becomes a datagram network.

  • Characteristics of virtual circuit networks
  1. Reliable communication is guaranteed by the network;
  2. The endpoint address is used only in the connection establishment phase, and each group uses a short virtual circuit number.
  3. Packets belonging to the same virtual circuit are forwarded by the same route and reach the destination in the sequence of sending packets.
  4. All virtual circuits that pass through the failed node cannot work;
  5. Easy to implement, communication resources can be allocated to each virtual circuit in advance.
  • Characteristics of datagram networks
  1. Reliable communication is guaranteed by users;
  2. Each group has a complete end address, the end may not be in order;
  3. Each group independently selects routes for forwarding.
  4. A node with a fault may lose its grouping and the route may change.
  5. Difficult to implement.

2. Principle of ARP

Important protocols in the network layer: IP protocol, is one of the most important protocols in the TCP/IP system.

IP supports four protocols: ADDRESS resolution Protocol (ARP), Reverse Address resolution Protocol (RARP), Internet Control Message Protocol (ICMP), and Internet Group Management Protocol (IGMP).



ARP and RARP solve the problem of obtaining the corresponding physical address when the target IP address is known. The sum inverse process, given the physical address of the target, needs to obtain the corresponding IP address.

RARP is not used independently. DHCP already provides the RARP function.

Here I mainly record the ARP working process.

ARP can be used to solve the dynamic mapping between IP address and physical address in the LAN that supports broadcast. Method: Each host has an ARP cache, which stores an IP – physical address mapping table, and dynamically updates it.

The working process of ARP is summarized as follows:

1. The destination physical address is in the ARP Cache

When host A wants to send an IP packet to host B on the same LAN, host A queries its ARP Cache and finds the IP address and physical address mapping entries of HOST B. Therefore, host A writes the MAC address into A MAC frame and sends the MAC address to host B’s physical address over the LAN.

2. The destination physical address is not in the ARP cache

(1) In the first step, the ARP process of host A sends A broadcast ARP request packet within the LAN, which is encapsulated in the broadcast frame of the data link layer. The main content is: my IP address is 10.1.1.1, MAC address 00-00-25-AB-ee-9C, I want to know the MAC address 10.1.1.2.

(2) In the second step, all ARP processes on hosts in the LAN will receive the ARP request packet.

(3) In the third step, host B finds that the IP address in the ARP request packet matches its own IP address. Host B immediately sends A response packet to host A and writes its OWN MAC address. The main content is as follows: My IP address is 10.1.1.2 and MAC address is 00-ed-00-AB-24-9C. In this case, the response group is data link layer unicast, because only the source address is sent to the target address A host.

(4) Finally, host A receives host B’s ARP response packet and writes THE IP-MAC address mapping of HOST B into its OWN ARP cache.

In this process, host A obtains the MAC address of host B. Of course, host B writes the IP address -MAC address of host A to its Cache, facilitating future communication without sending ARP broadcasts and reducing network traffic.

It can be found that the premise is data transmission between hosts in the same LAN. In A non-LAN, the broadcast sent by host A cannot be received by host B. Therefore, the router needs to forward the request from host A before continuing the ARP process.

3. Four typical cases of ARP

  1. The sender is a host, and the IP packet needs to be sent to another host on the network. In this case, ARP is used to find the destination physical address.
  2. The sender is the host, and the IP datagram is sent to a host on another LAN. ARP first finds a router on the LAN, and the router does the rest of the work.
  3. The sender is a router, and the IP packet needs to be sent to another host on the local network. In this case, ARP is used to find the destination physical address.
  4. The sender is a router, and the IP datagram is sent to a host on another LAN. ARP first finds another router on the LAN, and the router does the rest of the work.

In this way, through multiple use of ARP, the whole network communication.

ARP produce certainly has its advantages, the world there are a lot of different network, they use different forms of physical address, the heterogeneous network to communicate with each other, the IP address of the unified format, plus the ARP address resolution protocol to solve the problem, and the implementation process of ARP is computer software automatically, the user has not perceived.

In fact, there are many contents in the network layer, such as IP datagram and ICMP protocol. In order to ensure the proper length and quality of the blog, I will record the learning content of the network layer in the next step.

If you feel good welcome “one key three even” oh, like collection attention, have a problem direct comment, exchange learning!

Progress together!

In this paper, starting my CSDN blog: csdn-czh.blog.csdn.net/article/det…