【route】管理本地路由信息
#route 直接使用可以查看本地路由表
route add -net|-host DEST gw NEXTHOP //添加指定路由
route add default NEXTHOP //添加默认路由
参数:
【add】添加
-host:主机路由(到某个主机)
-net:网络路由(到某个网络)
例如:
route add -net 10.0.0.0/8 gw 192.168.0.118
路由一个网络10.0.0.0子掩码为8位,通过192.168.0.118到达,其中gw表示网关是谁
【del】删除
-host:
-net:
例如:
route del -net 10.0.0.0/8
删除指定路由
route del -net 0.0.0.0
删除默认路由
或者 route del default
也可以删除默认路由
route add default gw 192.168.0.118 添加默认路由
(所做出的改动重启网络或主机后就失效)
查看:
route -n :以数字方式显示各主机端口等相关信息
路由:
/etc/sysconfig/network-scripts/route-ethX
添加格式一:
DEST via NEXTHOP
格式二:
ADDRESS0=目标地址
NETMASK0=子网掩码
GATEWAY0=网关
(第二总格式可以添加多种)
DNS服务器指定方法只有一种:编辑/etc/resolv.conf
nameserver DNS_IP_1
nameserver DNS_IP_2
指定本地解析:
/etc/hosts
DNS-->/ets/hosts---->DNS
===================附加===================4
[root@gdy ftpftp]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
10.0.0.0 192.168.0.118 255.0.0.0 UG 0 0 0 eth0
default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
[root@gdy ftpftp]#
其中:
【Destination】到达目标
【Gateway】通过的目标
【Genmask】路由器的网络掩码
【Flags】启用状态
U:本地网络
G:表示网络路由
【route】管理本地路由信息
原创
©著作权归作者所有:来自51CTO博客作者带着梦想飞翔的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
linux route 添加路由
linux route 添加路由
linux route 添加路由 -
【网络】route和 IP route的区别|route 和 IP route 添加路由
route是一个相当简单的工具,非常适合创建静态路由。
网络 tcp/ip 服务器 路由表 重启 -
什么是路由(route)?
在web开发中,“route”是指根据url分配到对应的处理程序。✔路
java vue router 路由 服务器 -
linux route路由
网关(Gateway)又称网间连接器、协议转...
路由表 封包 ip地址 重启 协议转换