H3C RIP实验大集合

 

实验目录:

1.RIP基本实验

2.水平分割

3.毒化逆转

4.被动接口--包含计时器的信息

5.允许接口接受或发送RIP信息

6.RIP优先级

7.设置接口接收或发送RIP 报文时给路由增加的附加路由权值(条数)

8.Time的三大计时器设置

9.不同进程号

10.触发跟新

11.RIP 的版本兼容问题

12.不连续子网

13.手工汇总

14.rip内注入一跳默认路由

15.RIPv2认证

16.直连的网络不再同一网段

 

 

 

 

一.RIP基本配置

实验要求:各个路由器能动态学到路由

实验拓扑:

实验过程:

1.按照上面的拓扑配置ip地址

2.宣告网络

[R1]rip                                      //进入RIP视图(默认计入的RIP进程1

[R1-rip-1]network 192.168.1.0                  //宣告网络

[R1-rip-1]net 1.1.1.0

[R1-rip-1]q

 

[R2]rip   

[R2-rip-1]network 192.168.1.0

[R2-rip-1]network 192.168.2.0

[R2-rip-1]network 2.2.2.0   

[R2-rip-1]network 3.3.3.0

[R2-rip-1]q

 

[R3]rip

[R3-rip-1]network 192.168.2.0

[R3-rip-1]network 4.4.4.0

[R3-rip-1]q

 

3.RIP的几个查看命令

查看所有路由

[R1]display ip routing-table

Routing Tables: Public

        Destinations : 10       Routes : 10

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

1.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0

2.0.0.0/8           RIP    100  1           192.168.1.2     S0/2/0

3.0.0.0/8           RIP    100  1           192.168.1.2     S0/2/0

4.0.0.0/8           RIP    100  2           192.168.1.2     S0/2/0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

192.168.1.0/24      Direct 0    0            192.168.1.1     S0/2/0

192.168.1.1/32      Direct 0    0            127.0.0.1       InLoop0

192.168.1.2/32      Direct 0    0            192.168.1.2     S0/2/0

192.168.2.0/24      RIP    100  1            192.168.1.2     S0/2/0

 

 

查看RIP进程信息

[R1]display rip

  Public VPN-instance name :    

 

    RIP process : 1                 //进程号

       RIP version : 1              //版本

       Preference : 100             //优先级

       Checkzero [高1] : Enabled        

       Default-cost : 0             //默认度量值,可以调整网络大小

       Summary : Enabled         //自动汇总开启

       Hostroutes[高2]  : Enabled

       Maximum number of balanced paths : 6        //支持的负载分担条数

       Update time   :   30 sec(s)  Timeout time         :  180 sec(s)

       Suppress time :  120 sec(s)  Garbage-collect time :  120 sec(s)

       TRIP retransmit time :    5 sec(s)

       TRIP response packets retransmit count :   36

       Silent interfaces : None            //有没有被动接口

       Default routes : Disabled           //有没有默认路由

       Verify-source : Enabled

       Networks :

           1.0.0.0                192.168.1.0   

       Configured peers : None

       Triggered updates sent : 0

       Number of routes changes : 0

       Number of replies to queries : 0

 

 

查看RIP 协议的路由

[R1]display ip routing-table protocol rip

Public Routing Table : RIP

Summary Count : 4

 

RIP Routing table Status : < Active>

Summary Count : 4

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

2.0.0.0/8           RIP    100  1            192.168.1.2     S0/2/0

3.0.0.0/8           RIP    100  1            192.168.1.2     S0/2/0

4.0.0.0/8           RIP    100  2            192.168.1.2     S0/2/0

192.168.2.0/24      RIP    100  1            192.168.1.2     S0/2/0

 

RIP Routing table Status : < Inactive>

Summary Count : 0

 

 

查看路由的跟新时间等

[R1]display rip 1 route

 Route Flags: R - RIP, T - TRIP

              P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect

 ----------------------------------------------------------------------------

 Peer 192.168.1.2  on Serial0/2/0

      Destination/Mask        Nexthop     Cost    Tag   Flags   Sec

          2.0.0.0/8        192.168.1.2      1       0    RA[高3]      22

          3.0.0.0/8        192.168.1.2      1       0    RA     22

      192.168.2.0/24       192.168.1.2      1       0    RA     22

          4.0.0.0/8        192.168.1.2      2       0    RA     22

 

 

 

查看RIP接口,包括度量值、水平分割是否开启

[R1]display rip 1 interface

 

 Interface-name: LoopBack0

    Address/Mask:1.1.1.1/32          Version:RIPv1       

    MetricIn:0                       MetricIn route policy:Not designated

    MetricOut:1                      MetricOut route policy:Not designated

    Split-horizon/Poison-reverse:on/off  Input/Output:on/on [高4] 

    Current packets number/Maximum packets number:0/2000

 

 Interface-name: Serial0/2/0

    Address/Mask:192.168.1.1/24      Version:RIPv1      

    MetricIn:0                       MetricIn route policy:Not designated

    MetricOut:1                      MetricOut route policy:Not designated

    Split-horizon/Poison-reverse:on/off  Input/Output:on/on 

    Current packets number/Maximum packets number:0/2000

 

从此命令可以看出,水平分割时开启的,而毒化逆转时关闭的。

 

 

 

二.水平分割

通常情况下,为了防止路由环的出现,水平分割都是必要的。只是在某些特殊情况

下,为保证协议的正确执行,需要关闭水平分割。例如在NBMA 网络中,对于采用

帧中继封装的主接口和点对多点子接口,为了使接口可以发送从该接口学到的路由,

则需要禁止水平分割。在关闭水平分割时一定要确认是否必要。

 

关闭水平分割的命令

[R1]int s0/2/0

[R1-Serial0/2/0]un rip split-horizon

 

我们来测试一下水平分割的影响

开启了水平分割

<R1>terminal monitor

% Current terminal monitor is on

 

<R1>terminal debugging

% Current terminal debugging is on

 

<R1>debugging rip 1 packet

 

 

*Dec  2 16:21:44:16 2010 R1 RM/6/RMDEBUG: RIP 1 : Receive response[高5]  from 192.168.1.2 on Serial0/2/0

*Dec  2 16:21:44:16 2010 R1 RM/6/RMDEBUG:   Packet : vers 1, cmd response, length 84

*Dec  2 16:21:44:16 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 2.0.0.0, cost 1

*Dec  2 16:21:44:16 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 3.0.0.0, cost 1

*Dec  2 16:21:44:16 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 4.0.0.0, cost 2

*Dec  2 16:21:44:16 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 192.168.2.0, cost 1

*Dec  2 16:21:45:812 2010 R1 RM/6/RMDEBUG: RIP 1 : Sending response on interface Serial0/2/0 from 192.168.1.1 to 255.255.255.255

*Dec  2 16:21:45:812 2010 R1 RM/6/RMDEBUG:   Packet : vers 1, cmd response, length 24

*Dec  2 16:21:45:812 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 1.0.0.0, cost 1

从上面我们可以看出,RIP包没有向自己宣告的网络发送跟新包!--这是水平分割起的作用!

 

关闭了水平分割

<R1>debugging rip 1 packet 

*Dec  2 16:26:49:844 2010 R1 RM/6/RMDEBUG: RIP 1 : Receive response from 192.168.1.2 on Serial0/2/0

*Dec  2 16:26:49:844 2010 R1 RM/6/RMDEBUG:   Packet : vers 1, cmd response, length 84

*Dec  2 16:26:49:844 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 2.0.0.0, cost 1

*Dec  2 16:26:49:844 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 3.0.0.0, cost 1

*Dec  2 16:26:49:844 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 4.0.0.0, cost 2

*Dec  2 16:26:49:844 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 192.168.2.0, cost 1

*Dec  2 16:26:56:125 2010 R1 RM/6/RMDEBUG: RIP 1 : Sending response on interface Serial0/2/0 from 192.168.1.1 to 255.255.255.255

*Dec  2 16:26:56:125 2010 R1 RM/6/RMDEBUG:   Packet : vers 1, cmd response, length 124

*Dec  2 16:26:56:125 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 1.0.0.0, cost 1

*Dec  2 16:26:56:125 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 2.0.0.0, cost 2

*Dec  2 16:26:56:125 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 3.0.0.0, cost 2

*Dec  2 16:26:56:125 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 4.0.0.0, cost 3

*Dec  2 16:26:56:125 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 192.168.1.0, cost 1

*Dec  2 16:26:56:125 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 192.168.2.0, cost 2

*Dec  2 16:27:11:437 2010 R1 RM/6/RMDEBUG: RIP 1 : Receive response from 192.168.1.2 on Serial0/2/0

*Dec  2 16:27:11:437 2010 R1 RM/6/RMDEBUG:   Packet : vers 1, cmd response, length 84

*Dec  2 16:27:11:437 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 2.0.0.0, cost 1

*Dec  2 16:27:11:437 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 3.0.0.0, cost 1

*Dec  2 16:27:11:437 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 4.0.0.0, cost 2

*Dec  2 16:27:11:437 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 192.168.2.0, cost 1

从上面我们可以看出,在关闭水平分割后RIP包会想自己发送自己宣告的网络,从而产生了路由环路。

 

 

 

三.毒化逆转

在接口下面开启毒化逆转功能

[R1]int s0/2/0

[R1-Serial0/2/0]rip poison-reverse

<R1>debugging rip 1 packet

 

*Dec  2 16:31:15:937 2010 R1 RM/6/RMDEBUG: RIP 1 : Sending response on interface Serial0/2/0 from 192.168.1.1 to 255.255.255.255

*Dec  2 16:31:15:937 2010 R1 RM/6/RMDEBUG:   Packet : vers 1, cmd response, length 104

*Dec  2 16:31:15:937 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 1.0.0.0, cost 1

*Dec  2 16:31:15:937 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 192.168.2.0, cost 16

*Dec  2 16:31:15:937 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 2.0.0.0, cost 16

*Dec  2 16:31:15:937 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 3.0.0.0, cost 16

*Dec  2 16:31:15:937 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 4.0.0.0, cost 16

*Dec  2 16:31:25:62 2010 R1 RM/6/RMDEBUG: RIP 1 : Receive response from 192.168.1.2 on Serial0/2/0

*Dec  2 16:31:25:62 2010 R1 RM/6/RMDEBUG:   Packet : vers 1, cmd response, length 84

*Dec  2 16:31:25:62 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 2.0.0.0, cost 1

*Dec  2 16:31:25:62 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 3.0.0.0, cost 1

*Dec  2 16:31:25:62 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 4.0.0.0, cost 2

*Dec  2 16:31:25:62 2010 R1 RM/6/RMDEBUG:     AFI 2, dest 192.168.2.0, cost 1

从上面可以看出,R1会向自己学习到的路由发送为16条的RIP测试包。来测试下一跳是否已经不可达,当可达是对方会发送可达信息回应,如果对方不可达,会根据3大时间处理!!

 

 

四.被动接口

 

有被动接口我感觉肯定会有单播跟新,单播跟新的命令是在RIP下:#peer +ip地址

作用:不发送RIP包,但接受RIP跟新包

在RIP模式下设置被动接口

[R1]rip

[R1-rip-1]silent-interface s0/2/0

[R1-rip-1]q

 

[R2]display rip 1 route

 Route Flags: R - RIP, T - TRIP

              P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect

 ----------------------------------------------------------------------------

 Peer 192.168.1.1  on Serial0/2/0

      Destination/Mask        Nexthop     Cost    Tag   Flags   Sec

          1.0.0.0/8        192.168.1.1      1       0    RA     180

 Peer 192.168.2.2  on Serial0/2/2

      Destination/Mask        Nexthop     Cost    Tag   Flags   Sec

          4.0.0.0/8        192.168.2.2      1       0    RA      19

 

 

再120

[R2]display rip 1 route

 Route Flags: R - RIP, T - TRIP

              P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect

 ----------------------------------------------------------------------------

 Peer 192.168.1.1  on Serial0/2/0

      Destination/Mask        Nexthop     Cost    Tag   Flags   Sec

          1.0.0.0/8        192.168.1.1     16       0    RSG    120

 Peer 192.168.2.2  on Serial0/2/2

      Destination/Mask        Nexthop     Cost    Tag   Flags   Sec

          4.0.0.0/8        192.168.2.2      1       0    RA      15

[R2]display rip 1 route

 Route Flags: R - RIP, T - TRIP

              P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect

 ----------------------------------------------------------------------------

 Peer 192.168.2.2  on Serial0/2/2

      Destination/Mask        Nexthop     Cost    Tag   Flags   Sec

          4.0.0.0/8        192.168.2.2      1       0    RA      16

 

对r1没有影响=----因为被动接口是不发送RIP包,但是接受路由跟新包,但是ping不同

[R1]display ip routing-table protocol rip

Public Routing Table : RIP

Summary Count : 4

 

RIP Routing table Status : < Active>

Summary Count : 4

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

2.0.0.0/8           RIP    100  1            192.168.1.2     S0/2/0

3.0.0.0/8           RIP    100  1            192.168.1.2     S0/2/0

4.0.0.0/8           RIP    100  2            192.168.1.2     S0/2/0

192.168.2.0/24      RIP    100  1            192.168.1.2     S0/2/0

 

RIP Routing table Status : < Inactive>

Summary Count : 0

 

 

 

 

五.五.允许接口接受或发送RIP信息

rip input 命令用来允许接口接收RIP 报文(默认开启的)

rip output 命令用来允许接口向外发送RIP 报文(默认开启的)

 

[R1]int s0/2/0

[R1-Serial0/2/0]undo rip input

[R1-Serial0/2/0]q

[R1]display rip 1 route

 Route Flags: R - RIP, T - TRIP

              P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect

 ----------------------------------------------------------------------------

 Peer 192.168.1.2  on Serial0/2/0

      Destination/Mask        Nexthop     Cost    Tag   Flags   Sec

          2.0.0.0/8        192.168.1.2      1       0    RA     162

          3.0.0.0/8        192.168.1.2      1       0    RA     162

      192.168.2.0/24       192.168.1.2      1       0    RA     162

          4.0.0.0/8        192.168.1.2      2       0    RA     162

从上面可以看出,路由已经超时!!!!

但是不影响R2和R3学习路由,虽然R2、R3学到了路由,但是ping不同R1!!

 

rip output 命令用来允许接口向外发送RIP 报文(默认开启的)

[R1]int s0/2/0

[R1-Serial0/2/0]undo rip output

[R1-Serial0/2/0]

 

 

 

六.RIP优先级

 

每一种路由协议都有自己的优先级,它的缺省取值由具体的路由策略决定。优先级

的高低将最后决定IP 路由表中的路由采取哪种路由算法获取的最佳路由。可以利用

此命令手动调整RIP 的优先级。

[R1]rip

[R1-rip-1]preference ?

  INTEGER<1-255>  Value of Preference

  route-policy    Route-policy

 

[R1-rip-1]preference 50           

[R1-rip-1]q

 

[R1]display ip routing-table protocol rip

Public Routing Table : RIP

Summary Count : 4

 

RIP Routing table Status : < Active>

Summary Count : 4

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

2.0.0.0/8           RIP    50   1            192.168.1.2     S0/2/0

3.0.0.0/8           RIP    50   1            192.168.1.2     S0/2/0

4.0.0.0/8           RIP    50   2            192.168.1.2     S0/2/0

192.168.2.0/24      RIP    50   1            192.168.1.2     S0/2/0

从上面可以看出,优先级已经是50了。

只供本设备进行路由选择,不影响其他设备的路由,R2上的依旧是100

 

 

 

 

 

 

 

七.配置RIP度量值

根据上面的图,进行实验

rip metricin 命令用来设置接口接收RIP 报文时给路由增加的附加路由权值,

[R2]int s0/2/0

[R2-Serial0/2/0]rip metricin 5

 

[R2]display ip routing-table protocol rip

Public Routing Table : RIP

Summary Count : 2

 

RIP Routing table Status : < Active>

Summary Count : 2

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

1.0.0.0/8           RIP    100  6            192.168.1.1     S0/2/0

4.0.0.0/8           RIP    100  1            192.168.2.2     S0/2/2

 

RIP Routing table Status : < Inactive>

Summary Count : 0

 

 

<R3>display ip routing-table protocol rip

Public Routing Table : RIP

Summary Count : 4

 

RIP Routing table Status : < Active>

Summary Count : 4

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

1.0.0.0/8           RIP    100  7            192.168.2.1     S0/2/0

2.0.0.0/8           RIP    100  1            192.168.2.1     S0/2/0

3.0.0.0/8           RIP    100  1            192.168.2.1     S0/2/0

192.168.1.0/24      RIP    100  1            192.168.2.1     S0/2/0

 

RIP Routing table Status : < Inactive>

Summary Count : 0

 

 

rip metricout 命令用来设置接口发送RIP 报文时给路由增加的附加路由权值

[R2]int s0/2/0

[R2-Serial0/2/0]undo rip metricin

 

[R2-Serial0/2/0]rip metricout ?

  INTEGER<1-16>  The value of metric added to outgoing routes

  route-policy   Route-policy

 

[R2-Serial0/2/0]rip metricout 10

 

 

 

 

 

八.配置time三大时间设置

timers 命令用来修改RIP 的三个定时器Period update 、Timeout

Garbage-collection 的值

[R1-rip-1]timers ?

  garbage-collect  Config RIP route garbage-collect timer interval

  suppress         Config RIP route suppress timer interval

  timeout          Config RIP route Age timer interval

  update           Config RIP route period update timer interval

 

 

 

 

 

九.不同进程间通信

按照上图配置做不同进程之间的通信

注意:不同进程针对的是一个路由器上出现两个不同的进程,如果每台交换机的进程不一样是可以相互学习到路由的。

引入rip路由和引入直连路由是有很大区别的。

[R2]rip

[R2-rip-1]un net 192.168.2.0

[R2-rip-1]un net 3.3.3.0

[R2-rip-1]q

[R2]rip 2

[R2-rip-2]net 192.168.2.0

[R2-rip-2]net 3.3.3.0

[R2-rip-2]q

 

[R3]undo rip 1

Warning : Undo RIP process? [Y/N]:y

[R3]rip 2

[R3-rip-2]

[R3-rip-2]net 192.168.2.0

[R3-rip-2]net 4.4.4.0

[R3-rip-2]q

 

 

当我们查看路由表的时候是可以看出。不同进程之间是不能通信的!

R1学习不到进程2的所有路由

[R1]display ip routing-table protocol rip

Public Routing Table : RIP

Summary Count : 1

 

RIP Routing table Status : < Active>

Summary Count : 1

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

2.0.0.0/8           RIP    100  1            192.168.1.2     S0/2/0

 

RIP Routing table Status : < Inactive>

Summary Count : 0

 

R2可以学习到两边的路由

[R2]display ip routing-table protocol rip

Public Routing Table : RIP

Summary Count : 2

 

RIP Routing table Status : < Active>

Summary Count : 2

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

1.0.0.0/8           RIP    100  1            192.168.1.1     S0/2/0

4.0.0.0/8           RIP    100  1            192.168.2.2     S0/2/2

 

RIP Routing table Status : < Inactive>

Summary Count : 0

 

 

同样R3是不能学到进程1的所有路由的

[R3]display ip routing-table protocol rip

Public Routing Table : RIP

Summary Count : 1

 

RIP Routing table Status : < Active>

Summary Count : 1

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

3.0.0.0/8           RIP    100  1            192.168.2.1     S0/2/0

 

RIP Routing table Status : < Inactive>

Summary Count : 0

 

解决方法:使用引入路由命令

[R2]rip                

[R2-rip-1]import-route ?     

  bgp     Border Gateway Protocol (BGP) routes

  direct  Direct routes

  isis    Intermediate System to Intermediate System (IS-IS) routes

  ospf    Open Shortest Path First (OSPF) routes

  rip     Routing Information Protocol (RIP) routes

  static  Static routes

 

[R2-rip-1]import-route rip 2 ?

  cost          Metric for imported route

  route-policy  Apply the specified route policy to filter route

  tag           Specify route tag

  <cr>         

 

[R2-rip-1]import-route rip 2

[R2-rip-1]q

[R2]rip 2

[R2-rip-2]import-route rip 1

[R2-rip-2]

 

 

 

十.触发跟新

只在R1和R2之间开启触发跟新

进入接口模式,开启触发跟新

[R1]int s0/2/0

[R1-Serial0/2/0]rip triggered

[R2]int s0/2/0             

[R2-Serial0/2/0]rip triggered      

注意:直连的两个端口必须都要开启触发跟新,如果R1开启触发跟新,R2不开启,R2不会定期收到R1的数据包,所以相互之间是学习不到路由的!!

 

[R1]display rip 1 route

 Route Flags: R - RIP, T - TRIP

              P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect

 ----------------------------------------------------------------------------

 Peer 192.168.1.2  on Serial0/2/0 (TRIP)

      Destination/Mask        Nexthop     Cost    Tag   Flags   Sec

          2.0.0.0/8        192.168.1.2      1       0    TP       _

          3.0.0.0/8        192.168.1.2      1       0    TP       _

          4.0.0.0/8        192.168.1.2      2       0    TP       _

      192.168.2.0/24       192.168.1.2      1       0    TP       _

从上面可以看出,模式已近是触发跟新模式,跟新时间为无!

 

 

[R2]display rip 1 route

 Route Flags: R - RIP, T - TRIP

              P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect

 ----------------------------------------------------------------------------

 Peer 192.168.2.2  on Serial0/2/2

      Destination/Mask        Nexthop     Cost    Tag   Flags   Sec

          4.0.0.0/8        192.168.2.2      1       0    RA      19

 Peer 192.168.1.1  on Serial0/2/0 (TRIP)

      Destination/Mask        Nexthop     Cost    Tag   Flags   Sec

          1.0.0.0/8        192.168.1.1      1       0    TP       _

 

 

十一.RIP 的版本兼容问题

修改R1的RIP为版本2

[R1]rip

[R1-rip-1]ver 2

[R1-rip-1]q 

 

[R1]display rip 1 route

 Route Flags: R - RIP, T - TRIP

              P - Permanent, A - Aging, S - Suppressed, G - Garbage-collect

 ----------------------------------------------------------------------------

 Peer 192.168.1.2  on Serial0/2/0

      Destination/Mask        Nexthop     Cost    Tag   Flags   Sec

          2.0.0.0/8        192.168.1.2      1       0    RA     131

          3.0.0.0/8        192.168.1.2      1       0    RA     131

      192.168.2.0/24       192.168.1.2      1       0    RA     131

          4.0.0.0/8        192.168.1.2      2       0    RA     131

对于上面的路由,已经是超时的了!

详细讲解

当指定接口版本为 RIP-1 时,只接收RIP-1 与RIP-2 广播报文,不接收RIP-2 多播报文

当指定接口运行在RIP-2 广播方式时,只接收RIP-1 与RIP-2 广播报文,不接收RIP-2 多播报文

当指定接口运行在RIP-2 多播方式时,只接收RIP-2 多播报文,不接收RIP-1 与RIP-2 广播报文

 

 

怎样能让R1学习到R2的路由呢???请看下面

1.把R1的接口模式改为广播方式

2.把R2上的s0/2/0改为主播方式的

[R1-Serial0/2/0]rip version 2 ?

  broadcast  RIPv2 broadcast mode which is compatible with RIPv1

  multicast  RIPv2 multicast mode

  <cr> 

[R1-Serial0/2/0]rip version 2 multicast

 

 

 

十二.不连续子网

[R1]rip

[R1-rip-1]un summary

[R1-rip-1]net 192.168.1.0

[R1-rip-1]net 172.16.1.0

[R1-rip-1]net 172.16.2.0

 

[R2]rip

[R2-rip-1]un s

[R2-rip-1]un summary

[R2-rip-1]net 192.168.1.0

[R2-rip-1]net 192.168.2.0

 

[R3]rip     

[R3-rip-1]un su

[R3-rip-1]un summary

[R3-rip-1]net 172.16.0.0

 

[R2]display ip routing-table p r

Public Routing Table : RIP

Summary Count : 1

 

RIP Routing table Status : < Active>

Summary Count : 1

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

172.16.0.0/16       RIP    100  1            192.168.1.1       S0/2/0

 

RIP Routing table Status : < Inactive>

Summary Count : 0

 

我们可以看到,上面的路由信息是很粗略的,此时ping两边的任意一个都是一个通一个不通!!

 

解决方法是:使用RIPv2

在学习Cisco时,是有子接口的,在华3也有,不过比较特殊,因为在华3的loopback口的所有地址都是32位的,看不到辅助接口的效果,如果用网段去验证是可以实现用辅助地址解决不连续子网问题。不过在同一路由器上宣告相同的主网。

[R1]rip                                  

[R1-rip-1]ver 2

[R2]rip       

[R2-rip-1]ver 2

[R3]rip 

[R3-rip-1]ver 2

 

 

[R2]display ip routing-table protocol rip

Public Routing Table : RIP

Summary Count : 5

 

RIP Routing table Status : < Active>

Summary Count : 4

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

172.16.1.1/32       RIP    100  1            192.168.1.1     S0/2/0

172.16.2.1/32       RIP    100  1            192.168.1.1     S0/2/0

172.16.5.1/32       RIP    100  1            192.168.2.2     S0/2/2

172.16.6.1/32       RIP    100  1            192.168.2.2     S0/2/2

 

RIP Routing table Status : < Inactive>

Summary Count : 1

 

上面的输出已经解决了不连续子网问题

 

 

 

 

十三.手工汇总

 

实现手工汇总

上面的实验十二,我们该成了ver2

当该成ver2后,原有的不un sunmmary生效。

要重新开启一遍

注意:手工汇总对loopback口是不行的,因为所有的loopback口都是32个掩码,不能汇总,针对网段可以实现自动汇总。

[R1]int s0/2/0

[R1-Serial0/2/0]rip summary-address 172.16.0.0 22

 

注意,即使在R2上显示的是172.16.0.0,仍然不影响实验十二的效果!!

 

 

 

十四.向rip内注入一跳默认路由

 

 

 

[H3C]sys R1

[R1]int lo0

[R1-LoopBack0]ip add 1.1.1.1 32

[R1]int s0/2/0

[R1-Serial0/2/0]ip add 192.168.1.1 24

[R1-Serial0/2/0]q

[R1]rip

[R1-rip-1]ver 2

[R1-rip-1]undo summary

[R1-rip-1]net 1.0.0.0

[R1-rip-1]net 192.168.1.0

[R1-rip-1]q

 

 

[H3C]sys R2

[R2]int s0/2/0

[R2-Serial0/2/0]ip add 192.168.1.2 24

[R2-Serial0/2/0]q

[R2]int s0/2/2

[R2-Serial0/2/2]ip add 192.168.2.1 24

[R2-Serial0/2/2]q

[R2]rip

[R2-rip-1]ver 2

[R2-rip-1]undo summary

[R2-rip-1]net 192.168.1.0

[R2-rip-1]net 192.168.2.0

[R2-rip-1]q

 

 

[H3C]sys R3

[R3]int lo0

[R3-LoopBack0]ip add 4.4.4.4 32

[R3-LoopBack0]q

[R3]int s0/2/0

[R3-Serial0/2/0]ip add 192.168.2.2 24

[R3]rip

[R3-rip-1]net 192.168.2.0

[R3-rip-1]net 4.0.0.0

[R3-rip-1]ver 2

[R3-rip-1]undo summary

[R3-rip-1]q

 

 

 

 

此时我们在R3上设置lo1口的ip地址。然后再R3上注入一跳默认路由

[R3]int lo0

[R3-LoopBack0]ip add 10.10.10.10 32

[R3]rip

[R3-rip-1]default-route originate cost 10   //为什么非要设置cost值呢??本实验最后讲解

从R1上查看

[R1]display ip routing-table protocol rip

Public Routing Table : RIP

Summary Count : 2

 

RIP Routing table Status : < Active>

Summary Count : 2

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

0.0.0.0/0           RIP    100  11           192.168.1.2     S0/2/0

192.168.2.0/24      RIP    100  1            192.168.1.2     S0/2/0

 

RIP Routing table Status : < Inactive>

Summary Count : 0

R1的默认路由cost值为11

R1能ping通10.10.10.10

[R1]ping 10.10.10.10

  PING 10.10.10.10: 56  data bytes, press CTRL_C to break

    Reply from 10.10.10.10: bytes=56 Sequence=1 ttl=254 time=4 ms

    Reply from 10.10.10.10: bytes=56 Sequence=2 ttl=254 time=1 ms

    Reply from 10.10.10.10: bytes=56 Sequence=3 ttl=254 time=4 ms

    Reply from 10.10.10.10: bytes=56 Sequence=4 ttl=254 time=19 ms

    Reply from 10.10.10.10: bytes=56 Sequence=5 ttl=254 time=5 ms

 

  --- 10.10.10.10 ping statistics ---

    5 packet(s) transmitted

    5 packet(s) received

    0.00% packet loss

round-trip min/avg/max = 1/6/19 ms

 
 

注意:

关于cost值,如果一个RIP网络内有多条默认路由,会把那一条放到路由表中呢???

答案是:cost值小的那条默认路由

作业:

关于两边都开启,cost值小会被选中,cost值一样的会被中为两个下一跳

 

 

 

 

 

 

 

 

 

 

十五.RIPv2认证

 

 

 

[R1]rip

[R1-rip-1]ver 2

[R1-rip-1]un summary

[R1-rip-1]net 192.168.1.0

[R1-rip-1]net 1.1.1.0

 

 

[R2]rip

[R2-rip-1]ver 2  

[R2-rip-1]un summary

[R2-rip-1]net 192.168.1.0

 

[R1]int s0/2/0

[R1-Serial0/2/0]rip ?

  authentication-mode  Authentication type

  input                Receive RIP packets

  metricin             Metric added to incoming routes

  metricout            Metric added to outgoing routes

  output               Send RIP packets

  poison-reverse       Configure poison reverse

  split-horizon        Split-horizon control

  summary-address      Configure summary address on this interface

  triggered            Triggered RIP

  version              RIP version switch

 

          

[R1-Serial0/2/0]rip authentication-mode ?

  md5     MD5 authentication

  simple  Simple text authentication

[R1-Serial0/2/0]rip authentication-mode simple 123

 

[R2]int s0/2/0

[R2-Serial0/2/0]rip authentication-mode simple 123

 

两边都要开启

[R2-Serial0/2/0]rip authentication-mode md5 ?

  rfc2082  RFC 2082 MD5 authentication packet format type

  rfc2453  RFC 2453 MD5 authentication packet format type

 
 

注意:

rip authentication-mode 命令用来配置RIP-2 的认证方式及认证参数。undo rip

authentication-mode 命令用来取消RIP-2 认证。

RIP-1 不支持验证报文。RIP 的验证报文主要有两种类型,明文验证和MD5 密文验

证。其中,采用MD5 密文验证方式时有两种报文格式,一种是在RFC 2453 中所描

述的;另一种在RFC 2082 中专门阐述。路由器对这两种报文格式均提供支持,用

户可以根据不同的需要自行选择。

 

 

 

 

十六.直连的网络不再同一网段

注意

上面的连线,必须是串行口,E口学习不到直连网络不同网段的路由!

IPv4在上图没有开启RIP之前是可以学习到不同网段的路由的!

IPV6在没有开启RIP前是不能学习到不同网段的路由的!

 

开启RIP实验如下:

[R1]int lo0

[R1-LoopBack0]ip add 1.1.1.1 32

[R1-LoopBack0]int s0/2/0

[R1-Serial0/2/0]ip add 192.168.1.1 24

[R1]rip

[R1-rip-1]ver 2

[R1-rip-1]un s

[R1-rip-1]net 1.1.1.0

[R1-rip-1]net 192.168.1.0

[R1-rip-1]q

 

 

[R2]int s0/2/0

[R2-Serial0/2/0]

[R2-Serial0/2/0]ip add 192.168.2.1 24

[R2-Serial0/2/0]q

[R2]int s0/2/2

[R2-Serial0/2/2]ip add 192.168.3.1 24

[R2-Serial0/2/2]q

[R2]rip

[R2-rip-1]ver 2

[R2-rip-1]un summary

[R2-rip-1]net 192.168.2.0

[R2-rip-1]net 192.168.3.0

[R2-rip-1]q

 

[R3]int lo0

[R3-LoopBack0]ip add 4.4.4.4 32

[R3-LoopBack0]int s0/2/0

[R3-Serial0/2/0]ip add 192.168.4.1 24

[R3]rip            

[R3-rip-1]net 192.168.4.0

[R3-rip-1]ver 2

[R3-rip-1]un summary

[R3-rip-1]net 4.4.4.0

 

 

 

[R1]display ip routing-table

Routing Tables: Public

        Destinations : 8        Routes : 8

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

1.1.1.1/32          Direct 0    0            127.0.0.1       InLoop0

4.4.4.4/32          RIP    100  2            192.168.2.1     S0/2/0

127.0.0.0/8         Direct 0    0            127.0.0.1       InLoop0

127.0.0.1/32        Direct 0    0            127.0.0.1       InLoop0

192.168.1.0/24      Direct 0    0            192.168.1.1     S0/2/0

192.168.1.1/32      Direct 0    0            127.0.0.1       InLoop0

192.168.2.1/32      Direct 0    0            192.168.2.1     S0/2/0

192.168.3.0/24      RIP    100  1            192.168.2.1     S0/2/0

 

 

[R1]display ip routing-table protocol rip

Public Routing Table : RIP

Summary Count : 2

 

RIP Routing table Status : < Active>

Summary Count : 2

 

Destination/Mask    Proto  Pre  Cost         NextHop         Interface

 

4.4.4.4/32          RIP    100  2            192.168.2.1     S0/2/0

192.168.3.0/24      RIP    100  1            192.168.2.1     S0/2/0

 

RIP Routing table Status : < Inactive>

Summary Count : 0

在R1上我们是学习不到R3上的192.168.4.0网段,可以学习到4.4.4.0网段。

因为公司之间通信不需要知道路由直连ip地址!

 

 

 

 

十七.直连的网络不再同一网段IPv6

 

 

 

ipv6

 

[R1]int lo0

[R1-LoopBack0]ipv6 add 1::1/128

[R1-LoopBack0]q

[R1]int s0/2/0

[R1-Serial0/2/0]ipv6 add 2001::1/64

[R1-Serial0/2/0]q

 

[R2]int s0/2/0

[R2-Serial0/2/0]ipv6 add 2002::1/64

[R2-Serial0/2/0]q

[R2]int s0/2/2

[R2-Serial0/2/2]ipv6 add 2003::1/64

 

 

[R3]int lo0

[R3-LoopBack0]ipv6 add 2::1/128

[R3]int s0/2/0

[R3-Serial0/2/0]ipv6 add 2004::1/64

 

 

 

学习不到直连的网络,

 

[R1]display ipv6 routing-table

Routing Table :

        Destinations : 3        Routes : 3

 

Destination: ::1/128                                     Protocol  : Direct

NextHop    : ::1                                         Preference: 0

Interface  : InLoop0                                     Cost      : 0

 

Destination: 3001::1/128                                 Protocol  : Direct

NextHop    : ::1                                         Preference: 0

Interface  : InLoop0                                     Cost      : 0

 

Destination: FE80::/10                                   Protocol  : Direct

NextHop    : ::                                          Preference: 0

Interface  : NULL0                                       Cost      : 0

 

开启rip看看

[R1]int lo0

[R1-LoopBack0]ripn  

[R1-LoopBack0]ripng 1 enable

[R1-LoopBack0]q

[R1]int s0/2/0

[R1-Serial0/2/0]ripng 1 enable

[R1-Serial0/2/0]q

[R2-ripng-1]int s0/2/0

[R2-Serial0/2/0]ripng 1 enable

[R2-Serial0/2/0]int s0/2/2

[R2-Serial0/2/2]ripng 1 enable

[R3]int lo0

[R3-LoopBack0]ripng 1 enable

[R3-LoopBack0]q

[R3]int s0/2/0 

[R3-Serial0/2/0]ripng 1 enable

[R3-Serial0/2/0]q

 

截图00,可以学习到所有的

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 


RIP-1 缺省进行零域检查操作。

根据协议(RFC1058)规定,RIP-1 的报文中有些区域必须为零,称之为零域(zero

field)。可以使用checkzero 命令来启动和禁止对RIP-1 报文的查零操作。进行查

零操作时如果收到零域不为零的RIP-1 报文,则拒绝处理。

由于 RIP-2 的报文没有零域,所以此命令对RIP-2 没有作用。

缺省情况下,路由器接收主机路由。

在某些特殊情况下,RIP 会收到大量的同一网段的主机路由,这些路由对于选路没

有多少作用,却占用了大量的资源。这时可以使用undo host-route 来拒绝接受主

机路由。

RIP老化时间

 

在下面实验五中将详细介绍----5.允许接口接受或发送RIP信息。

RIP路由初始化时,发送两种报文,request和response!

Request是目的地址是广播地址!

Respons是回应request请求包,并在路由建立后维护路由表!!

原文地址:https://www.cnblogs.com/niezhongle/p/11213356.html