您的位置:首页 > 运维架构 > Linux

一天一条Linux指令-arp

2016-11-03 12:50 393 查看


用途说明

显示和修改地址解析协议(ARP)使用的“IP 到物理”地址转换表。手册页上的说法是“操作系统ARP缓存”,manipulate the system ARP cache。


常用参数

arp 显示当前的ARP缓存列表。

arp -s ip mac 添加静态ARP记录,如果需要永久保存,应该编辑/etc/ethers文件。

arp -f 使/etc/ethers中的静态ARP记录生效。


使用示例


示例一

[root@rhel55 src]# arp 

Address                  HWtype  HWaddress           Flags Mask            Iface

192.168.6.106            ether   70:1A:04:CC:2B:21   C                     eth0

[root@rhel55 src]# ping 192.168.6.1 

PING 192.168.6.1 (192.168.6.1) 56(84) bytes of data.

64 bytes from 192.168.6.1: icmp_seq=1 ttl=64 time=1.65 ms

64 bytes from 192.168.6.1: icmp_seq=2 ttl=64 time=0.888 ms
Ctrl+C 

--- 192.168.6.1 ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 999ms

rtt min/avg/max/mdev = 0.888/1.270/1.653/0.384 ms

[root@rhel55 src]# arp 

Address                  HWtype  HWaddress           Flags Mask            Iface

192.168.6.1              ether   00:22:6B:8C:70:3D   C                     eth0

192.168.6.106            ether   70:1A:04:CC:2B:21   C                     eth0

[root@rhel55 src]# vi /etc/ethers 

192.168.6.1     00:22:6B:8C:70:3D

[root@rhel55 src]# arp -f 

[root@rhel55 src]# arp 

Address                  HWtype  HWaddress           Flags Mask            Iface

192.168.6.1              ether   00:22:6B:8C:70:3D   CM                     eth0

192.168.6.106            ether   70:1A:04:CC:2B:21   C                     eth0

 

Flags Mask,C表示arp cache中的内容,M表示是静态ARP entry。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: