ARP over routers

ARP over routers

Here, we will explain the operation of ARP when communicating with a terminal at a destination beyond a router.

See the diagram below. What is the behavior of ARP when communicating from computer A to computer F?

The IP addresses of computer A and computer F are as follows.

IP address of computer A: 192.168.1.1/24
IP address of computer E: 192.168.2.1/24

Computer A checks if it belongs to the same network as computer F.

 You can know the network to which computer A belongs by calculating the logical product of your own IP address and the subnet mask set for you.

192.168.1.1 ← IP address of computer A
AND 255.255.255.0 ← Subnet mask set in computer A
———————–
192.168.1.0

 The network to which computer F belongs can be found by calculating the logical product of computer F’s IP address and the subnet mask set to itself.

192.168.2.1 ← IP address of computer E
AND 255.255.255.0 ← Subnet mask set for computer A
———————–
192.168 2.0

Then you can see that computer A and computer F belong to different networks.

 Even if computer A sends an ARP request to computer F on its own network “192.168.1.0/24”, it knows that computer F does not exist there, so it does not send an ARP request to computer F. .

 Then we know that computer A must send the packet to the F0 interface with the IP address of “192.168.1.254” of the router, which is the default gateway.

 Check if the MAC address corresponding to “192.168.1.254” exists in your ARP table. If not, it makes an ARP request to “192.168.1.254”.

If it exists in the ARP table, the packet will be sent using the MAC address corresponding to “192.168.1.254” registered there.

The destination address when computer A communicates with computer F is as follows.

<Between Computer A → Router>

Destination MAC addressRouter’s F0 MAC address
source MAC addressMAC address of computer A
Destination IP addressComputer F’s IP address
source IP addressIP address of computer A

All communication with terminals beyond the router will be sent to the default gateway.

 A router that receives a packet refers to its routing table. A routing table is a list of which interfaces should be used to reach a destination network.

* In some cases, it is instructing which router to pass to the next router.

For example, suppose your router has a routing table like this:

destination networkoutgoing interface
192.168.1.0/24F0
192.168.2.0/24F1

The most suitable entry for the destination IP address ‘192.168.2.1’ is determined to be ‘192.168.2.0/24’.

 Then you can see that the packet should be sent from F1 to the destination “192.168.2.1”. You can also see that the network “192.168.2.0/24” to which “192.168.2.1” belongs is directly connected to the router.

In other words, you can see that packets can be delivered directly from this router without forwarding packets addressed to “192.168.2.1” to the next router.

 The router looks to see if there is “192.168.2.1” in its ARP table entry associated with F1.
If there is a MAC address corresponding to “192.168.2.1” in the list of entries, use it.

If not, the router makes an ARP request to find out the MAC address of “192.168.2.1”.

 In this way, looking up the MAC address corresponding to the destination IP address “192.168.2.1”, the router forwards the packet with the destination set as follows to computer F.

<Between router → computer F>

Destination MAC addressMAC address of computer F
source MAC addressRouter’s F1 MAC address
Destination IP addressComputer F’s IP address
source IP addressIP address of computer A

 The destination IP address and source IP address do not change after passing through a router, but the destination MAC address and source MAC address change each time the router is passed.