1. Use ARP and ARP-a to view the current ARP cache list.
[Root @ FTP] # ARP
Address hwtype hwaddress flags mask iface
192.168.0.145 ether 00: 13: 20: E9: 11: 04 C eth0
192.168.0.1 ether 00: 02: 03: 18: 08: 00 C eth0
Note:
Address: IP address of the host
Hwtype: host hardware type
Hwaddress: host hardware address
Flags mask: Record flag. "C" indicates entries in the ARP cache, and "M" indicates static ARP entries.
[Root @ FTP] # ARP-
(192.168.0.145) at 00: 13: 20: E9: 11: 04 [ether] On eth0
(192.168.0.1) at 00: 02: 03: 18: 08: 00 [ether] On eth0
2. Create a static Mac --> ip table file: IP-Mac. Write the IP address and MAC address to be bound to this file in the format of IP Mac.
.
[Root @ FTP] # echo '192. 168.0.1 00: 02: 03: 18: 08: 00'>/etc/IP-Mac
[Root @ FTP] # More/etc/IP-Mac
192.168.0.1 00: 02: 03: 18: 08: 00
3. Set automatic binding upon startup
[Root @ FTP] # echo 'Arp-F/etc/IP-mac'>/etc/rc. d/rc. Local
4. Manually perform the binding
[Root @ FTP] # ARP-F/etc/IP-Mac
5. Check whether the binding is successful.
[Root @ FTP] # ARP
Address hwtype hwaddress flags mask iface
192.168.0.145 ether 00: 13: 20: E9: 11: 04 C eth0
192.168.0.1 ether 00: 02: 03: 18: 08: 00 cm eth0
[Root @ FTP] # ARP-
(192.168.0.145) at 00: 02: B3: A7: 85: 48 [ether] On eth0
(192.168.0.1) at 00: 02: 03: 18: 08: 00 [ether] perm on eth0
From the ARP cache list before and after binding, you can see that the record mark of the Gateway (192.168.0.1) has changed, indicating that the binding is successful.