指令
| arp -a | ip neigh show | 顯示 arp cache |
| arp -d hostname | ? | 移除 entry |
| arp -s hostname hw_addr | ? | 新增永久 entry |
| arp -s hostname hw_addr temp | ? | 新增暫時 entry |
-A 或 -p [inet|...]: protocol
-H 或 -t [ether|...]:HW type
nDv
/proc/net/arp
arp flags
| 0x02 | COM, completed entry (ha valid) |
|---|---|
| 0x04 | PERM, permanent entry |
| 0x08 | PUBL, publish entry |
| 0x10 | USETRAILERS, has requested trailers |
| 0x20 | NETMASK, want to use a netmask (only for proxy entries) |
| 0x40 | DONTPUB, don't answer this addresses |
| 0x? | MAGIC, AUTO |
arp 項目狀態
| none | 新建立。 |
|---|---|
| incomplete | 新建立後首次 ARP 請求。 |
| reachable | 已確認可達性後尚未過期。更新? |
| permanent | 手動設定,不偵測可達性,從不過期。 |
| noarp | 不偵測可達性。 |
| stale | 已過期仍嘗試直送,使用時進入 delay 確認。經過 gc_stale_time 時間進入 ?failed 狀態。 |
| delay | 排程 ARP 請求確認 |
| probe | 送 ARP 請求 |
| failed | 沒收到回應。?gc_interval 週期檢查如果沒任何參照則移除。 |
/proc/sys/net/ipv4/neigh/*/*
- anycast_delay
- app_solicit
- base_reachable_time, base_reachable_time_ms:過期時間,預設 30 秒,實際會設為 ± 一半時間的亂數。過期後稱為 stale。
- delay_first_probe_time:過期後 first probe 的延遲,預設 5 秒。
- gc_stale_time:garbage collection stale time,多久檢查 stale entry 一次,預設 60 秒。it is resolved again before sending data to it.
- locktime
- mcast_solicit
- proxy_delay
- proxy_qlen
- retrans_time, retrans_time_ms
- ucast_solicit
- unres_qlen
註:IPv6 用 ND 取代 ARP
在 ARP table 至少有 gc_thresh1 筆時,才以 gc_interval 週期執行 neigh_periodic_work() 進行 ARP garbage collection,避免消耗太多 CPU cycles 卻沒有省到什麼記憶體。gc_thresh3 是 ARP table 筆數上限。
?只有 ARP 的 mac 會存到 ARP cache
?何時會 unicast ARP 確認?
參考
- man arp
- http://linux-ip.net/html/ether-arp.html
- 重製 0-3 seconds delay「ping <ip> -c 1」後執行「ip -statistics neig && ip -4 ntable show dev <ethernet_interface>」。清除 Arp Cache 「ip -s neigh flush all」。
- /proc/sys/net/ipv4/route/gc_timeout
- [CentOS7] 使用ip neighbor指令來偵測修改其他的節點:有狀態研究
沒有留言:
張貼留言