1

Let's say we have the following configuration.

WAN - Router -------------------- Switch --------- Client
                       |                     |
   Multiple switches connected to router     |
                                   Multiple Clients connected to each switch

When the router receives a packet, then the router would have to lookup its ARP table to find the appropriate MAC that corresponds to the IP address to create the frame to send off to the switch.

However, let's assume among the many switches there is a switch, let's call it S1, that is only connected to clients with IPs in range 123.123.123.0/24. This would mean that we can set up a routing rule at the router to route all traffic in range of 123.123.123.0/24 to be sent to the interface that leads to S1.

We can see that when routing, the router wouldn't need a routing table of every client. However, the ARP table would need a table of every client. That seems very inefficient to me. Is this really how it works? Wouldn't it make more sense for the Switch to be able to have its own ARP table so that you only need to look up a subset of clients?

To me, it would make more sense for the router here not to build a frame and send the packet that lacks L2 info to the switch, and then the switch builds a frame if the frame is incomplete. I know that switches operating in L2 does not want to look at the IP addresses, but I don't understand why it's designed that way.

1 Answer 1

0

It's not particularly inefficient, as long as the clients all fit in each switch's MAC table – the CAM "content-addressed memory" is pretty good at finding the MAC table entry efficiently.

Wouldn't it make more sense for the Switch to be able to have its own ARP table so that you only need to look up a subset of clients?

Then it would be a router, literally. What you suggest is often done, just with actual IP routing – the first router directs the packet to the MAC address of the second, knowing that the /24 is there.

Your example is inefficient because you designed it that way. A network isn't inherently limited to one router, and a router isn't limited to one internal network, so you don't have to have one huge subnet if you can avoid it – you can have the /24 as a completely separate subnet behind its own router if you want, or a VLAN managed by the same router but separated at L2 using 802.1Q tags.

(Where a "home" router has one LAN interface going into an integrated switch, enterprise routers have many independent interfaces to route between.)

On the other hand, when you really need efficiency, there's a third way to forward packets: label switching, such as MPLS. It allows an ingress router to pre-select the L2 path through a network, with the interior routers/switches only doing lookups in small label tables.

10
  • It's 6am so this is going to look a bit incoherent when I wake up Feb 17, 2023 at 4:36
  • Thank you for the answer. "Then it would be a router, literally. What you suggest is often done, just with actual IP routing – the first router directs the packet to the MAC address of the second, knowing that the /24 is there." Right, but to me that means I should put a router in front of every switch, which still makes me question why switches are designed as they are. It seems like L3 switches that also have its own IP and MAC addresses (I know not all of them do) are just strictly better than L2 switches other than cost. Feb 17, 2023 at 5:58
  • When you say "as long as the clients all fit in each switch's MAC table", does this mean the ARP table in the router is somehow communicating with a switch's MAC table? Feb 17, 2023 at 6:09
  • "It seems like L3 switches that also have its own IP and MAC addresses (I know not all of them do)" Actually it seems like L3 switches that don't have its own IP and MAC addresses are only like that if you configure it not to do L3 routing Feb 17, 2023 at 7:57
  • 1
    "L3 switches" are routers, so they do have their own IP address and MAC address. (Specifically, they have configurable hardware that can either perform L2 switching or L3 routing. They don't use their MAC address for switched ports but they do for routing.) No, the two tables don't communicate at all, they just both get populated in somewhat similar ways (automatic learning). Feb 17, 2023 at 14:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .