Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Win7 綁定閘道 IP 與 MAC 位址提示「ARP 項目新增失敗」?使用 netsh 指令正確設定靜態 ARP

編輯:Windows 7 系統介紹

問題現象

命令提示字元執行 arp -s 閘道IP 閘道MAC 提示「ARP 項目新增失敗」,無法建立靜態 ARP 綁定防止 ARP 欺騙。

原因

Win7/Vista 以降,arp -s 僅能建立動態 ARP 項目,重開機即失效;且若介面索引 (Idx) 未指定,系統無法判斷綁定至哪張網卡。必須使用 netsh 指令配合介面索引建立持久鄰居項目。

正確設定步驟

  1. 查看網卡介面索引:
    netsh interface ipv4 show interfaces
    找到目標網卡 (如「區域連線」) 對應的 Idx (假設為 11)。
  2. 建立靜態鄰居 (鄰居 = ARP 表項):
    netsh interface ipv4 add neighbors 11 "閘道IP" "閘道MAC"
    範例:netsh interface ipv4 add neighbors 11 "192.168.1.1" "00-11-22-33-44-55"
  3. 驗證綁定:
    arp -a
    輸出中該 IP 旁顯示 static 字樣即成功。
arp -s 失敗錯誤
圖 1:arp -s 提示新增失敗

刪除靜態綁定

arp -d 無法刪除 netsh 建立的靜態項目,必須使用:

netsh interface ipv4 delete neighbors 11 "閘道IP"

快速操作摘要表

步驟指令說明
1. 查閘道 MACarp -a記下閘道 IP 對應的物理位址
2. 查介面 Idxnetsh interface ipv4 show interfaces記下目標網卡 Idx (如 11)
3. 綁定靜態 ARPnetsh interface ipv4 add neighbors Idx "閘道IP" "閘道MAC"建立持久鄰居項目
4. 驗證arp -a確認顯示 static
5. 刪除綁定netsh interface ipv4 delete neighbors Idx "閘道IP"移除靜態項目

適用範圍

  • Windows 7 / 8 / 8.1 / 10 / 11 / Server 2008 R2 以上。
  • IPv6 環境請將 ipv4 改為 ipv6,指令結構相同。
Copyright © Windows教程網 All Rights Reserved