As it is clear from the title, why do switches need ARP tables when the translation are done on the machines side?
Roughly saying, why there are two ARP tables on machines and on switches? Is not the one on the switch sufficient?
Network Engineering Stack Exchange is a question and answer site for network engineers. It only takes a minute to sign up.Sign up to join this community
This is a pretty common misconception or more specifically, a terminology problem. In a layer two switch, there is not an ARP table, only a forwarding table. The switch records each src MAC address it sees inbound in the forwarding table, and attributes it to the port so frames with a dst MAC will only get sent to the port known for that MAC. Many people call this an "arp table" or "arp cache" even though it is neither.
In a managed layer two switch, there is a forwarding table plus an ARP table but the latter is only used for the management interface to talk to interested hosts (i.e. the PC you are using to configure the switch.) In a managed layer 3 switch there will be a forwarding table plus an ARP table, since it needs it for the management interface plus router functionality exists to perform forwarding between subnets.
Every device utilizing the IP protocol has an ARP table. Since IP is an L3 protocol and requires an underlying L2 protocol, this is a requirement for a device to be able to translate an L3 IP address to its corresponding L2 address.
Whether your device is communicating to an IP address on the local network or not, it has to send it's L2 traffic (to keep it simple, let's exclude broadcast and multicast from this discussion) to a specific device on the local L2 domain. If the IP address is on the local network, this would be direct to the destination device. If not, this would be the device functioning as the gateway or router for the local network which can forward the L3 traffic towards its destination.
If a switch isn't using the IP protocol at all (i.e. it doesn't even provide any sort of management over IP, no L3 functionality, etc), then it doesn't need an ARP table.
However, I am not aware of an enterprise switch platform that does not utilize the IP protocol. Telnet, SSH, HTTP, HTTPS, and SNMP are just a few examples of the commonly supported services of an enterprise switch that would require access to IP.
As you probably already know, the purpose of the ARP table is to translate network layer addresses into link layer addresses. i.e. IP addresses to MAC addresses.
The tables you refer to aren't quite complete. Layer 2 switches also have two kinds of tables:
an ARP table that's used to communicate with the switch "as a computer" for interfacing with its controls. Well, it will have this if it's a managed switch
a table that relates switch ports to MAC addresses
Example1: If a PC launches a packet, it will use the MAC address if the IP address is local (from the ARP table). When that packet reaches a switch, the switch will move the packet to the appropriate port based on the MAC address (from the switches port/MAC table).
Example2: If a switch launches a packet from its management interface then it does the same thing as a PC would do using its ARP table. But, if a switch launches a packet from its switching function then it is simply moving that packet from one port to another according to its port/MAC table.