0

My question may be very elementary and stupid but I'm having real trouble understanding what role ip addresses play when being assigned to a router interface. I think my misunderstanding may be in how layer 2 relates to layer 3.

Let's say I have R1 with SW1 connected to it. SW1 has PC1 connected to it. When we configure this R1's interface, will it need to be configured in the same subnet as PC1 with a different unique host address?

1 Answers1

0

To understand the role of the router interface address let's start from understanding how the routing works in LAN.

  1. Let's guess, what the PC is trying to connect to the ip address 9.9.9.9
  2. The PC looks up a route to this ip in the own routing table.
  3. Because the 9.9.9.9 isn't in any directly connected subnet, the PC should use a gateway (your router R1)
  4. Therefore should be some way to point to the gateway's interface in the routing table. So the ip address of interface is perfectly suitable for it.
  5. The PC knows the ip address of the gateway now. So it makes the ARP request to know the MAC address.
  6. After the MAC address resolve procedure is completed, the PC can send the IP packets to 9.9.9.9 through the gateway (the destination MAC address in the ethernet headers is the gateway's interface MAC, the destination address in the IP headers is 9.9.9.9). So, the second purpose of the router's interface is help to point to L2 address of gateway to other hosts in subnet.

So, main purpose of the router's interface address is communication to hosts within directly connected subnet: it's being used in the routing tables of hosts and it's also being used to resolve L2 address.

Note there are schemes where router doesn't have assigned ip address on the interface (unnumbered interface). To make it works can be used proxy-arp feature on the router itself or static routes on LAN hosts and ARP behavior tuning on the router.

Anton Danilov
  • 5,082
  • 2
  • 13
  • 23