所謂永久路由就是在重啓服務器設備或者網卡,路由表都一直存在vim
1.window:windows
eg:centos
route add -p 192.168.0.0 mask 255.255.0.0 192.168.31.254服務器
批量方式,新建文本並修改後綴爲bat,而後雙擊運行ide
2.centosci
eg:路由
route add -net 1.12.0.0/14 gw x.x.x.xit
批量方式,在 /etc/sysconfig/新建名爲「static-routes」 文件,文件內容爲:class
#add non interface-specific static-routes.route
if [ -f /etc/sysconfig/static-routes ]; then
grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do
/sbin/route add -$args
done
fi
any net 1.12.0.0/14 gw x.x.x.x
any net 1.24.0.0/13 gw x.x.x.x
3.debian
eg:
sudo vim /etc/network/interfaces 末尾追加如下:
route add -net 1.12.0.0/14 gw x.x.x.x
批量方式就是在/etc/network/interfaces文件末尾累加就行
附件是全國網通路由表,把網關(x.x.x.x)修改成本身的網關就能夠直接使用
windows 修改文件名爲windows.bat並雙擊運行
centos 把文件複製到/etc/sysconfig/目錄下,並修改文件名爲static-routes
debian copy文件的內容並編輯/etc/network/interfaces 末尾追加