routeコマンドのテンプレ
デフォルトゲートウェイの設定
# route add default gw 10.255.0.1 eth1
対象ネットワークへのゲートウェイの設定
# route add -net 192.168.1.0/24 gw 10.0.10.10 eth1
対象ホストへのゲートウェイの設定
# route add -host 192.168.1.20 gw 10.0.10.10 eth1
ルーティングの確認
# netstat -rn
# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.255.0.1 0.0.0.0 UG 0 0 0 eth1
10.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth1
192.168.1.0 10.0.10.10 255.255.255.0 UG 0 0 0 eth1
192.168.1.20 10.0.10.10 255.255.255.255 UGH 0 0 0 eth1
ルーティングテーブルの見方
- Destination あて先
- Gateway ゲートウェイ
- Genmask あて先ネットマスク
- Flags 経路の状態
- U 有効
- H 対象はホスト
- G ゲートウェイを使用
- ! 無効
- Metric あて先までの距離
- 関連記事
-
-
udevについて 201 2014/08/23
-
fsck 201 2014/08/23
-
routeコマンドの見方 201 2014/08/20
-
起動スクリプトと自動起動の設定コマンド 201 2014/08/20
-
カーネルの起動シーケンス 201 2014/08/19
-