|
在 /etc/ethers 里配置网关MAC和IP对应地址:beyes@linux-beyes:~/network> cat /etc/ethers
#
# ethers This file contains 48 bit Ethernet addresses and their
# corresponding IP number or hostname. The two items are
# separated by any number of SPACE and/or TAB char acters.
# A at the beginning of a line starts a comment which extends
# to the end of the line. The Ethernet-address is written as
# x:x:x:x:x:x, where x is a hexadecimal number between 0 and
# ff which represents one byte of the address, which is in
# network byte order (bigendian). The IP-number may be a
# hostname which can be resolved by DNS or a dot separated
# number.
#
# Syntax:
# Ethernet-address IP-number
#
#
04:4b:80:80:80:03 192.168.0.1
这样直接运行命令 arp -f 就可以实现对网关的绑定;查看一下 arp 缓存:beyes@linux-beyes:~/network> sudo /sbin/arp
Address HWtype HWaddress Flags Mask Iface
192.168.0.1 ether 04:4b:80:80:80:03 CM wlan0
192.168.0.104 ether 00:c0:9f:8d:06:77 C wlan0
192.168.174.129 ether 00:0c:29:14:19:a8 C vmnet8 上面,在 Flags Mask 里,看到 M 标志,表示绑定成功。
假如不是修改 /etc/ethers 文件,也可以编辑另外一个相应格式的文件,然后 arp -f 后面加上这个文件名即可。 |
|