To do arp binding Gateway in Windows.

1.Find the gateway address of local network segment, such as 192.168.1.1.

Cocuments and Settings>arp -a
Interface:192.168.1.5 --- 0x2
Internet Address Physical Address Type
192.168.1.1 00-01-02-03-04-05 dynamic

The gateway arp address is dynamic.

2.Write a batch file arpbinding.bat, which reads as follows.

@ echo off
arp-d
arp-s 192.168.1.1 00-11-22-33-44-55

Save as arpbinding.bat and run.Then use arp -a to view the arp cache.

Cocuments and Settings>arp -a
Interface: 192.168.1.5 --- 0x2
Internet Address Physical Address Type
192.168.1.1 00-11-22-33-44-55 static

The gateway arp address is binding static.

To do arp binding Gateway in Linux.

1.Use ARP and ARP-a to take a look at list of current ARP cache

[root@ftpsvr ~]# arp
Address HWtype HWaddress Flags Mask Iface
192.168.1.2 ether 00:03:51:AE:36:C3 C eth0
192.168.1.3 ether 00:35:20:D5:31:19 C eth0
192.168.1.1 ether 00:21:C2:A2:06:82 C eth0

[root@ftpsvr ~]# arp -a
? (192.168.1.2) at 00:03:51:AE:36:C3 [ether] on eth0
? (192.168.1.1) at 00:21:C2:A2:06:82 [ether] on eth0

Building a static table corresponding to the Mac-->IP file: IP-Mac.Write the IP and MAC address to be bound to this file, the format is IP Mac.

[root@ftpsvr ~]# echo '192.168.1.1 00:21:C2:A2:06:82' > /etc/ip-mac
[root@ftpsvr ~]# more /etc/ip-mac
192.168.1.1 00:21:C2:A2:06:82

3.Set the auto-binding after boot up.

[root@ftpsvr ~]# echo 'arp -f /etc/ip-mac ' >> /etc/rc.d/rc.local

4.Manual run the arp binding.

[root@ftpsvr ~]# arp -f /etc/ip-mac

5.Verify whether the binding is successful.

[root@ftpsvr ~]# arp
Address HWtype HWaddress Flags Mask Iface
192.168.1.2 ether 00:03:51:AE:36:C3 C eth0
192.168.1.4 ether 00:11:A3:C2:25:2A C eth0
192.168.1.1 ether 00:21:C2:A2:06:82 CM eth0

[root@ftpsvr ~]# arp -a
? (192.168.1.2) at 00:03:51:AE:36:C3 [ether] on eth0
? (192.168.1.4) at 00:11:A3:C2:25:2A [ether] on eth0
? (192.168.1.1) at 00:21:C2:A2:06:82 [ether] PERM on eth0

From binding ARP cache list, you can see the gateway (192.168.1.1) records flag has changed, theIP and MAC address binding is successful.

Note: Linux MAC address is different from Widows. Linux is represented as: 00:00:00:00:00:00,Windows is represented as: 00-00-00-00-00-00.



This address is http://www.computerites.com/internet-skills/2012/12/use-the-arp-command-to-bind-the-ip-and-mac-addresses-638.html