您好,欢迎来到爱go旅游网。
搜索
您的当前位置:首页静态路由和默认路由配置

静态路由和默认路由配置

来源:爱go旅游网
静态路由和默认路由

默认路由是一种特殊的静态路由,指的是当路由表中与包的目的地址之间没有匹配的表项时路由器能够做出的选择.如果没有默认路由,那么目的地址在路由表中没有匹配表项的包将被丢弃. 默认路由在某些时候非常有效,当存在末梢网络时,默认路由会大大简化路由器的配置,减轻管理员的工作负担,提高网络性能。 默认路由配置方法

R0R2R1

默认路由的命令:

Ip route 0.0.0.0 0.0.0.0 下一跳路由地址 其中0.0.0.0 0.0.0.0 表述任意网络地址

具体配置

R0:配置默认路由

Router> Router> Router>en Router#conf t

Router(config)#hostname R0 //更改路由器的名字为R0

R0(config)#ip route 0.0.0.0 0.0.0.0 192.168.20.2 //配置静态路由 R0(config)#end R0#

%SYS-5-CONFIG_I: Configured from console by console R0#show ip route //查看路由信息

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route

Gateway of last resort is 192.168.20.2 to network 0.0.0.0

C 192.168.10.0/24 is directly connected, FastEthernet0/0 C 192.168.20.0/24 is directly connected, FastEthernet0/1 S* 0.0.0.0/0 [1/0] via 192.168.20.2 R0#

R2上的具体配置命令 Router>en Router#conf t

Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R2

R2(config)#ip route 0.0.0.0 0.0.0.0 192.168.30.1 R2(config)#end R2#

%SYS-5-CONFIG_I: Configured from console by console R2#show ip route

Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2 E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area * - candidate default, U - per-user static route, o - ODR P - periodic downloaded static route

Gateway of last resort is 192.168.30.1 to network 0.0.0.0

C 192.168.30.0/24 is directly connected, FastEthernet0/0 C 192.168.40.0/24 is directly connected, FastEthernet0/1 S* 0.0.0.0/0 [1/0] via 192.168.30.1 R2#

R1上配置静态路由 Router>en Router#conf t

Enter configuration commands, one per line. End with CNTL/Z. Router(config)#hostname R1

R1(config)#ip route 192.168.10.0 255.255.255.0 192.168.20.1 R1(config)#ip route 192.168.40.0 255.255.255.0 192.168.30.2 R1(config)# 测试

在pc0 上ping 192.168.40.1,验证结果通。

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- igat.cn 版权所有 赣ICP备2024042791号-1

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务