可以通過route add命令來添加靜態(tài)路由,具體命令如下:
1、添加路由
route add -net 192.168.0.0/24 gw 192.168.0.1 route add -host 192.168.1.1 dev 192.168.0.1
2、刪除路由
route del -net 192.168.0.0/24 gw 192.168.0.1
參數(shù)介紹:
add 增加路由
del 刪除路由
-net 設(shè)置到某個網(wǎng)段的路由
-host 設(shè)置到某臺主機(jī)的路由
gw 出口網(wǎng)關(guān) IP地址
dev 出口網(wǎng)關(guān) 物理設(shè)備名
3、增加默認(rèn)路由
route add default gw 192.168.0.1
默認(rèn)路由一條就夠了
4、查看路由表
route -n
推薦教程:linux教程