linux dual-card dual-ip configuration

在/etc/rc.local里面加上
ip route replace default via 221.6.67.33 dev eth1
ip route replace default via 180.97.81.1 dev eth0
ip route flush table ctc
ip route add default via 180.97.81.1 dev eth0 src 180.97.81.178 table ctc proto static
ip rule add from 180.97.81.178 table ctc
ip route flush table cnc
ip route add default via 221.6.67.33 dev eth1 src 221.6.67.49 table cnc proto static
ip rule add from 221.6.67.49 table cnc

在/etc/iproute2/rt_tables 里面加上

252 cnc
251 ctc

 

Restart the server, or network service restart, the routing rule on the failure, restart the script on the line,

If ubuntu / debian, system startup script /etc/rc.local 
If RedHat / CentOS , the system startup script /etc/rc.d/rc.local

If ubuntu / debian, network startup script is /etc/init.d/networking 
If RedHat / centos, network startup script is /etc/rc.d/init.d/network

A reference to the contents of one another blogger, the blogger said that the ubuntu system, the same basic principle, interested can learn about at the following link: https://www.cnblogs.com/luckyall/p/6418965.html

Guess you like

Origin www.cnblogs.com/guizjiang/p/11418936.html