linux添加路由命令,linux怎么加route到第一行,Linux下route命令操作實例匯總(2)

 2023-11-16 阅读 23 评论 0

摘要:說明:第一行表示主機所在網絡的地址為192.168.120.0,若數據傳送目標是在本局域網內通信,則可直接通過eth0轉發數據包;第四行表示數據傳送目的是訪問Internet,則由接口eth0,將數據包發送到網關192.168.120.240其中Flags為路由標志,標

說明:

第一行表示主機所在網絡的地址為192.168.120.0,若數據傳送目標是在本局域網內通信,則可直接通過eth0轉發數據包;

第四行表示數據傳送目的是訪問Internet,則由接口eth0,將數據包發送到網關192.168.120.240

其中Flags為路由標志,標記當前網絡節點的狀態。

Flags標志說明:

linux添加路由命令?U Up表示此路由當前為啟動狀態

H Host,表示此網關為一主機

G Gateway,表示此網關為一路由器

R Reinstate Route,使用動態路由重新初始化的路由

D Dynamically,此路由是動態性地寫入

M Modified,此路由是由路由守護程序或導向器動態修改

linux dmesg、! 表示此路由當前為關閉狀態

備注:

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

實例2:添加網關/設置網關

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

輸出:

linux mkfs、代碼如下:

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

[root@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

linux uptime。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

說明:

增加一條 到達244.0.0.0的路由

route -n命令。實例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

[root@localhost ~]# route

centos 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 -

vue route,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

說明:

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

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/4/173877.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息