亚洲国产第一_开心网五月色综合亚洲_日本一级特黄特色大片免费观看_久久久久久久久久免观看

Hello! 歡迎來到小浪云!


Linux Centos路由添加route命令



方法一:

添加路由

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

刪除路由

route del -net 192.168.0.0/24 gw 192.168.0.1

add 增加路由

del 刪除路由

-net 設(shè)置到某個(gè)網(wǎng)段的路由

-host 設(shè)置到某臺(tái)主機(jī)的路由

gw 出口網(wǎng)關(guān) IP地址

dev 出口網(wǎng)關(guān) 物理設(shè)備名

增加默認(rèn)路由:route add default gw 192.168.0.1

默認(rèn)路由一條就夠了

實(shí)例:route add -net 10.192.139.0/24 gw 10.192.154.65 dev eth1

route -n 查看路由表

方法二:

添加路由

ip route add 192.168.0.0/24 via 192.168.0.1

ip route add 192.168.1.1 dev 192.168.0.1

刪除路由

ip route del 192.168.0.0/24 via 192.168.0.1

add 增加路由

del 刪除路由

via 網(wǎng)關(guān)出口 IP地址

dev 網(wǎng)關(guān)出口 物理設(shè)備名

增加默認(rèn)路由

ip route add default via 192.168.0.1 dev eth0

via 192.168.0.1 是我的默認(rèn)路由器

查看路由信息

ip route

保存路由設(shè)置,使其在網(wǎng)絡(luò)重啟后任然有效 

在/etc/sysconfig/network-script/目錄下創(chuàng)建名為route- eth0的文件 

vi /etc/sysconfig/network-script/route-eth0 

在此文件添加如下格式的內(nèi)容 :   192.168.1.0/24 via 192.168.0.1 

重啟網(wǎng)絡(luò)驗(yàn)證

 

/etc/rc.d/init.d/network中有這么幾行:

# Add non interface-specific Static-routes.

if [ -f /etc/sysconfig/static-routes ]; then

grep “^any” /etc/sysconfig/static-routes | while read ignore args ; do

/sbin/route add -$args

done

fi 

也就是說,將靜態(tài)路由加到/etc/sysconfig/static-routes 文件中就行了。

如加入:route add -net 11.1.1.0 netmask 255.255.255.0 gw 11.1.1.1

則static-routes的格式為: any net 11.1.1.0 netmask 255.255.255.0 gw 11.1.1.1

相關(guān)閱讀