今天来讲下RIP配置,希望大家多交流交流。

拓扑图如下所示:

R1配置如下:

en

conf t

int lo0

ip add 1.1.1.1 255.255.255.0

int f0/0

ip add 192.168.12.1 255.255.255.0

no sh

ex

route rip

version 2

no auto-summary

network 1.1.1.0

network 192.168.12.0

end

R2配置如下

en

conf t

int f0/0

ip add 192.168.12.2 255.255.255.0

no sh

int f0/1

ip add 192.168.23.2 255.255.255.0

no sh

ex

router rip

version 2

no auto-summary

network 192.168.12.0

network 192.168.23.0

end

R3配置如下

en

conf t

int f0/0

ip add 192.168.23.3 255.255.255.0

no sh

int f0/1

ip add 192.168.34.3 255.255.255.0

no sh

ex

rouote rip

version 2

no auto-summary

network 192.168.23.0

network 192.168.34.0

end

R4配置如下:

en

conf t

int f0/0

ip add 192.168.34.4 255.255.255.0

no sh

int loopback 0

ip add 4.4.0.4 255.255.255.0

int loopback 1

ip add 4.4.1.4 255.255.255.0

int loopback 2

ip add 4.4.2.4 255.255.255.0

int loopback 3

ip add 4.4.3.4 255.255.255.0

ex

route rip

version 2

no auto-summary

network 192.168.34.0

network 4.4.0.0

所有路由配置完成  然后相互ping通

我们设置的是将所有路由自动汇总关闭,首先查看一下各个路由的路由表。

R1:

     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
     4.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
R       4.0.0.0/8 [120/3] via 192.168.12.2, 00:00:04, FastEthernet0/0
R       4.4.0.0/24 [120/3] via 192.168.12.2, 00:00:04, FastEthernet0/0
R       4.4.1.0/24 [120/3] via 192.168.12.2, 00:00:04, FastEthernet0/0
R       4.4.2.0/24 [120/3] via 192.168.12.2, 00:00:04, FastEthernet0/0
R       4.4.3.0/24 [120/3] via 192.168.12.2, 00:00:04, FastEthernet0/0
C    192.168.12.0/24 is directly connected, FastEthernet0/0
R    192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:04, FastEthernet0/0
R    192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:04, FastEthernet0/0

R2:

     1.0.0.0/24 is subnetted, 1 subnets
R       1.1.1.0 [120/1] via 192.168.12.1, 00:00:18, FastEthernet0/0
     4.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
R       4.0.0.0/8 [120/2] via 192.168.23.3, 00:00:22, FastEthernet0/1
R       4.4.0.0/24 [120/2] via 192.168.23.3, 00:00:22, FastEthernet0/1
R       4.4.1.0/24 [120/2] via 192.168.23.3, 00:00:22, FastEthernet0/1
R       4.4.2.0/24 [120/2] via 192.168.23.3, 00:00:22, FastEthernet0/1
R       4.4.3.0/24 [120/2] via 192.168.23.3, 00:00:22, FastEthernet0/1
C    192.168.12.0/24 is directly connected, FastEthernet0/0
C    192.168.23.0/24 is directly connected, FastEthernet0/1
R    192.168.34.0/24 [120/1] via 192.168.23.3, 00:00:22, FastEthernet0/1

R3:

     1.0.0.0/24 is subnetted, 1 subnets
R       1.1.1.0 [120/2] via 192.168.23.2, 00:00:07, FastEthernet0/0
     4.0.0.0/8 is variably subnetted, 5 subnets, 2 masks
R       4.0.0.0/8 [120/1] via 192.168.34.4, 00:00:33, FastEthernet0/1
R       4.4.0.0/24 [120/1] via 192.168.34.4, 00:00:05, FastEthernet0/1
R       4.4.1.0/24 [120/1] via 192.168.34.4, 00:00:05, FastEthernet0/1
R       4.4.2.0/24 [120/1] via 192.168.34.4, 00:00:05, FastEthernet0/1
R       4.4.3.0/24 [120/1] via 192.168.34.4, 00:00:05, FastEthernet0/1
R    192.168.12.0/24 [120/1] via 192.168.23.2, 00:00:07, FastEthernet0/0
C    192.168.23.0/24 is directly connected, FastEthernet0/0
C    192.168.34.0/24 is directly connected, FastEthernet0/1

R4:

     1.0.0.0/24 is subnetted, 1 subnets
R       1.1.1.0 [120/3] via 192.168.34.3, 00:00:05, FastEthernet0/0
     4.0.0.0/24 is subnetted, 4 subnets
C       4.4.0.0 is directly connected, Loopback0
C       4.4.1.0 is directly connected, Loopback1
C       4.4.2.0 is directly connected, Loopback2
C       4.4.3.0 is directly connected, Loopback3
R    192.168.12.0/24 [120/2] via 192.168.34.3, 00:00:05, FastEthernet0/0
R    192.168.23.0/24 [120/1] via 192.168.34.3, 00:00:05, FastEthernet0/0
C    192.168.34.0/24 is directly connected, FastEthernet0/0

此时我们可以看到所有路由的路由条目上将4.4.0.0/24 4.、4.4.1.0/24、4.4.2.0/24、4.4.3.0/244个网段每个都作为一条单独的路由条目,此时比较麻烦,若我们将之汇总时怎样一种情况呢!

我们在R4上配置

R4:

en

conf t

router rip

auto-summary

end

然后清空各个路由的路由表,不然的话就得等很长时间才会看到路由表的变化。

R1:

en

clear ip router * (清空后等待30秒刷新)

show ip route

     1.0.0.0/24 is subnetted, 1 subnets
C       1.1.1.0 is directly connected, Loopback0
R    4.0.0.0/8 [120/3] via 192.168.12.2, 00:00:03, FastEthernet0/0
C    192.168.12.0/24 is directly connected, FastEthernet0/0
R    192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:03, FastEthernet0/0
R    192.168.34.0/24 [120/2] via 192.168.12.2, 00:00:03, FastEthernet0/0

R2:

en

clear ip route *

show ip route

     1.0.0.0/24 is subnetted, 1 subnets
R       1.1.1.0 [120/1] via 192.168.12.1, 00:00:15, FastEthernet0/0
R    4.0.0.0/8 [120/2] via 192.168.23.3, 00:00:03, FastEthernet0/1
C    192.168.12.0/24 is directly connected, FastEthernet0/0
C    192.168.23.0/24 is directly connected, FastEthernet0/1
R    192.168.34.0/24 [120/1] via 192.168.23.3, 00:00:03, FastEthernet0/1

R3:

en

clear ip route *

     1.0.0.0/24 is subnetted, 1 subnets
R       1.1.1.0 [120/2] via 192.168.23.2, 00:00:40, FastEthernet0/0
R    4.0.0.0/8 [120/1] via 192.168.34.4, 00:00:22, FastEthernet0/1
R    192.168.12.0/24 [120/1] via 192.168.23.2, 00:00:14, FastEthernet0/0
C    192.168.23.0/24 is directly connected, FastEthernet0/0
C    192.168.34.0/24 is directly connected, FastEthernet0/1

R4:

en

clear ip route *

     1.0.0.0/24 is subnetted, 1 subnets
R       1.1.1.0 [120/3] via 192.168.34.3, 00:00:16, FastEthernet0/0
     4.0.0.0/24 is subnetted, 4 subnets
C       4.4.0.0 is directly connected, Loopback0
C       4.4.1.0 is directly connected, Loopback1
C       4.4.2.0 is directly connected, Loopback2
C       4.4.3.0 is directly connected, Loopback3
R    192.168.12.0/24 [120/2] via 192.168.34.3, 00:00:16, FastEthernet0/0
R    192.168.23.0/24 [120/1] via 192.168.34.3, 00:00:16, FastEthernet0/0
C    192.168.34.0/24 is directly connected, FastEthernet0/0

在R4上开启自动汇总后会发现R1、R2、R3上4.0.0.0/8的网段在路由表里面都汇总了

大家可以看我标出的红色字体,就是汇总的条目。至于R4为什么没有汇总,因为这4个路由条目是R4直连的,且汇总时从R4的f0/0接口发出去的,且R4上汇总的话,数据发往何地R4都不清楚了。

希望大家多指点,交流,谢谢!