Skip to content

route(LPIC)

   

route

ルーティングテーブルの設定と表示を行うコマンドです。

表示

$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         v160-251-100-1. 0.0.0.0         UG    100    0        0 eth0
cache12.cloud.z v160-251-100-1. 255.255.255.255 UGH   100    0        0 eth0
160.251.100.0   0.0.0.0         255.255.254.0   U     100    0        0 eth0
v160-251-100-1. 0.0.0.0         255.255.255.255 UH    100    0        0 eth0
cache13.cloud.z v160-251-100-1. 255.255.255.255 UGH   100    0        0 eth0

追加

$ route add { -net | -host } 宛先 [ネットマスク] ゲートウェイ [インターフェース名]

削除

$ route del { -net | -host } 宛先 [ネットマスク] ゲートウェイ [インターフェース名]

サンプル

以下の様なルートテーブルの場合、192.1682.254を宛先とするパケットはDestination 192.168.2.0、Genmask 255.255.255.0 のエントリに一致するため、Gateway 192.168.2.1 に送られます。

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         172.16.1.1      0.0.0.0         UG    100    0        0 eth0
192.168.1.0     192.168.1.1     255.255.255.0   UGH   100    0        0 eth0
192.168.2.0     192.168.2.1     255.255.255.0   U     100    0        0 eth0

関連記事

  1. ip(LPIC)
  2. ifconfig,ifup,ifdown,etc(LPIC)
  3. lsof(LPIC)
  4. traceroute,tracepath(LPIC)
  5. ping(LPIC)
  6. netstat(LPIC)
  7. UDP,TCP(LPIC)