RIP协议的配置

来源:互联网 发布:单片机接反会 编辑:程序博客网 时间:2024/04/28 16:24

拓扑图:

要求:

理解RIP协议的工作原理,并通过 RIP 路由协议实现不同网络互通。


配置步骤:

 1、配置好 PC 机的 IP 地址等参数。 PC 0>ipconfig IP Address......................: 10.1.1.2 Subnet Mask.....................: 255.255.255.0 Default Gateway.................: 10.1.1.1

2、配置路由器各个接口的 IP 地址等参数    
3、配置交换机的 VLAN 信息    配置交换机的各端口的 VLAN 信息,使得PC0和 PC1 属于 VLAN10;PC2和 PC3属 于 VLAN20;PC4和 PC5属于 VLAN30;配置完成后,各VLAN内部PC能互通,其 它不能互通。
4、RIP 路由协议配置   
路由器 R1 和 R2 的配置类似。

配置命令:

(1)、在R0中的配置:

R0(config)#inter f0/0

R0(config-if)#ip add 10.1.1.1 255.255.255.0

R0(config-if)#no shut

 

R0(config)#inter s1/0

R0(config-if)#ip add 192.168.0.1 255.255.255.0

R0(config-if)#no shut

R0(config-if)#clock rate 64000

R0(config-if)#no shut

 

R0(config)#router rip

R0(config-router)#version 2

R0(config-router)#network 10.1.1.0

R0(config-router)#network 192.168.0.0

 

R0的路由表:

 

Gateway of last resort is not set

 

     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

R       10.0.0.0/8 [120/1] via 192.168.0.2, 00:00:15, Serial1/0

C       10.1.1.0/24 is directly connected, FastEthernet0/0

C    192.168.0.0/24 is directly connected, Serial1/0

R    192.168.1.0/24 [120/1] via 192.168.0.2, 00:00:15, Serial1/0

(2)、在R1中的配置:

R1(config)#inter f0/0

R1(config-if)#ip add 10.2.1.1 255.255.255.0

R1(config-if)#no shut

 

R1(config)#inter s1/0

R1(config-if)#ip add 192.168.0.2 255.255.255.0

R1(config-if)#no shut

 

R1(config)#inter s1/1

R1(config-if)#ip add 192.168.1.1 255.255.255.0

R1(config-if)#no shut

R1(config-if)#clock rate 64000

R1(config-if)#no shut

 

R1(config)#router rip

R1(config-router)#version 2

R1(config-router)#network 192.168.1.0

R1(config-router)#network 192.168.0.0

R1(config-router)#network 10.2.1.0

 

R1的路由表:

Gateway of last resort is not set

 

     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

R       10.0.0.0/8 [120/1] via 192.168.1.2, 00:00:14, Serial1/1

                   [120/1] via 192.168.0.1, 00:00:01, Serial1/0

C       10.2.1.0/24 is directly connected, FastEthernet0/0

C    192.168.0.0/24 is directly connected, Serial1/0

C    192.168.1.0/24 is directly connected, Serial1/1

(3)、在R2中的配置:

R2(config)#inter f0/0

R2(config-if)#ip add 10.3.1.1 255.255.255.0

R2(config-if)#no shut

 

R2(config)#inter s1/0

R2(config-if)#ip add 192.168.1.2 255.255.255.0

R2(config-if)#no shut

 

R2(config)#router rip

R2(config-router)#version 2

R2(config-router)#network 10.3.1.0

R2(config-router)#network 192.168.1.0

 

R2的路由表:

Gateway of last resort is not set

 

     10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

R       10.0.0.0/8 [120/1] via 192.168.1.1, 00:00:10, Serial1/0

C       10.3.1.0/24 is directly connected, FastEthernet0/0

R    192.168.0.0/24 [120/1] via 192.168.1.1, 00:00:10, Serial1/0

C    192.168.1.0/24 is directly connected, Serial1/0

 

配置vlan:

Switch0:

 

Switch(config)#vlan 10

Switch(config-vlan)#exit

Switch(config)#inter f0/2

Switch(config-if)#switchport access vlan 10

Switch(config-if)#inter f0/3

Switch(config-if)#switchport access vlan 10

Switch(config-if)#inter f0/1

Switch(config-if)#switchport mode trunk

 

Switch1:

 

Switch(config)#vlan 20

Switch(config-vlan)#exit

Switch(config)#inter f0/2

Switch(config-if)#switchport access vlan 20

Switch(config-if)#inter f0/3

Switch(config-if)#switchport access vlan 20

Switch(config-if)#inter f0/1

Switch(config-if)#switchport mode trunk

 

Switch2:

 

Switch(config)#vlan 30

Switch(config-vlan)#exit

Switch(config)#inter f0/2

Switch(config-if)#switchport access vlan 30

Switch(config-if)#inter f0/3

Switch(config-if)#switchport access vlan 30

 

PC0 ping PC2:

 

PC>ping 10.2.1.2

 

Pinging 10.2.1.2 with 32 bytes of data:

 

Request timed out.

Request timed out.

Request timed out.

Request timed out.

 

Ping statistics for 10.2.1.2:

    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

 

PC0 ping PC4:

 

PC>ping 10.3.1.2

 

Pinging 10.3.1.2 with 32 bytes of data:

 

Request timed out.

Request timed out.

Request timed out.

Request timed out.

 

Ping statistics for 10.3.1.2:

    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

 

PC0 ping PC1:

 

PC>ping 10.1.1.3

 

Pinging 10.1.1.3 with 32 bytes of data:

 

Reply from 10.1.1.3: bytes=32 time=2ms TTL=128

Reply from 10.1.1.3: bytes=32 time=0ms TTL=128

Reply from 10.1.1.3: bytes=32 time=0ms TTL=128

Reply from 10.1.1.3: bytes=32 time=1ms TTL=128

 

Ping statistics for 10.1.1.3:

    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),

Approximate round trip times in milli-seconds:

    Minimum = 0ms, Maximum = 2ms, Average = 0ms


0 0