配置动态路由:基于RIP v2

来源:互联网 发布:php查找字符串位置 编辑:程序博客网 时间:2024/06/06 16:44

    这篇博客小编将给大家讲解一下我在东北大学学习互联网课程的时候实验课上学习到的通过RIP v2 来配置动态路由。

    (一)实验目的:

    掌握在路由器上配置RIP V2。


    (二)实验环境:

    实验拓扑如下图所示:

    

   

    (三)实验的内容和要求

    首先建立3路由的静态路由,再建立动态路由。


    实验说明:

    第一步:基本配置

    *三层交换机基本配置

Switch# configure terminal

Switch (config)# vlan 10

Switch (config-vlan)# exit

Switch (config)# vlan 50

Switch (config-vlan)# exit

Switch (config)# interface f0/1

Switch (config-if)# switchport access vlan 10

Switch (config-if)# exit

Switch (config)# interface f0/5

Switch (config-if)# switchport access vlan 50

Switch (config-if)# exit

Switch (config)# interface vlan 10 !创建VLAN虚接口,并配置IP

Switch (config-if)# ip address 172.16.1.2255.255.255.0

Switch (config-if)# no shutdown

Switch (config-if)# exit

Switch (config)# interface vlan 50 !创建VLAN虚接口,并配置IP

Switch (config-if)# no shutdown

Switch (config-if)# exit

   

    验证测试:

Switch # show vlan

VLAN Name Status Ports

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

1 default active Fa0/2, Fa0/3, Fa0/4

Fa0/6, Fa0/7, Fa0/8

Fa0/9, Fa0/10, Fa0/11

Fa0/12, Fa0/13, Fa0/14

Fa0/15, Fa0/16, Fa0/17

Fa0/18, Fa0/19, Fa0/20

Fa0/21, Fa0/22, Fa0/23

Fa0/24

10 VLAN0010 active Fa0/1

50 VLAN0050 active Fa0/5

Switch # show ip interface

Interface : VL10

Description : Vlan 10

OperStatus : UP

ManagementStatus : Enabled

Primary Internet address: 172.16.1.2/24

Broadcast address : 255.255.255.255

PhysAddress : 00d0.f8ff.8ab5

Interface : VL50

Description : Vlan 50

OperStatus : UP

ManagementStatus : Enabled

Primary Internet address: 172.16.5.1/24

Broadcast address : 255.255.255.255

PhysAddress : 00d0.f8ff.8ab6

    * 路由器基本配置

    路由器Router1基本配置

Router (config)# interface fastethernet 0/0

或Router (config)# interface fastethernet 1/0

Router (config-if)# ip address 172.16.1.1255.255.255.0

Router (config-if)# no shutdown

Router (config-if)# exit

Router (config)# interface serial 2/0

或Router (config)# interface serial 1/2

Router (config-if)# ip address 172.16.2.1255.255.255.0

Router (config-if)# clock rate 64000

 

    路由器Router2基本配置

Router (config)# interface fastethernet 0/0

或Router (config)# interface fastethernet 1/0

Router (config-if)# ip address 172.16.3.1255.255.255.0

Router (config-if)# no shutdown

Router (config-if)# exit

Router (config)# interface serial 2/0

或Router (config)# interface serial 1/2

Router (config-if)# ip address 172.16.2.2255.255.255.0

Router (config-if)# no shutdown

 

    验证测试:验证路由器接口的配置和状态

    验证路由器Router1的接口配置和状态

Router # show ip interface brief

InterfaceIP-Address OK? Status

FastEthernet0/0172.16.1.1 YES up

FastEthernet0/1unassigned YES down

Serial2/0172.16.2.1 YES up

Serial3/0unassigned YES down


验证路由器Router2的接口配置和状态

Router # show ip interface brief

InterfaceIP-Address OK? Status

FastEthernet0/0172.16.3.1 YES up

FastEthernet0/1unassigned YES down

Serial2/0172.16.2.2 YES up

Serial3/0unassigned YES down


    第二步:配置RIP v2路由协议

* S3550配置RIP协议

Switch (config)# router rip !开启RIP协议进程

Switch (config-router)# network 172.16.1.0  !申明本设备的直连网段

Switch (config-router)# network 172.16.5.0

Switch (config-router)# version 2


* Router1配置RIP协议

Router(config)# router rip !开启RIP协议进程

Router(config-router)# network 172.16.1.0  !申明本设备的直连网段

Router(config-router)# network 172.16.2.0

Router(config-router)# version 2

Router(config-router)# no auto-summary !关闭路由信息的自动汇总功能


* Router2配置RIP协议

Router(config)# router rip !开启RIP协议进程

Router(config-router)# network 172.16.2.0  !申明本设备的直连网段

Router(config-router)# network 172.16.3.0

Router(config-router)# version 2

Router(config-router)# no auto-summary !关闭路由信息的自动汇总功能

 

    第三步:验证三台路由设备的路由表,查看是否自动学习了其他网段的路由信息

Switch # show ip route

Codes: C- connected, S- static, R- RIP

O- OSPF, IA- OSPF inter area

E1- OSPF external type 1, E2- OSPF external type 2

Type Destination IP Next hop Interface Distance Metric Status

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

C 172.16.1.0/24 0.0.0.0 VL10 0 0 Active

R 172.16.2.0/24 172.16.1.1 VL10 120 2 Active

R 172.16.3.0/24 172.16.1.1 VL10 120 3 Active

C 172.16.5.0/24 0.0.0.0 VL50 0 0 Active

Router1 # show ip route

Codes: C- connected, S- static, R- RIP

O- OSPF, IA- OSPF inter area

E1- OSPF external type 1, E2- OSPF external type 2

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 4 subnets

R 172.16.5.0 [120/1] via 172.16.1.2, 00:00:09, FastEthernet0

C 172.16.1.0 is directly connected, FastEthernet0

C 172.16.2.0 is directly connected, Serial0

R 172.16.3.0 [120/1] via 172.16.2.2, 00:00:04, Serial0

Router2 # show ip route

Codes: C- connected, S- static, R- RIP

O- OSPF, IA- OSPF inter area

E1- OSPF external type 1, E2- OSPF external type 2

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 4 subnets

R 172.16.5.0 [120/2] via 172.16.2.1, 00:00:21, Serial0

R 172.16.1.0 [120/1] via 172.16.2.1, 00:00:21, Serial0

C 172.16.2.0 is directly connected, Serial0

C 172.16.3.0 is directly connected, FastEthernet0


    第四步:测试网络的连通性

C:\>ping 172.16.3.22 !从PC1 ping PC2

Pinging 172.16.3.22 with 32 bytes of data:

Reply from 172.16.3.22: bytes=32 time<1ms TTL=63

Reply from 172.16.3.22: bytes=32 time<1ms TTL=63

Reply from 172.16.3.22: bytes=32 time<1ms TTL=63

Reply from 172.16.3.22: bytes=32 time<1ms TTL=63

Ping statistics for 172.16.3.22:

Packets: Send = 4, Received = 4, Lost = 0 <0% loss>,

Approximate round trip times in milli-seconds:

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


    注意事项:

1、在串口上配置时钟频率时,一定要在电缆DCE端的路由器上配置,否则链路不通。

2、 no auto-summary只有在RIP v2支持。

3、 S3550-24没有no auto-summary命令。

4、 PC主机网关一定要指向直连接口IP地址,例如PC1网关指向三层交换机VLAN50的IP地址。

 

    参考配置:

Switch # show running-config

Building configuration…

Current configuration : 349 bytes

!

Version 1.0

!

Hostname S3550

Vlan 1

!

Vlan 10

!

Vlan 50

!

Interface FastEthernet 0/1

Switchport access vlan 10

!

Interface FastEthernet 0/5

Switchport access vlan 50

!

Interface Vlan 10

Ip address 172.16.1.2 255.255.255.0

!

Interface Vlan 50

Ip address 172.16.5.1 255.255.255.0

!

Router rip

Version 2

Network 172.16.0.0 mask 255.255.255.0

!

End


Router1 # show running-config

Building configuration…

Current configuration : 600 bytes

!

Version 8.32(building 5)

!

 

!

Interface serial 1/2

Encapsulation ppp

Ppp authentication pap

Ip address 172.16.2.1 255.255.255.0

Clock rate 64000

!

Interface serial 1/2

Clock rate 64000

!

Interface FastEthernet 1/0

Ip address 172.16.1.1 255.255.255.0

Duplex auto

Speed auto

!

Interface FastEthernet 1/1

Duplex auto

Speed auto

!

Interface Null 0

!

Router rip

No auto-summary

Version 2

Network 172.16.0.0

!

Line con 0

Line aux 0

Line vty 0 4

Login

!

End


Router2 # show running-config

Building configuration…

Current configuration : 522 bytes

!

Version 8.32(building 53)

!

Hostname r2

!

Interface serial 1/2

Encapsulation ppp

Ip address 172.16.2.2 255.255.255.0

Clock rate 64000

!

Interface serial 1/3

Clock rate 64000

!

Interface FastEthernet 1/0

Ip address 172.16.3.1 255.255.255.0

Duplex auto

Speed auto

!

Interface FastEthernet 1/1

Duplex auto

Speed auto

!

Interface Null 0

!

Router rip

No auto-summary

Version 2

Network 172.16.0.0

!

Line con 0

Line aux 0

Line vty 0 4

Login

!

End 



原创粉丝点击