LoginSignup
1
2

More than 3 years have passed since last update.

Windowsで手動ルーティング設定/ARPテーブル設定

Last updated at Posted at 2019-10-25

Windowsで手動ルーティングやARPテーブル設定をするときのメモ。

環境はWindows7/Windows10。

ルーティング

route add コマンド

宛先が 100.100.100.1/32 のパケットは 30.30.30.1 がゲートウェイだよ。使用するインタフェース番号は 24 だよ、という設定をするコマンド。(管理者権限で実行)

route add 100.100.100.1 mask 255.255.255.255 30.30.30.1 if 24

ifオプションに指定するインタフェース番号は、netsh interface ipv4 show interfaces で確認できる。

c:\> netsh interface ipv4 show interfaces

Idx     Met         MTU          状態                 名前
---  ----------  ----------  ------------  ---------------------------
 24           5        1500  disconnected  イーサネット
 30          65        1500  connected     Wi-Fi

ARP

netshでARPテーブル指定

100.100.100.1 のMACアドレスは 01-02-03-0A-0B-0C だよ、という設定をするコマンド(管理者権限で実行)

c:\> netsh interface ipv4 set neighbors "インターフェース名" 100.100.100.1 01-02-03-0A-0B-0C



ここでいう"インタフェース名"は "イーサネット" などが入る。
route add でも使用した netsh interface ipv4 show interfaces で確認できる。

c:\> netsh interface ipv4 show interfaces

Idx     Met         MTU          状態                 名前
---  ----------  ----------  ------------  ---------------------------
 24           5        1500  disconnected  イーサネット
 30          65        1500  connected     Wi-Fi

arp -sでARPテーブル指定

古いWindows(Vistaとか)だと arp -s でARPテーブルの手動設定をするらしい

c:\> arp -s 100.100.100.1 01-02-03-0A-0B-0C


削除は -d

c:\> arp -d 100.100.100.1
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2