手机看片精品高清国产日韩,色先锋资源综合网,国产哺乳奶水91在线播放,乱伦小说亚洲色图欧洲电影

CentOS下使用Route命令添加路由

2019-04-26 05:23:49 9770

方法一

添加路由:


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。


查看路由信息:


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

也就是說(shuō),將靜態(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


提交成功!非常感謝您的反饋,我們會(huì)繼續(xù)努力做到更好!

這條文檔是否有幫助解決問(wèn)題?

非常抱歉未能幫助到您。為了給您提供更好的服務(wù),我們很需要您進(jìn)一步的反饋信息:

在文檔使用中是否遇到以下問(wèn)題: