RIP传递默认路由的5种方法
- 格式:doc
- 大小:91.00 KB
- 文档页数:8
RIP传递默认路由的5种方法wangyang 发表于 2007-1-17 12:26:49在一个单出口网络内启用RIP协议,在网络出口处的路由器需要向RIP域内传播一条默认路由,这样,域内的路由器就可以通过默认路由访问外部网络。
下面我们就用试验来模拟这个环境。
到目前为止;通过RIP传递默认路由共有5种方法。
1 default-information2 手工写一条默认路由(到NULL0)然后重分布到RIP中3 手工写一条默认路由(到NULL0)在进程中宣告4 ip default-network5 在接口汇总 0.0.0.0/0 到NULL0的路由********************************************************************* ******************************************一路由器基本配置R1interface Loopback0ip address 1.1.1.1 255.255.255.0interface Serial1/0ip address 12.0.0.1 255.255.255.0router ripversion 2network 1.0.0.0network 12.0.0.0no auto-summary------------------R2interface Serial1/0ip address 12.0.0.2 255.255.255.0interface Serial1/1ip address 23.0.0.2 255.255.255.0router ripversion 2network 2.0.0.0network 12.0.0.0no auto-summary------------------R3interface Serial1/0ip address 23.0.0.3 255.255.255.0********************************************************************* *****************************************二方法1default-informationr2#sh run | b r rrouter ripversion 2network 2.0.0.0network 12.0.0.0default-information originateno auto-summaryr1#sh ip rou1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback012.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, Serial1/0R* 0.0.0.0/0 [120/1] via 12.0.0.2, 00:00:09, Serial1/0 /可以看到这时在R1上产生了一条默认路由r1#ping 23.0.0.2Type escape sequence to abort.Sending 5, 100-byte ICMP Echos to 23.0.0.2, timeout is 2 seconds:!!!!!Success rate is 100 percent (5/5), round-trip min/avg/max = 28/41/68 ms ----------------------------------------此外,在default-information originate可以调用一个route-map来匹配一个接口或路由,当这个路由有效的时候才会传递默认路由。
首先我们在R2上建立一个loopback接口,并将它宣告到RIP中,然后用ACL来匹配这个接口,建立route-map调用这个ACL,最后在default-information originate命令后调用这个route-mapR2access-list 1 permit 2.2.2.2route-map WY permit 10match ip address 1r2#sh run | b r rrouter ripversion 2network 2.0.0.0network 12.0.0.0default-information originate route-map WYno auto-summaryr1#sh ip rou1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback02.0.0.0/32 is subnetted, 1 subnetsR 2.2.2.2 [120/1] via 12.0.0.2, 00:00:02, Serial1/012.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, Serial1/0R* 0.0.0.0/0 [120/1] via 12.0.0.2, 00:00:02, Serial1/0 /这时R2向R1传递了一条默认路由r2(config)#int lo0r2(config-if)#shutdown /这时我们将loopback接口关闭r1#sh ip rou1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback012.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, Serial1/0这时,R2不向R1传递默认路由,因为loopback接口关闭,ACL失效,route-map 失效,所以 default-information originate命令不执行-----------------------------------------下面我们在R2,R3之间启用EIGRP,在R3上起一个loopback接口,并宣告到EIGRP中,这时R2可以学习到3.3.3.0,在R2上建立ACL匹配从R3学习到的这条路由,随后建立route-map并调用ACL,同样最后在R2的RIP进程中的default-information originate命令后面调用这个route-map。
r2#sh run | b r erouter eigrp 90network 23.0.0.0 0.0.0.255no auto-summaryr3#sh run | b r erouter eigrp 90network 3.3.3.0 0.0.0.255network 23.0.0.0 0.0.0.255no auto-summaryr2#sh ip rou1.0.0.0/24 is subnetted, 1 subnetsR 1.1.1.0 [120/1] via 12.0.0.1, 00:00:05, Serial1/02.0.0.0/32 is subnetted, 1 subnetsC 2.2.2.2 is directly connected, Loopback03.0.0.0/24 is subnetted, 1 subnetsD 3.3.3.0 [90/2297856] via 23.0.0.3, 00:01:42, Serial1/123.0.0.0/24 is subnetted, 1 subnetsC 23.0.0.0 is directly connected, Serial1/112.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, Serial1/0R2access-list 1 permit 3.3.3.0 0.0.0.255route-map WY permit 10match ip address 1R2router ripversion 2network 12.0.0.0default-information originate route-map WYno auto-summaryr1#sh ip rou1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback012.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, Serial1/0R* 0.0.0.0/0 [120/1] via 12.0.0.2, 00:00:01, Serial1/0 /这时R2向R1传递一条默认路由r3(config)#int lo0r3(config-if)#shutdown /在R3上关闭这个loopback接口r1#sh ip rou1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback012.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, Serial1/0R2不再向R1传递默认路由,同样因为loopback接口失效,导致default-information originate命令不执行-----------------------------------------方法2 手工写一条默认路由(到NULL0)然后重分布到RIP中r2(config)#ip route 0.0.0.0 0.0.0.0 null 0 /在R2上建立一条默认路由r2(config-router)#redistribute static /重分布静态路由到RIP中r1#sh ip rou1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback012.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, Serial1/0R* 0.0.0.0/0 [120/1] via 12.0.0.2, 00:00:02, Serial1/0 /这时,R2向R1传递一条默认路由-----------------------------------------方法3 手工写一条默认路由(到NULL0)在进程中宣告r2(config)#ip route 0.0.0.0 0.0.0.0 null 0r2#sh run | b r rrouter ripversion 2network 12.0.0.0network 0.0.0.0 /将这条默认路由宣告到R2的RIP进程中no auto-summaryr1#sh ip rou1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback012.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, Serial1/0R* 0.0.0.0/0 [120/1] via 12.0.0.2, 00:00:07, Serial1/0 /R2向R1传递默认路由-----------------------------------------方法4 ip default-networkr2(config)#ip default-network 23.0.0.0 /建立一个缺省网络r1#sh ip rou1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback012.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, Serial1/0R* 0.0.0.0/0 [120/1] via 12.0.0.2, 00:00:09, Serial1/0 /R2向R1传递默认路由-----------------------------------------方法5 在接口汇总 0.0.0.0/0 到NULL0的路由r2(config)#ip route 0.0.0.0 0.0.0.0 null 0 /先建立一条默认路由r2#sh run int s1/0interface Serial1/0ip address 12.0.0.2 255.255.255.0ip summary-address rip 0.0.0.0 0.0.0.0 /在接口上手工汇总这条默认路由r1#sh ip rou1.0.0.0/24 is subnetted, 1 subnetsC 1.1.1.0 is directly connected, Loopback012.0.0.0/24 is subnetted, 1 subnetsC 12.0.0.0 is directly connected, Serial1/0R* 0.0.0.0/0 [120/1] via 12.0.0.2, 00:00:09, Serial1/0 /R2向R1传递默认路由通过本次试验,我们了解了几种向RIP域中传递默认路由的几种方法。