Address resolution protocol (ARP) is used
to map IP addresses to the corresponding MAC addresses so that packets can be
delivered to their destinations correctly.
After a packet is forwarded to the
destination network, MAC address is necessary for the packet to reach the very
device. So the destination IP address carried in a packet need to be translated
into the corresponding MAC address.
ARP packets are classified as ARP request
packets and ARP reply packets. Figure 1-1 illustrates the structure of these two types of ARP packets.
l
As for an ARP request packet, all the fields
except the hardware address of the receiver field are set. The hardware address
of the receiver is what the sender request for.
l
As for an ARP reply packets, all the fields are
set.

Figure 1-1
Structure of an ARP request/reply packet
Table 1-1 describes the fields of an ARP packet.
Table 1-1 Description on the fields of an ARP packet
|
Field
|
Description
|
|
Hardware
Type
|
Identifies
the type of the hardware interface. Refer to Table
1-2 for the information about the field values.
|
|
Protocol type
|
Identifies the type of the protocol used
by the sending device. Normally, the field takes the value of 1 in TCP/IP networks,
which stands for EtherType.
|
|
Length of the hardware address
|
Hardware address length (in bytes)
|
|
Length of protocol address
|
Protocol address length (in bytes)
|
|
Operator
|
Indicates the type of a data packets,
which can be:
l
1: ARP request packets
l
2: ARP reply packets
l
3: RARP request packets
l
4: RARP reply packets
|
|
Hardware address of the sender
|
Hardware address of the sender
|
|
IP address of the sender
|
IP address of the sender
|
|
Hardware address of the receiver
|
l
For an ARP request packet, this field is null.
l
For an ARP reply packet, this field carries the
hardware address of the receiver.
|
|
IP address of the receiver
|
IP address of the receiver
|
Table 1-2 Description on the values of the hardware type field
|
Value
|
Description
|
|
1
|
Ethernet
|
|
2
|
Experimental Ethernet
|
|
3
|
X.25
|
|
4
|
Proteon ProNET (Token Ring)
|
|
5
|
Chaos
|
|
6
|
IEEE802.X
|
|
7
|
ARC network
|
In an Ethernet, the MAC addresses of two
hosts must be available for the two hosts to communicate with each other. Each
host in an Ethernet maintains an ARP mapping table, where the latest used IP
address-to-MAC address mapping entries are stored. Note that this manual only
introduces the basic implementation of the mapping table. Different products of
different manufactures may provide more information about the mapping table. S3100-52P
Ethernet switches provide the display arp command to display the
information about ARP mapping entries. Figure 1-2 shows the structure of an ARP mapping table.

Figure 1-2
An ARP mapping table
Table 1-3 describes the APR mapping table fields.
Table 1-3 Description on the fields of an ARP table
|
Field
|
Description
|
|
IF index
|
Index of the physical interface/port on
the device owning the physical address and IP address contained in the entry
|
|
Physical address
|
Physical address of the device, that is, the
MAC address
|
|
IP address
|
IP address of the device
|
|
Type
|
Entry type, which can be:
l
1: An entry falling out of the following three
cases
l
2: Invalid entry
l
3: Dynamic entry
l
4: Static entry
|
The ARP mapping table of a host is empty
when the host is just started up. And when a dynamic ARP mapping entry is not
in use for a specified period of time, it is removed from the ARP mapping table
so as to save the memory space and shorten the interval for the switch to look
up entries in the ARP mapping table. For details, refer to Figure 1-3.
l
Suppose there are two hosts on the same network
segment: Host A and Host B. The IP address of Host A is IP_A and that of Host B
is IP_B. To send a packet to Host B, Host A checks its own ARP mapping table
first to see if the ARP entry corresponding to IP_B exists. If yes, Host A
encapsulates the IP packet into a frame with the MAC address of Host B inserted
to it and sends it to Host B.
l
If the corresponding MAC address is not found in
the ARP mapping table, Host A adds the packet in the transmission queue, creates
an ARP request packet and broadcasts it throughout the Ethernet. As mentioned
earlier, the ARP request packet contains the IP address of Host B, the IP
address of Host A, and the MAC address of Host A. Since the ARP request packet
is broadcasted, all hosts on the network segment can receive it. However, only
the requested host (namely, Host B) processes the request.
l
Host B saves the IP address and the MAC address carried
in the request packet (that is, the IP address and the MAC address of the
sender, Host A) to its ARP mapping table and then sends back an ARP reply
packet to the sender (Host A), with its MAC address carried in the packet. Note
that the ARP reply packet is a unicast packet instead of a broadcasted packet.
l
Upon receiving the ARP reply packet, Host A
extracts the IP address and the corresponding MAC address of Host B from the
packet, adds them to its ARP mapping table, and then transmits all the packets
in the queue with their destination being Host B.

Figure 1-3 ARP work flow
Normally, a device automatically triggers
the ARP calculation in the IP addressing process.
The following are
the characteristics of gratuitous ARP packets:
l
Both source and destination IP addresses carried
in a gratuitous ARP packet are the local addresses, and the source MAC address
carried in it is the local MAC addresses.
l
If a device finds that the IP addresses carried
in a received gratuitous packet conflict with those of its own, it returns an
ARP response to the sending device to notify of the IP address conflict.
By sending gratuitous ARP packets, a
network device can:
l
Determine whether or not IP address conflicts
exist between it and other network devices.
l
Trigger other network devices to update its
hardware address stored in their caches.
The gratuitous ARP packet learning
function:
When the gratuitous ARP packet learning
function is enabled on a switch and the switch receives a gratuitous ARP
packet, the switch updates the existing ARP entry (contained in the cache of
the switch) that matches the received gratuitous ARP packet using the hardware
address of the sender carried in the gratuitous ARP packet. A switch operates
like this whenever it receives a gratuitous ARP packet.
1.2 ARP Configuration
ARP entries in an S3100-52P Ethernet switch
can either be static entries or dynamic entries, as described in Table 1-4.
Table 1-4 ARP entries
|
ARP entry
|
Generation Method
|
Maintenance Mode
|
|
Static ARP entry
|
Manually configured
|
Manual maintenance
|
|
Dynamic ARP entry
|
Dynamically generated
|
ARP entries of this type age with time. The
aging period is set by the ARP aging timer.
|
Table 1-5 Add
a static ARP mapping entry manually
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Add a static ARP mapping entry manually
|
arp static ip-address mac-address [ vlan-id
interface-type interface-number ]
|
Required
By default, the ARP mapping table is
empty, and the address mapping entries are created dynamically by ARP.
|
Caution:
l
Static ARP mapping entries are valid as long as
the Ethernet switch operates. But some operations, which make the ARP entries
invalid, result in ARP entries being removed, such as changing/removing a VLAN
interface, removing a VLAN, or removing a port from a VLAN.
l
As for the arp static command, the value
of the vlan-id argument must be the ID of an existing VLAN, and the port
identified by the interface-type and interface-number arguments must
belong to the VLAN.
l
Currently, static ARP mapping entries cannot be
configured on aggregation ports.
The ARP aging timer applies to all dynamic
ARP mapping entries.
Table 1-6 Configure
the ARP aging timer for dynamic ARP entries
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Configure the ARP aging timer
|
arp timer aging aging-time
|
Optional
By default, the ARP aging timer is set to
20 minutes.
|
When multiple hosts share one multicast MAC
address, you can specify whether or not to create ARP entries for the multicast
MAC address by performing the operations listed in Table 1-7.
Table 1-7 Enable the ARP entry checking function
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Enable the ARP entry checking function (that
is, disable the switch from creating ARP entries for multicast MAC addresses)
|
arp check enable
|
Optional
By default, the ARP entry checking
function is enabled.
|
1.3 Gratuitous
ARP Packet Configuration
Sending of gratuitous ARP packets is
enabled as long as an S3100-52P switch operates. And no command is needed for
this function.
Table 1-8 lists the operations to configure the gratuitous ARP packet
learning function.
Table 1-8 Configure
the gratuitous ARP packet learning function
|
Operation
|
Command
|
Description
|
|
Enter system view
|
system-view
|
—
|
|
Enable the gratuitous ARP packet learning
function
|
gratuitous-arp-learning enable
|
Required
By default, the gratuitous ARP packet
learning function is enabled.
|
After the above configuration, you can execute
the display command in any view to display the running of the ARP
configuration, and to verify the effect of the configuration.
You can execute the reset command in
user view to clear ARP mapping entries.
Table 1-9 Display
and debug ARP
|
Operation
|
Command
|
Description
|
|
Display specific ARP mapping table
entries
|
display arp [ static | dynamic | ip-address ]
|
These commands can be executed in any
view.
|
|
Display the ARP mapping entries related
to a specified string in a specified way
|
display arp [ dynamic | static | ip-address ] |
{ begin | include | exclude } text
|
|
Display the number of the ARP mapping
entries of a specified type
|
display arp count [ [ dynamic | static ] [ | {
begin | include | exclude } text ] |
ip-address ]
|
|
Display the setting of the ARP aging
timer
|
display arp timer aging
|
|
Clear specific ARP mapping entries
|
reset arp
[ dynamic | static | interface interface-type interface-number ]
|
Execute this command in user view.
|