หน้าแรก / Linux / Centos Mutigateway

 

Ref. http://www.dfwavc.com/linux_multi_nic-multi_gateway

1 สร้าง table  route
echo echo 2  gate2 >> /etc/iproute2/rt_tables

2. Add  route ให้ table

ip route add 110.34.191.128/26 dev eth2 src 110.34.191.171 table gate2
ip route add  110.34.191.128/26 dev eth3 src 110.34.191.172 table gate2
ip route add  110.34.191.128/26 dev eth4 src 110.34.191.173 table gate2
ip route add  110.34.191.128/26 dev eth5 src 110.34.191.174 table gate2

ip route add default via 110.34.191.190 dev  eth2 table  gate2

3. Add rule

ip rule add  from 110.34.191.128/26 table gate2
ip rule add to 110.34.191.171  table gate2

4. ตรวจสอบ

check
ip route show table gate2
ip rule

# Make it permanent
vi /etc/sysconfig/network-scripts/route-eth0
192.168.0.32 dev eth0 src 192.168.0.34 table gate2
default via 192.168.0.33 dev eth0 table gate2

vi /etc/sysconfig/network-scripts/rule-eth0
from 192.168.0.34/32 table eth0table
to 192.168.0.34 table eth0table

route -n
ip route
ifconfig eth0

 
 
 

Add a comment

required

required

optional