系統(tǒng)之家 - 系統(tǒng)光盤下載網(wǎng)站!

當(dāng)前位置:系統(tǒng)之家 > 系統(tǒng)教程 > Linux下route命令實(shí)例

Linux下route命令操作實(shí)例匯總(2)

時(shí)間:2014-12-29 17:05:47 作者:qipeng 來(lái)源:系統(tǒng)之家 1. 掃描二維碼隨時(shí)看資訊 2. 請(qǐng)使用手機(jī)瀏覽器訪問: https://m.xitongzhijia.net/xtjc/20141229/33646.html 手機(jī)查看 評(píng)論

  說(shuō)明:

  第一行表示主機(jī)所在網(wǎng)絡(luò)的地址為192.168.120.0,若數(shù)據(jù)傳送目標(biāo)是在本局域網(wǎng)內(nèi)通信,則可直接通過(guò)eth0轉(zhuǎn)發(fā)數(shù)據(jù)包;

  第四行表示數(shù)據(jù)傳送目的是訪問Internet,則由接口eth0,將數(shù)據(jù)包發(fā)送到網(wǎng)關(guān)192.168.120.240

  其中Flags為路由標(biāo)志,標(biāo)記當(dāng)前網(wǎng)絡(luò)節(jié)點(diǎn)的狀態(tài)。

  Flags標(biāo)志說(shuō)明:

  U Up表示此路由當(dāng)前為啟動(dòng)狀態(tài)

  H Host,表示此網(wǎng)關(guān)為一主機(jī)

  G Gateway,表示此網(wǎng)關(guān)為一路由器

  R Reinstate Route,使用動(dòng)態(tài)路由重新初始化的路由

  D Dynamically,此路由是動(dòng)態(tài)性地寫入

  M Modified,此路由是由路由守護(hù)程序或?qū)蚱鲃?dòng)態(tài)修改

 ! 表示此路由當(dāng)前為關(guān)閉狀態(tài)

  備注:

  route -n (-n 表示不解析名字,列出速度會(huì)比route 快)

  實(shí)例2:添加網(wǎng)關(guān)/設(shè)置網(wǎng)關(guān)

  命令: route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

  輸出:

  代碼如下:

  [root@localhost ~]# route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

 。踨oot@localhost ~]# route

  Kernel IP routing table

  Destination Gateway Genmask Flags Metric Ref Use Iface

  192.168.120.0 * 255.255.255.0 U 0 0 0 eth0

  192.168.0.0 192.168.120.1 255.255.0.0 UG 0 0 0 eth0

  10.0.0.0 192.168.120.1 255.0.0.0 UG 0 0 0 eth0

  224.0.0.0 * 240.0.0.0 U 0 0 0 eth0

  default 192.168.120.240 0.0.0.0 UG 0 0 0 eth0

  說(shuō)明:

  增加一條 到達(dá)244.0.0.0的路由

  實(shí)例3:屏蔽一條路由

  命令:route add -net 224.0.0.0 netmask 240.0.0.0 reject

  輸出:

  代碼如下:

  [root@localhost ~]# route add -net 224.0.0.0 netmask 240.0.0.0 reject

 。踨oot@localhost ~]# route

  Kernel IP routing table

  Destination Gateway Genmask Flags Metric Ref Use Iface

  192.168.120.0 * 255.255.255.0 U 0 0 0 eth0

  192.168.0.0 192.168.120.1 255.255.0.0 UG 0 0 0 eth0

  10.0.0.0 192.168.120.1 255.0.0.0 UG 0 0 0 eth0

  224.0.0.0 - 240.0.0.0 ! 0 - 0 -

  224.0.0.0 * 240.0.0.0 U 0 0 0 eth0

  default 192.168.120.240 0.0.0.0 UG 0 0 0 eth0

  說(shuō)明:

  增加一條屏蔽的路由,目的地址為 224.x.x.x 將被拒絕

標(biāo)簽 命令 route

發(fā)表評(píng)論

0

沒有更多評(píng)論了

評(píng)論就這些咯,讓大家也知道你的獨(dú)特見解

立即評(píng)論

以上留言僅代表用戶個(gè)人觀點(diǎn),不代表系統(tǒng)之家立場(chǎng)

其他版本軟件

熱門教程

人氣教程排行

Linux系統(tǒng)推薦

官方交流群 軟件收錄