route命令详解,注意是详解!!
Options: -d Do not resolve addresses to hostnames. -h maximum_hops Maximum number of hops to search for target. -j host-list Loose source route along host-list (IPv4-only). -w timeout Wait timeout milliseconds for each reply. -R Trace round-trip path (IPv6-only). -S srcaddr Source address to use (IPv6-only). -4 Force using IPv4. -6 Force using IPv6. Tracert命令详解 该诊断实用程序将包含不同生存时间 (TTL) 值的 Internet 控制消息协议 (ICMP) 回显数据包发送到目标,以决定到达目标采用的路由。要在转发数据包上的 TTL 之前至少递减 1,必需路径上的每个路由器,所以 TTL 是有效的跃点计数。数据包上的 TTL 到达 0 时,路由器应该将“ICMP 已超时”的消息发送回源系统。Tracert 先发送 TTL 为 1 的回显数据包,并在随后的每次发送过程将 TTL 递增 1,直到目标响应或 TTL 达到最大值,从而确定路由。路由通过检查中级路由器发送回的“ICMP 已超时”的消息来确定路由。不过,有些路由器悄悄地下传包含过期 TTL 值的数据包,而 tracert 看不到。 tracert [-d] [-h maximum_hops] [-j computer-list] [-w timeout] target_name 使用 tracert 跟踪网络连接 Tracert(跟踪路由)是路由跟踪实用程序,用于确定 IP 数据报访问目标所采取的路径。Tracert 命令用 IP 生存时间 (TTL) 字段和 ICMP 错误消息来确定从一个主机到网络上其他主机的路由。 Tracert 工作原理 通过向目标发送不同 IP 生存时间 (TTL) 值的“Internet 控制消息协议 (ICMP)”回应数据包,Tracert 诊断程序确定到目标所采取的路由。要求路径上的每个路由器在转发数据包之前至少将数据包上的 TTL 递减 1。数据包上的 TTL 减为 0 时,路由器应该将“ICMP 已超时”的消息发回源系统。 Tracert 先发送 TTL 为 1 的回应数据包,并在随后的每次发送过程将 TTL 递增 1,直到目标响应或 TTL 达到最大值,从而确定路由。通过检查中间路由器发回的“ICMP 已超时”的消息确定路由。某些路由器不经询问直接丢弃 TTL 过期的数据包,这在 Tracert 实用程序中看不到。 Tracert 命令按顺序打印出返回“ICMP 已超时”消息的路径中的近端路由器接口列表。如果使用 -d 选项,则 Tracert 实用程序不在每个 IP 地址上查询 DNS。 在下例中,数据包必须通过两个路由器(10.0.0.1 和 192.168.0.1)才能到达主机 172.16.0.99。主机的默认网关是 10.0.0.1,192.168.0.0 网络上的路由器的 IP 地址是 192.168.0.1。 C:>tracert 172.16.0.99 -d Tracing route to 172.16.0.99 over a maximum of 30 hops 1 2s 3s 2s 10,0.0,1 2 75 ms 83 ms 88 ms 192.168.0.1 3 73 ms 79 ms 93 ms 172.16.0.99 Trace complete. 用 tracert 解决问题 可以使用 tracert 命令确定数据包在网络上的停止位置。下例中,默认网关确定 192.168.10.99 主机没有有效路径。这可能是路由器配置的问题,或者是 192.168.10.0 网络不存在(错误的 IP 地址)。 C:>tracert 192.168.10.99 Tracing route to 192.168.10.99 over a maximum of 30 hops 1 10.0.0.1 reports:Destination net unreachable. Trace complete. Tracert 实用程序对于解决大网络问题非常有用,此时可以采取几条路径到达同一个点。 Tracert 命令行选项 Tracert 命令支持多种选项,如下表所示。 tracert [-d] [-h maximum_hops] [-j host-list] [-w timeout] target_name -d 指定不将 IP 地址解析到主机名称。 -h maximum_hops 指定跃点数以跟踪到称为 target_name 的主机的路由。 -j host-list 指定 Tracert 实用程序数据包所采用路径中的路由器接口列表。 -w timeout 等待 timeout 为每次回复所指定的毫秒数。 target_name 目标主机的名称或 IP 地址。 使用 tracert 命令跟踪路径 打开 命令提示符,然后键入: tracert host_name 或者键入 tracert ip_address 其中 host_name 或 ip_address 分别是远程计算机的主机名或 IP 地址。 例如,要跟踪从该计算机到 [url] www.microsoft.com[/url] 的连接路由,请在命令提示行键入: tracert [url]www.microsoft.com [/url] 注意 要打开“命令提示符”,请单击“开始”,指向“程序”、“附件”,然后单击“命令提示符”。 tracert 命令跟踪 TCP/IP 数据包从该计算机到其他远程计算机所采用的路径。tracert 命令使用 ICMP 响应请求并答复消息(和 ping 命令类似),产生关于经过的每个路由器及每个跃点的往返时间 (RTT) 的命令行报告输出。 如果 tracert 失败,可以使用命令输出来帮助确定哪个中介路由器转发失败或耗时太多。 参数 /d 指定不将地址解析为计算机名。 -h maximum_hops 指定搜索目标的最大跃点数。 -j computer-list 指定沿 computer-list 的稀疏源路由。 -w timeout 每次应答等待 timeout 指定的微秒数。 target_name 目标计算机的名称
Route 命令详解 在本地 IP 路由表中显示和修改条目。语法route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]参数-f清除所有不是主路由(网掩码为 255.255.255.255 的路由)、环回网络路由(目标为 127.0.0.0,网掩码为 255.255.255.0 的路由)或多播路由(目标为 224.0.0.0,网掩码为 240.0.0.0 的路由)的条目的路由表。如果它与命令之一(例如 add、change 或 delete)结合使用,表会在运行命令之前清除。-p 与 add 命令共同使用时,指定路由被添加到注册表并在启动 TCP/IP 协议的时候初始化 IP 路由表。默认情况下,启动 TCP/IP 协议时不会保存添加的路由。与 print 命令一起使用时,则显示永久路由列表。所有其它的命令都忽略此参数。永久路由存储在注册表中的位置是 HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParametersPersistentRoutes。
route命令主要用于手动配置静态路由表 例:增加一条通过网关到达令一子网的路由#route add net remote_net_ip gateway_ip 1其中add代表要增加路由,net表示路由到达的是一个网络而不是一台主机,1代表远端网络需通过网关才能到达(直接通过网络接口相连时,该参数用0)命令格式:#route add -net remote_net_ip gateway_ip -netmask netmask#route add -host host_ip local_interface_ip -interface使用"delete","change"命令参数可以对路由表中的路由信息进行删除和修改使用"netstat -rn"命令查看当前的路由信息 过修改文件/etc/defaultrouter可以设置一些默认路由

锐捷的 ip route 命令的含义
设置静态路由用的 IP ROUTE后面的第一个IP地址和掩码表示目的地址,后面一个IP地址表示经过的吓一跳路由器的IP地址
ip route 静态路由设置。后面跟要公布的ip网段,掩码,下一跳地址(直连的下个路由器的接口IP地址),所以这3个是3个静态路由。
Switch> Switch>Switch>Switch>enSwitch>enableSwitch#confSwitch#configure terSwitch#configure terminalEnter configuration commands, one per line.End with CNTL/Z.Switch(config)#ip routiSwitch(config)#ip routingSwitch(config)#intSwitch(config)#interface fSwitch(config)#interface fastEthernet 0/24Switch(config-if)#no swSwitch(config-if)#no switchportSwitch(config-if)#ip adSwitch(config-if)#ip address 172.16.50.1 255.255.255.0Switch(config-if)#no shSwitch(config-if)#no shutdownSwitch(config-if)#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#configure terminalEnter configuration commands, one per line.End with CNTL/Z.Switch(config)#intSwitch(config)#interface fSwitch(config)#interface fastEthernet 0/1Switch(config-if)#no swSwitch(config-if)#no switchportSwitch(config-if)#ip adSwitch(config-if)#ip address 172.16.10.1 255.255.255.0Switch(config-if)#no shSwitch(config-if)#no shutdownSwitch(config-if)#我使用的方法是物理端口法,还有一个叫SVLSwitch>Switch>Switch>Switch>enSwitch>enableSwitch#confSwitch#configure terSwitch#configure terminalEnter configuration commands, one per line.End with CNTL/Z.Switch(config)#vlSwitch(config)#vlan 50Switch(config-vlan)#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#configure terminalEnter configuration commands, one per line.End with CNTL/Z.Switch(config)#vlan 10Switch(config-vlan)#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#configure terminalEnter configuration commands, one per line.End with CNTL/Z.Switch(config)#intSwitch(config)#interface fSwitch(config)#interface fastEthernet 0/24Switch(config-if)#swSwitch(config-if)#switchport acSwitch(config-if)#switchport access vlSwitch(config-if)#switchport access vlan 50Switch(config-if)#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#configure terminalEnter configuration commands, one per line.End with CNTL/Z.Switch(config)#intSwitch(config)#interface fSwitch(config)#interface fastEthernet 0/1Switch(config-if)#swSwitch(config-if)#switchport acSwitch(config-if)#switchport access vlSwitch(config-if)#switchport access vlan 10Switch(config-if)#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#configure terminalEnter configuration commands, one per line.End with CNTL/Z.Switch(config)#intSwitch(config)#interface vlSwitch(config)#interface vlan 50%LINK-5-CHANGED: Interface Vlan50, changed state to upSwitch(config-if)#ip adSwitch(config-if)#ip address 172.16.50.1 255.255.255.0Switch(config-if)#nos hSwitch(config-if)#nos h^% Invalid input detected at '^' marker.Switch(config-if)#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#configure terminalEnter configuration commands, one per line.End with CNTL/Z.Switch(config)#interface vlan 50Switch(config-if)#no shSwitch(config-if)#no shutdownSwitch(config-if)#%SYS-5-CONFIG_I: Configured from console by consoleSwitch#configure terminalEnter configuration commands, one per line.End with CNTL/Z.Switch(config)#intSwitch(config)#interface fSwitch(config)#interface vlSwitch(config)#interface vlan 10%LINK-5-CHANGED: Interface Vlan10, changed state to upSwitch(config-if)#ip adSwitch(config-if)#ip address 172.16.10.1 255.255.255.0Switch(config-if)#no sSwitch(config-if)#no shutdownSwitch(config-if)#三层和路由设备连接就这两种方法,而后的话就用路由协议了,在使用在三层上用静态路由的时候,有个注意事项,使用的是下一跳地址,如Switch(config)#ip route 172.16.60.0 255.255.255.0 172.16.50.2 在使用动态协议的时候,大体上一样,
设置路由的
加路由

5. Route命令的主要功能是什么?有那些主要参数?各个参数的作用是什么?
Route 命令详解 在本地 IP 路由表中显示和修改条目。语法route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]参数-f清除所有不是主路由(网掩码为 255.255.255.255 的路由)、环回网络路由(目标为 127.0.0.0,网掩码为 255.255.255.0 的路由)或多播路由(目标为 224.0.0.0,网掩码为 240.0.0.0 的路由)的条目的路由表。如果它与命令之一(例如 add、change 或 delete)结合使用,表会在运行命令之前清除。-p 与 add 命令共同使用时,指定路由被添加到注册表并在启动 TCP/IP 协议的时候初始化 IP 路由表。默认情况下,启动 TCP/IP 协议时不会保存添加的路由。与 print 命令一起使用时,则显示永久路由列表。所有其它的命令都忽略此参数。永久路由存储在注册表中的位置是 HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesTcpipParametersPersistentRoutes。

这个命令的详细讲解 ip route 0.0.0.0 0.0.0.0 172.19.0.254,谢谢
前面的4个0是表示任意网络,后面4个0是任意掩码,整条命令的意思就是去往任意网络的流量都发往172.19.0.254这个地址。 你可以写某个网段,比如去网10.0.0.0子网掩码255.255.255.0的网关是172.19.0.254那就可以写成:iproute10.0.0.0255.0.0.0 172.19.0.254

show ip router, 麻烦详细解释一下这个命令
英文上面的解释已经很详细了。。 C是直连路由,D是EIGRP路由,O IA是OSPF路由。建议,寻找一本NP的书来看看。。 你就明白了。
应该是Show ip route 而不是 show ip router 该路由器所能到达的目标网段以及到达目标网段的下一跳。
查看路由配置

本文由 在线网速测试 整理编辑,转载请注明出处,原文链接:https://www.wangsu123.cn/news/43398.html。