wiki:TipAndDoc/network/iproute

Version 11 (modified by mitty, 13 years ago) (diff)

[92]

iproute2

iproute2を使ったマルチホーム

misc

  • 全てのtable IDのrouting tableを列挙する
    • ip route show table all
  • キャッシュされたrouting tableを表示する
    • ip route show table cache
    • キャッシュの破棄
      • ip route flush cache

sample script

setroute.sh

  • for Ubuntu
  • デフォルトGWの設定状況に関わりなく、ethNから入ってきたパケットはetnNから返す設定にするスクリプト
  • NIC活性化時に自動で呼び出して使用
  • /etc/network/interfaces にて以下のようにして使う
    auto eth2
    iface eth2 inet dhcp
            post-up /root/setroute.sh
            post-up /sbin/ip route del default dev eth2
            post-down /root/setroute.sh
    
    auto eth1
    iface eth1 inet dhcp
            post-up /root/setroute.sh
            post-down /root/setroute.sh
    
    • 「post-up ip route del default dev eth2」については => defaultgw

setroute-rhel.sh

  • for CentOS/Ubuntu
  • RHEL系については、interfacesの様なNIC活性化時の自動呼び出し+デバイス名自動取得の方法が不明なので、設定するデバイス名を指定する必要がある
  • ex) $ sudo /root/setroute-rhel.sh eth1 [192.168.1.254]

Attachments (1)

Download all attachments as: .zip