Just like regular hosts, if a Cisco router wants to exchange frames with a host in the same subnet, it needs to know its MAC address. The IP-to-MAC address mapping are kept in the router’s ARP table. Consider the following example:
R1 has two connected subnets – 10.0.0.0/24 and 172.16.0.0./16. Before exchanging frames with either host, R1 will need to know their MAC addresses. Here is the output of the R1’s ARP table:
R1#show ip arp Protocol Address Age (min) Hardware Addr Type Interface Internet 10.0.0.1 - 0060.5C32.7E01 ARPA GigabitEthernet0/0 Internet 10.0.0.10 6 000C.85CA.AD73 ARPA GigabitEthernet0/0 Internet 172.16.0.1 - 0060.5C32.7E02 ARPA GigabitEthernet0/1 Internet 172.16.0.2 10 0001.63DB.1802 ARPA GigabitEthernet0/1
The ARP table contains two entries for R1’s own two interfaces with the IP address of 10.0.0.1 and 172.16.0.1. The – in the age column indicates that the entry will never be timed out.
The ARP table also lists the MAC addresses of the two connected hosts. Consider the entry for Host A:
Protocol Address Age (min) Hardware Addr Type Interface Internet 10.0.0.10 6 000C.85CA.AD73 ARPA GigabitEthernet0/0
Here is a brief description of each field:
- Protocol – the protocol type, almost always Internet
- Address – the IP address associated with the MAC address, in our case the IP address of Host A
- Age – by default, an entry will be removed from the ARP table if it wasn’t used in 240 minutes. 6 in this column means that the entry was last used 6 minutes ago. Each time an entry is used, the age will be reset back to zero.
- Hardware – the MAC address of the host with the corresponding IP address.
- Type – the type of hardware address. For Ethernet, this value will always be ARPA.
- Interface – the interface on R1 on which the corresponding host is connected.
Here are the steps R1 needs to take before forwarding frames to Host A:
- R1 wants to communicate with Host A. R1 checks its routing table. The subnet on which Host A resides is a directly connected subnet.
- R1 checks its ARP table to find out whether the Host A’s MAC address is known. If it is not, R1 will send an ARP request to the broadcast MAC address of FF:FF:FF:FF:FF:FF.
- Host A receives the frame and sends its MAC address to R1 (ARP reply). The host also updates its own ARP table with the MAC address of the Gigabit0/0 interface on R1.
- R1 receives the reply and updates the ARP table with the MAC address of Host A.
- Since both hosts now know each other MAC addresses, the communication can occur.