| | 24 | |
| | 25 | = sample script = |
| | 26 | * source:/trunk/iproute |
| | 27 | * setroute.sh (for Ubuntu) |
| | 28 | * デフォルトGWの設定状況に関わりなく、ethNから入ってきたパケットはetnNから返す設定にするスクリプト |
| | 29 | * NIC活性化時に自動で呼び出して使用 |
| | 30 | * /etc/network/interfaces にて以下のようにして使う |
| | 31 | {{{ |
| | 32 | auto eth2 |
| | 33 | iface eth2 inet dhcp |
| | 34 | post-up /root/setroute.sh |
| | 35 | post-up /sbin/ip route del default dev eth2 |
| | 36 | post-down /root/setroute.sh |
| | 37 | |
| | 38 | auto eth1 |
| | 39 | iface eth1 inet dhcp |
| | 40 | post-up /root/setroute.sh |
| | 41 | post-down /root/setroute.sh |
| | 42 | }}} |
| | 43 | * 「post-up ip route del default dev eth2」については => [../defaultgw#Ubuntu] |
| | 44 | * setroute-rhel.sh (for CentOS) |
| | 45 | * RHEL系については、interfacesの様なNIC活性化時の自動呼び出し+デバイス名自動取得の方法が不明なので、設定するデバイス名を指定する必要がある |
| | 46 | * sudo /root/setroute-rhel.sh eth1 [192.168.1.254] |