route 命令

route

一般来说,只要有网络接口,该接口就会产生一个路由。route命令主要用来查看,修改主机网络接口路由信息。

	1. 查看路由表
		常见参数:
			-n: 不要使用通讯协议或主机名,直接使用 IP 或 端口号
			-ee:显示更详细的信息
		
		# route
		[root@www chenli]# route 
		Kernel IP routing table
		Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
		172.16.26.0     *               255.255.255.0   U     1      0        0 eth1
		default         172.16.26.1     0.0.0.0         UG    0      0        0 eth1
		
		# route -n
		[root@www chenli]# route -n
		Kernel IP routing table
		Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
		172.16.26.0     0.0.0.0         255.255.255.0   U     1      0        0 eth1
		0.0.0.0         172.16.26.1     0.0.0.0         UG    0      0        0 eth1
		
		# route -nee
		[root@www chenli]# route -nee
		Kernel IP routing table
		Destination     Gateway         Genmask         Flags Metric Ref    Use Iface    MSS   Window irtt
		172.16.26.0     0.0.0.0         255.255.255.0   U     1      0        0 eth1     0     0      0
		0.0.0.0         172.16.26.1     0.0.0.0         UG    0      0        0 eth1     0     0      0
	
		# Destination 目标网络,0.0.0.0表示默认路由
		# Gateway  路由的下一跳地址,0.0.0.0 表示该路由是透过局域网络的 MAC 直接传送
		# Genmask 目标网络子网掩码
		# Flags 路由标志
			U (route is up):该路由是启动的;
			H (target is a host):目标是一部主机 (IP) 而非网域;
			G (use gateway):需要透过外部的主机 (gateway) 来转递封包;
			R (reinstate route for dynamic routing):使用动态路由时,恢复路由信息的旗标;
			D (dynamically installed by daemon or redirect):已经由服务或转 port 功能设定为动态路由
			M (modified from routing daemon or redirect):路由已经被修改了;
			! (reject route):这个路由将不会被接受(用来抵挡不安全的网域!)

		# Iface:这个路由传递封包的接口
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值