arp命令

 用于操作本机的arp缓存区,它可以显示arp缓存区中的所有条目、删除指定的条目或者添加静态的IP地址与MAC地址的对应关系。     什么是arp?即地址解析协议(ARP,Address Resolution Protocol),其主要功能是根据IP地址获取物理地址(MAC地址)。  

arp 命令的参数选项及说明

-n                      显示数字IP地址 -s<主机><MAC地址>        设置指定主机的IP地址与MAC地址的静态映射 -d<主机>                从arp缓存区中删除指定主机的ap条目 -i<接>                指定网络接 -v                    显示详细的arp缓存区条目,包括缓冲区务目的统计信息   [root@cs6 ~]# arp -n Address HWtype HWaddress Flags Mask Iface 10.0.0.1 ether 00:50:56:c0:00:08 C eth0 10.0.0.2 ether 00:50:56:f4:fb:52 C eth0   命令说明具体如下。 Address:主机地址。 Hwtype:硬件类型。 Hwaddress:硬件地址。 Flags Mask:记录标志,“C”表示arp高速缓存中的条目,“M”表示静态的arp条目。 lface:网络接口。    

查询指定主机的arp条目

[root@cs6 ~]# arp -n 10.0.0.1 Address HWtype HWaddress Flags Mask Iface 10.0.0.1 ether 00:50:56:c0:00:08 C eth0  

静态绑定IP地址与MAC地址

[root@cs6 ~]# arp -s 10.0.0.99 00:0c:29:c0:5a:ef  #绑定IP地是和MAC地址 [root@cs6 ~]# arp -n Address HWtype HWaddress Flags Mask Iface 10.0.0.1 ether 00:50:56:c0:00:08 C eth0 10.0.0.2 ether 00:50:56:f4:fb:52 C eth0 10.0.0.99 ether 00:0c:29:c0:5a:ef CM eth0  

删除静态ARP绑定

[root@cs6 ~]# arp -d 10.0.0.99 [root@cs6 ~]# arp -n Address HWtype HWaddress Flags Mask Iface 10.0.0.1 ether 00:50:56:c0:00:08 C eth0 10.0.0.2 ether 00:50:56:f4:fb:52 C eth0 10.0.0.99 (incomplete) eth0 提示:当局域网有arp病毒时,就可以用上运方法绑定MAC地址,以防止中毒。            
扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄