Linux MAC Address binding

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.