您的位置:首页 > 其它

EIGRP的默认路由配置----四种方法实现内网访问外网

2013-04-22 22:20 951 查看
R1和R2为公司内网,R3为外网,在R1和R2上配置EIGRP,在R2和R3上配置默认路由,实验目的是用四种方法实现R1和R2内网可以访问外网R3。
[b]1.实验拓扑:[/b]




2. 配置各路由器相连接口IP地址R1(config)#int s1/0R1(config-if)#ip addR1(config-if)#ip address 10.1.1.1 255.255.252.0R1(config-if)#no shutR1(config-if)#int lo1R1(config-if)#ip adR1(config-if)#ip address 11.11.11.11 255.255.255.255 R1(config-if)#int lo2R1(config-if)#ip adR1(config-if)#ip address 172.16.9.1 255.255.255.0R1(config-if)#int lo2R1(config-if)#ip adR1(config-if)#ip address 172.16.10.1 255.255.255.0R1(config-if)#int lo3R1(config-if)#ip adR1(config-if)#ip address 172.16.11.1 255.255.255.0R1(config-if)#int lo4R1(config-if)#ip adR1(config-if)#ip address 172.16.12.1 255.255.255.0R1(config-if)#R2(config)#int s1/1R2(config-if)#ip adR2(config-if)#ip address 10.1.1.2 255.255.255.252R2(config-if)#no shutR2(config-if)#int s1/0R2(config-if)#ip adR2(config-if)#ip address 20.1.1.2 255.255.255.252R2(config-if)#no shutR2(config-if)#int lo1R2(config-if)#ip adR2(config-if)#ip address 22.22.22.22 255.255.255.255R2(config-if)#R3(config)#int s1/1R3(config-if)#ip adR3(config-if)#ip address 20.1.1.1 255.255.255.252R3(config-if)#no shutR3(config-if)#int lo1R3(config-if)#ip adR3(config-if)#ip address 33.33.33.33 255.255.255.255R3(config-if)#3.在R1R2上配置EIGRP协议,以建立内部网络。R1(config)#router eigrp 100R1(config-router)#netR1(config-router)#network 10.1.1.1 0.0.0.3R1(config-router)#network 11.11.11.11 0.0.0.0R1(config-router)#network 172.16.9.1 0.0.0.255R1(config-router)#network 172.16.10.1 0.0.0.255R1(config-router)#network 172.16.11.1 0.0.0.255R1(config-router)#network 172.16.12.1 0.0.0.255R2(config)#router eigrp 100 R2(config-router)#network 22.22.22.22 0.0.0.0 R2(config-router)#network 10.1.1.2 0.0.0.3 注意R1和R2的自治系统号两边要一至,还有在宣告网络时加入通配符可以保证哪一些端口加入到EIGRP中4.在R2查看路由表验证EIGRP邻居是否顺利建立。R2#show ip eigrp 100 neighbors IP-EIGRP neighbors for process 100H Address Interface Hold Uptime SRTT RTO Q Seq (sec) (ms) Cnt Num0 10.1.1.1 Se1/1 10 00:13:13 98 588 0 31可以看出邻居关系已经建立好了5.在R2和R3中配置默认路由R2(config)#ip route 0.0.0.0 0.0.0.0 20.1.1.1R3(config)#ip route 0.0.0.0 0.0.0.0 20.1.1.25.关闭自动汇总采用手工汇总R1(config-router)#no auto-summaryR1(config)#int s1/0R1(config-if)#ip summary-address eigrp 100 172.16.9.0 255.255.240.06.查看一下R2的路由表R2# R2# show ip route Codes: C - connected, S - static, 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 i - IS-IS, su - IS-IS summary, 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 routeGateway of last resort is 20.1.1.1 to network 0.0.0.0 20.0.0.0/30 is subnetted, 1 subnetsC 20.1.1.0 is directly connected, Serial1/0172.16.0.0/21 is subnetted, 1 subnets 路由被汇总成一条D 172.16.8.0 [90/2297856] via 10.1.1.1, 00:00:06, Serial1/1 22.0.0.0/8 is variably subnetted, 2 subnets, 2 masksC 22.22.22.22/32 is directly connected, Loopback1D 22.0.0.0/8 is a summary, 00:10:09, Null0这一条路由没有配置,是自动生成的,作用是防止路由环路 10.0.0.0/8 is variably subnetted, 2 subnets, 2 masksC 10.1.1.0/30 is directly connected, Serial1/1D 10.0.0.0/8 is a summary, 00:10:09, Null0 11.0.0.0/32 is subnetted, 1 subnetsD 11.11.11.11 [90/2297856] via 10.1.1.1, 00:01:58, Serial1/1S* 0.0.0.0/0 [1/0] via 20.1.1.17.看一下R2可不可以访问R3R2#ping 20.1.1.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 20.1.1.1, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 16/40/64 ms显然可以然后在看一下R1可不可以访问R3呢?R1#ping 20.1.1.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 20.1.1.1, timeout is 2 seconds:.....Success rate is 0 percent (0/5)显然不可以8.采用第一种方法静态路由重分布实现内网和外网可以互达9.现在在R2上配置静态路由重分布R2(config)#router eigrp 100R2(config-router)#reR2(config-router)#redistribute sR2(config-router)#redistribute static 10.在查看一下R1的路由表R1#show ip routeCodes: C - connected, S - static, 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 i - IS-IS, su - IS-IS summary, 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 routeGateway of last resort is 10.1.1.2 to network 0.0.0.0 172.16.0.0/16 is variably subnetted, 4 subnets, 2 masksC 172.16.12.0/24 is directly connected, Loopback4D 172.16.8.0/21 is a summary, 00:07:28, Null0C 172.16.10.0/24 is directly connected, Loopback2C 172.16.11.0/24 is directly connected, Loopback3D 22.0.0.0/8 [90/2297856] via 10.1.1.2, 00:09:19, Serial1/0 10.0.0.0/22 is subnetted, 1 subnetsC 10.1.0.0 is directly connected, Serial1/0 11.0.0.0/32 is subnetted, 1 subnetsC 11.11.11.11 is directly connected, Loopback1D*EX 0.0.0.0/0 [170/2681856] via 10.1.1.2, 00:01:24, Serial1/011.测试R1是否可以访问R3R1#ping 20.1.1.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 20.1.1.1, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 68/105/172 ms显然可以12.现在我们删除重分布,采用第二种方法实现R1访问外网,就是在R1上配置一条默认路由指向R2R2(config)#router eigrp 100 R2(config-router)#no redistribute static R1#ping 20.1.1.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 20.1.1.1, timeout is 2 seconds:.....Success rate is 0 percent (0/5)13.显然删除了重分布R1不可以访问R3了再在R1上配置一条默认路由指向R2R1(config)#ip route 0.0.0.0 0.0.0.0 10.1.1.2R1(config)#^ZR1#R1#ping 20.1.1.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 20.1.1.1, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 88/116/164 ms显然配置了一条默认路由,R1就可以和外网R3互通了从上面的配置,可以总结得出要解决外部网络无法访问的问题就需要给内部路由器配置默认路由指向出口路由器R2。但试想一下,如果内部路由器数量非常多的情况下,岂不是要一个个路由器地去配置一条默认路由?明显这样是很不现实的。14..现在我们删除R1的默认路由,并且使用第三种方法ip default-network的方法实现R1访问外网R1(config)#no ip route 0.0.0.0 0.0.0.0 10.1.1.2R1(config)#do ping 20.1.1.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 20.1.1.1, timeout is 2 seconds:.....显然删除了默认路由,R1就不可以和R3通信了15.现在用第三种ip default-network的方法实现R1访问外网R2(config)#router eigrp 100 R2(config-router)#netR2(config-router)#network 20.0.0.0R2(config-router)#exR2(config)#ip deR2(config)#ip default-neR2(config)#ip default-network 20.0.0.0现在查看一下R1的路由表R1#show ip route Codes: C - connected, S - static, 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 i - IS-IS, su - IS-IS summary, 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 routeGateway of last resort is 10.1.1.2 to network 20.0.0.0D* 20.0.0.0/8 [90/2681856] via 10.1.1.2, 00:01:02, Serial1/0 172.16.0.0/16 is variably subnetted, 4 subnets, 2 masksC 172.16.12.0/24 is directly connected, Loopback4D 172.16.8.0/21 is a summary, 00:26:26, Null0C 172.16.10.0/24 is directly connected, Loopback2C 172.16.11.0/24 is directly connected, Loopback3D 22.0.0.0/8 [90/2297856] via 10.1.1.2, 00:28:17, Serial1/0 10.0.0.0/22 is subnetted, 1 subnetsC 10.1.0.0 is directly connected, Serial1/0 11.0.0.0/32 is subnetted, 1 subnetsC 11.11.11.11 is directly connected, Loopback1看一下R1可不可以访问R3R1#ping 20.1.1.1 Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 20.1.1.1, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 80/119/164 ms呵呵,可以啦16.现在就差最后一种方法啦!现在用第四种方法,我们先把R2上的ip default-network配置删除了,最后进行在EIGRP上宣告net 0.0.0.0实现R1访问R3,R2(config)#router eigrp 100 R2(config-router)#netR2(config-router)#network 20.0.0.0R2(config-router)#exR2(config)#ip deR2(config)#ip default-neR2(config)#ip default-network 20.0.0.0R2(config)#no ip de R2(config)#no ip default-nR2(config)#no ip default-network 20.0.0.0R2(config)# R2(config)#router eigrp 100 R2(config-router)#no network 20.0.0.0 R1#ping 20.1.1.1Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 20.1.1.1, timeout is 2 seconds:.....Success rate is 0 percent (0/5)删除配置后,显然R1不可以与R3通信了,现在进行最后一这噢乖方法的配置R2(config)#router eigrp 100 R2(config-router)#netR2(config-router)#network 0.0.0.0R2(config-router)#ex在测试R1与R3的连通性R1#ping 20.1.1.1 Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 20.1.1.1, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 136/164/184 ms可以看出R1可以ping通R3了写到这里已经用了四种方法实现了在EIGRP和默认路由中实现内网访问外网的四种方法了,呵呵,这是我第一次写的技术文章,里面肯定有很多的不足,希望大家可以帮我指出。
呵呵,最后做一下宣传,这篇文章已经参加了中国大学生IT博客大赛,如果你觉得写得还可以的话,请去我的博客首页链接中投我一票
本文出自 “活着就是为了改变世界” 博客,请务必保留此出处http://caijingjie.blog.51cto.com/5341985/1183960
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: