LoginSignup
9
11

More than 5 years have passed since last update.

CentOSで複数NICでマルチホーミング

Posted at

iproute2がインストールされているか確認

rpm -qa | grep iproute-2

入っていたら下記のような返答あり。
iproute-2.6.32-23.el6.x86_64

現在のルールを確認

ip rule

local main default 3つのルーティングテーブルが確認できる

0: from all lookup local
32766: from all lookup main
32767: from all lookup default

ルーティングテーブルを追加
192.168.0.100からのパケットの応答は、優先度10000のtable 1を使用

ip rule add from 192.168.0.100 table 1 prio 10000

table 1のデフォルトゲートウェイは192.168.0.1と指定

ip route add table 1 default via 192.168.0.1

再起動すると消えてしまいますので
vi /etc/rc.d/rc.local

/sbin/ip rule add from 192.168.0.100 table 1 prio 10000
/sbin/ip route add table 1 default via 192.168.0.1

と exit 0 の上に記載。
設定後のルールを確認

ip rule

0: from all lookup local
10000: from 192.168.0.100 lookup 1
32766: from all lookup main
32767: from all lookup default

main ルティングテーブル確認

ip route show table main

192.168.1.0/24 dev eth1 proto kernel scope link src 192.168.1.100
192.168.0.0/24 dev eth0 proto kernel scope link src 192.168.0.100
default via 192.168.0.1 dev eth0

先ほど作成した table 1 ルーティングテーブルを確認

ip route show table 1

default via 192.168.1.1 dev eth1

覚書です。

9
11
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
9
11