📜 ⬆️ ⬇️

36 stages of the routing process

It would seem that it can be difficult to work with a simple ping utility. However, each time, discovering
that the Internet for some reason does not work, we often use a proven method - we ping some resource, like this:
ping mit.edu

What is happening at this moment? This post describes the process that occurs when you try to ping a node located on another network behind the router / routers.

image

Connection diagram:
PC â„–1 Host_A (172.16.10.2/24) -> port E0 (172.16.10.1) of the router Lab_A (2600 Router)
PC â„–2 Host_B (172.16.20.2/24) -> port E1 (172.16.20.1) of the Lab_A router (2600 Router)

In this example, the user on Host_A using the ping utility checks for availability
The IP address of the Host_B computer.
')
1. On PC # 1, the ICMP protocol creates an echo request (an alphabet in the data field of the packet).
2. ICMP sends the request to the IP protocol that creates the packet. Minimally, the package contains information:
- source IP address
- Recipient's IP address
- protocol field 0x01
All this information tells the recipient where he should send a response in case of a successful request.
in this example, ICMP.
3. When a packet is created, the IP determines whether the host with the specified IP address is on the local network,
or in the remote.
4. Having determined that the address is in a remote network, the packet should be sent to the default gateway,
so he can reach the remote network.
The registry of the configured default gateway is searched.
5. The default gateway for Host_A (172.16.10.2) is listed as 172.16.10.1.
In order for the packet to be sent to the default gateway, the hardware address of the corresponding port of the router (Eth0 = 172.16.10.1) must be known.
What for? So that the packet could be transmitted further, to the link layer, embedded in a frame,
and then sent to the router interface connected to the 172.16.10.0 network.
For the reason that computers on a local network communicate only by hardware addresses,
it is necessary to establish that for Host_A to interact with Host_B, the first must send packets
by MAC address of the default gateway for your local network.
MAC addresses are always used locally on the network and NEVER transmitted through the router.
6. The next step, the host's ARP cache is checked to see if a connection has already been established between the IP address and the MAC address of the default gateway. If a match is found, the packet can be passed on to the channel layer for packing into a frame.
(the hardware destination address is also transmitted along with the packet).
To view the ARP cache, use the command: C:\>arp -a
If the hardware address is not in the ARP cache, the broadcast ARP request is performed on the local network to find the hardware address for 172.16.10.1.
The router responds to the request and reports the MAC address of its port E0.
Then PC # 1 saves this address in its ARP cache.
7. When the hardware source and destination addresses are delivered to the link layer, the LAN driver is used to provide access to the data transfer medium used in a particular technology.
(in the example, Ethernet).
A frame is then generated, encapsulating the packet, including control information.
The frame contains: both hardware addresses, plus in this example an Ether-Type field,
which describes the network layer protocol that transmitted the packet to the data link layer — in our case, IP.
The end of the frame contains the FCS (Frame Check Sequence) field,
which contains the CRC code. Below is the frame structure.

image

Note! The frame does not contain the MAC address of Host_B.
8. After the frame is generated, it will be sent further, to the physical layer, for sending over a data transmission channel, for example, over a twisted pair, sequentially, bit by bit.
9. Each device in the collision domain receives bits, restores the frame.
It then checks the CRC, compares the response with the FCS field. If the answer does not match, the frame is discarded.
If everything is in order, then the hardware destination address is checked (in our example, the E0 port of the router).
If it matches, then the Ether-Type field is checked to determine the network layer protocol.
10. The packet is retrieved from the frame, what is left of the frame is discarded. The packet is transmitted to the protocol specified in the Ether-Type- field, in our case IP.
11. IP receives the packet and verifies the IP address of the recipient. Since the recipient's IP address does not match any of the IP addresses configured on the router's interfaces, the router searches for the IP address
destination network in its routing table.
12. The routing table must have an entry for the network 172.16.20.0, otherwise the packet will be immediately discarded, and the ICMP message " Destination network unreachable " will be sent to the device.
the sender of the request.
13. If the corresponding entry is found in the routing table, the packet is redirected to the output interface (E1).
No routing protocols are required, since both networks are directly connected.
To view the table
route, enter the command show ip route in the command line of the router
14. The router forwards the packet to the E1 port buffer.
15. The E1 port buffer must know the hardware MAC address of PC network card No. 2 (Host_B) and first checks the ARP cache. If the MAC address is known, and is contained in the ARP cache, then the packet and the hardware address are transmitted to the link layer for packing into a frame. To view the ARP cache, use the show ip arp command.
If the hardware address is not in the ARP cache, the broadcast ARP request is performed on the local network to find the hardware address for 172.16.20.2. Host_B responds to the request and reports its MAC address. The router then stores this address in its ARP cache, and the packet with the address is transmitted to the link layer for packing into a frame.
16. At the data link layer, a frame is created with the source (E1) and receiver hardware addresses, the Ether-Type field and the FCS field.
After the frame is generated, it will be sent further, to the physical layer, for sending over the data transmission channel, for example over a twisted pair, sequentially, bit by bit.
17. Host_B receives the frame, starts the CRC. If the result matches the FCS, the MAC address of the recipient is checked. If the verification is successful, the Ether-Type field is examined to determine the network layer protocol to which the packet is intended, in our case, IP.
18. At the network level: IP receives a packet and verifies the recipient's IP address. If a match is found, scans the Protocol field to determine the protocol of the request recipient.
19. The request is redirected by ICMP, ICMP “understands” that this is an echo request, and responds to it immediately, discarding the packet and generating an echo response.
20. A packet is generated that includes the source and destination addresses, the Protocol field and the information part. The recipient is now Host_A.
21. When a packet is created, the IP determines whether the host with the specified IP address is on the local network, or on the remote one. Having determined that the address is on a remote network, the packet must be sent to the default gateway so that it can reach the remote network.
22. The IP address of the default gateway is taken from the OS database, then the ARP cache is scanned for a match between the IP address and the hardware address.
23. When the hardware default gateway address is found, the source and destination hardware addresses (E1) are transmitted along with the packet to the data link layer for packing into a frame.
24. At the data link layer, a frame is formed with the following information in the header: source and destination MAC addresses, Ether-Type field (0x0800 (IP)), FCS field with CRC result.
25. After the frame is generated, it will be sent further, to the physical layer, for sending over a data transmission channel, for example, over a twisted pair, sequentially, bit by bit.
26. Information, sequentially, bit by bit, goes to the E1 interface of the router. Then the frame is restored. CRC starts, the result is compared with the FCS field.
27. In case of a successful CRC check, the hardware address of the receiver is checked. If there is a match, the packet is extracted from the frame, the Ether-Type field is scanned to determine which network layer protocol the packet was intended for.
28. Package is for IP. IP checks the header for errors, then looks up the recipient's IP address.
29. In our case, the router “knows” the path to the 172.16.10.0 network — the E0 interface, so the packet is redirected to E0.
30. The router scans the ARP cache for the hardware address for 172.16.10.2.
31. The hardware address is already known, it was found out at the time of sending the request via a direct channel, thus the hardware addresses and the packet are transmitted to the data link layer.
32. At the data link layer, a frame is generated with the source and destination hardware addresses, IP in the Ether-Type field and the result of CRC in FCS.
33. After the frame is generated, it will be sent further, to the physical layer, for sending over a data transmission channel, for example, over a twisted pair, sequentially, bit by bit.
34. PC # 1 receives a frame, starts the CRC, checks the receiver's hardware address, and looks at the Ether-Type field to determine the packet's recipient protocol.
35. Receiver - IP. IP checks the Protocol field, finds the instruction- transmit the ICMP informational message, he, in turn, determines that this is the answer to the echo request (echo reply).
36. ICMP signals a response by sending a mark ! in the console.
Then ICMP generates 4 more requests.
With each new router in the path of the packet, the steps are repeated, the logic remains the same.

Material taken from the tutorial for preparing for the CCNA exam
Thanks for attention.

Source: https://habr.com/ru/post/83047/


All Articles