centos7雙網卡,一個連公網,一個連內網

原文地址https://www.linuxidc.com/Linux/2018-05/152427.htm
vim /etc/init.d/network的倒數第二行,也就是exit $rc上一行加上以下
10的表明內網的,168的表明外網的,via後面是網關src是網卡ip
ip route flush table 1linux

ip route add default via 10.0.7.254 dev eth0 src 10.0.7.2 table 1vim

ip rule add from 10.0.7.2 table 1ide

ip route flush table 2rest

ip route add default via 168.6.101.254 dev eth1 src 168.6.101.2 table 2htm

ip rule add from 168.6.101.2 table 2ip

注意,要先disable掉NetworkManager這個服務
systemctl disable NetworkManager
systemctl stop NetworkManager
必須只由network服務來掌管network
systemctl restart networkit

相關文章
相關標籤/搜索