yywx001 发表于 2018-7-20 13:32:16

Cisco RIP default information originate的使用及5种传递默认

ip route 0.0.0.0 0.0.0.0和default-information区别?  第一条命令是指定一个默认路由,仅在本路由器有效,其他路由器不知道有一个默认路由的存在
  default information是将这个默认路由通过IGP传播出去,任何和这个路由器属于一个IGP自治域的都会学到
  这个默认路由
  使用default-information originate,注意配置该命令的机器上不要再配置8个0
  在RIP中,默认路由采用default-information originate方式向其他路由器注入。
  

动态路由协议RIP传递默认路由的5种方法
  在一个单出口网络内启用RIP协议,在网络出口处的路由器需要向RIP域内传播一条默认路由,这样,域内的路由器就可以通过默认路由访问外部网络。下面我们就用试验来模拟这个环境。到目前为止;通过RIP传递默认路由共有5种方法。
  
1 default-information
  
2 手工写一条默认路由(到NULL0) 然后重分布到RIP中
  
3 手工写一条默认路由(到NULL0) 在进程中宣告
  
4 ip default-network
  
5 在接口汇总 0.0.0.0/0 到NULL0的路由
  

  
***************************************************************************************************************
  
一 路由器基本配置
  
R1
  
interface Loopback0
  
ip address 1.1.1.1 255.255.255.0
  
interface Serial1/0
  
ip address 12.0.0.1 255.255.255.0
  
router rip
  
version 2
  
network 1.0.0.0
  
network 12.0.0.0
  
no auto-summary
  
------------------
  
R2
  
interface Serial1/0
  
ip address 12.0.0.2 255.255.255.0
  
interface Serial1/1
  
ip address 23.0.0.2 255.255.255.0
  
router rip
  
version 2
  
network 2.0.0.0
  
network 12.0.0.0
  
no auto-summary
  
------------------
  
R3
  
interface Serial1/0
  
ip address 23.0.0.3 255.255.255.0
  
**************************************************************************************************************
  
二 方法1 default-information
  
r2#sh run | b r r
  
router rip
  
version 2
  
network 2.0.0.0
  
network 12.0.0.0
  
default-information originate
  
no auto-summary
  
r1#sh ip rou
  

  
1.0.0.0/24 is subnetted, 1 subnets
  
C   1.1.1.0 is directly connected, Loopback0
  
12.0.0.0/24 is subnetted, 1 subnets
  
C   12.0.0.0 is directly connected, Serial1/0
  
R* 0.0.0.0/0 via 12.0.0.2, 00:00:09, Serial1/0 /可以看到这时在R1上产生了一条默认路由
  
r1#ping 23.0.0.2
  
Type 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-map
  
R2
  
access-list 1 permit 2.2.2.2
  

  
route-map WY permit 10
  
match ip address 1
  

  
r2#sh run | b r r
  

  
router rip
  
version 2
  
network 2.0.0.0
  
network 12.0.0.0
  
default-information originate route-map WY
  
no auto-summary
  
r1#sh ip rou
  
1.0.0.0/24 is subnetted, 1 subnets
  
C   1.1.1.0 is directly connected, Loopback0
  
2.0.0.0/32 is subnetted, 1 subnets
  
R   2.2.2.2 via 12.0.0.2, 00:00:02, Serial1/0
  
12.0.0.0/24 is subnetted, 1 subnets
  
C   12.0.0.0 is directly connected, Serial1/0
  
R* 0.0.0.0/0 via 12.0.0.2, 00:00:02, Serial1/0 /这时R2向R1传递了一条默认路由
  
r2(config)#int lo0
  
r2(config-if)#shutdown /这时我们将loopback接口关闭
  
r1#sh ip rou
  

  
1.0.0.0/24 is subnetted, 1 subnets
  
C   1.1.1.0 is directly connected, Loopback0
  
12.0.0.0/24 is subnetted, 1 subnets
  
C   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 e
  
router eigrp 90
  
network 23.0.0.0 0.0.0.255
  
no auto-summary
  
r3#sh run | b r e
  
router eigrp 90
  
network 3.3.3.0 0.0.0.255
  
network 23.0.0.0 0.0.0.255
  
no auto-summary
  
r2#sh ip rou
  
1.0.0.0/24 is subnetted, 1 subnets
  
R   1.1.1.0 via 12.0.0.1, 00:00:05, Serial1/0
  
2.0.0.0/32 is subnetted, 1 subnets
  
C   2.2.2.2 is directly connected, Loopback0
  
3.0.0.0/24 is subnetted, 1 subnets
  
D   3.3.3.0 via 23.0.0.3, 00:01:42, Serial1/1
  
23.0.0.0/24 is subnetted, 1 subnets
  
C   23.0.0.0 is directly connected, Serial1/1
  
12.0.0.0/24 is subnetted, 1 subnets
  
C   12.0.0.0 is directly connected, Serial1/0
  

  
R2
  
access-list 1 permit 3.3.3.0 0.0.0.255
  

  
route-map WY permit 10
  
match ip address 1
  
R2
  
router rip
  
version 2
  
network 12.0.0.0
  
default-information originate route-map WY
  
no auto-summary
  
r1#sh ip rou
  
1.0.0.0/24 is subnetted, 1 subnets
  
C   1.1.1.0 is directly connected, Loopback0
  
12.0.0.0/24 is subnetted, 1 subnets
  
C   12.0.0.0 is directly connected, Serial1/0
  
R* 0.0.0.0/0 via 12.0.0.2, 00:00:01, Serial1/0 /这时R2向R1传递一条默认路由
  
r3(config)#int lo0
  
r3(config-if)#shutdown /在R3上关闭这个loopback接口
  
r1#sh ip rou
  

  
1.0.0.0/24 is subnetted, 1 subnets
  
C   1.1.1.0 is directly connected, Loopback0
  
12.0.0.0/24 is subnetted, 1 subnets
  
C   12.0.0.0 is directly connected, Serial1/0
  
R2不再向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 rou
  
1.0.0.0/24 is subnetted, 1 subnets
  
C   1.1.1.0 is directly connected, Loopback0
  
12.0.0.0/24 is subnetted, 1 subnets
  
C   12.0.0.0 is directly connected, Serial1/0
  
R* 0.0.0.0/0 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 0
  
r2#sh run | b r r
  
router rip
  
version 2
  
network 12.0.0.0
  
network 0.0.0.0 /将这条默认路由宣告到R2的RIP进程中
  
no auto-summary
  
r1#sh ip rou
  
1.0.0.0/24 is subnetted, 1 subnets
  
C   1.1.1.0 is directly connected, Loopback0
  
12.0.0.0/24 is subnetted, 1 subnets
  
C   12.0.0.0 is directly connected, Serial1/0
  
R* 0.0.0.0/0 via 12.0.0.2, 00:00:07, Serial1/0 /R2向R1传递默认路由
  
-----------------------------------------
  
方法4 ip default-network
  
r2(config)#ip default-network 23.0.0.0 /建立一个缺省网络
  
r1#sh ip rou
  

  
1.0.0.0/24 is subnetted, 1 subnets
  
C   1.1.1.0 is directly connected, Loopback0
  
12.0.0.0/24 is subnetted, 1 subnets
  
C   12.0.0.0 is directly connected, Serial1/0
  
R* 0.0.0.0/0 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/0
  

  
interface Serial1/0
  
ip address 12.0.0.2 255.255.255.0
  
ip summary-address rip 0.0.0.0 0.0.0.0 /在接口上手工汇总这条默认路由
  

  
r1#sh ip rou
  
1.0.0.0/24 is subnetted, 1 subnets
  
C   1.1.1.0 is directly connected, Loopback0
  
12.0.0.0/24 is subnetted, 1 subnets
  
C   12.0.0.0 is directly connected, Serial1/0
  
R* 0.0.0.0/0 via 12.0.0.2, 00:00:09, Serial1/0 /R2向R1传递默认路由
  
通过本次试验,我们了解了几种向RIP域中传递默认路由的几种方法。希望还能找到其它方法
页: [1]
查看完整版本: Cisco RIP default information originate的使用及5种传递默认