安徽工业经济职业技术学院 - 31715 - 3#620
一、实验目的
- 理解路由器的基本功能
- 训练路由器动态路由的基本配置命令
- 掌握路由器路由配置的基本方法
- 掌握在路由器上配置OFPF动态路由的基本方法
- 掌握网络连通性的基本方法
二、实验步骤
1. 配置PC机、路由器、服务器的IP地址
- 路由器router0:
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface FastEthernet0/0
Router(config-if)#ip address 10.0.1.254 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#interface FastEthernet0/1
Router(config-if)#ip address 10.0.2.254 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router(config-if)#exit
Router(config)#interface Serial1/0
Router(config-if)#clock rate 64000
RRouter(config-if)#ip address 30.0.0.1 255.255.255.0
Router(config-if)#no shutdown
- 路由器router1
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface FastEthernet0/0
Router(config-if)#ip address 20.0.0.254 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#exit
Router(config)#interface Serial1/1
Router(config-if)#clock rate 64000
This command applies only to DCE interfaces
Router(config-if)#ip address 30.0.0.2 255.255.255.0
Router(config-if)#no shutdownRouter(config-if)#exit
Router(config)#interface Serial1/0
Router(config-if)#clock rate 64000
Router(config-if)#ip address 40.0.0.1 255.255.255.0
Router(config-if)#no shutdown
- 路由器router2
Router>enable
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface Serial1/1
Router(config-if)#clock rate 64000
This command applies only to DCE interfaces
Router(config-if)#ip address 40.0.0.2 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface Serial1/1, changed state to up
Router(config-if)#exit
Router(config)#interface FastEthernet0/0
Router(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/1, changed state to up
Router(config-if)#ip address 50.0.0.254 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
2. 开启OSPF并设置区域公布网路
- 路由器router0
Router(config)#rou
Router(config)#router os
Router(config)#router ospf 100
Router(config-router)#rou
Router(config-router)#router-id 1.1.1.1
Router(config-router)#net
Router(config-router)#network 10.0.1.0 0.0.0.255 ar
Router(config-router)#network 10.0.1.0 0.0.0.255 area 1
Router(config-router)#network 10.0.2.0 0.0.0.255 area 1
Router(config-router)#network 30.0.0.0 0.0.0.255 area 1
Router(config-router)#end
Router#show running-config
Building configuration...
Current configuration : 907 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
interface FastEthernet0/0
ip address 10.0.1.254 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
ip address 10.0.2.254 255.255.255.0
duplex auto
speed auto
!
interface Serial1/0
ip address 30.0.0.1 255.255.255.0
clock rate 64000
!
interface Serial1/1
no ip address
shutdown
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
router ospf 100
router-id 1.1.1.1
log-adjacency-changes
network 10.0.1.0 0.0.0.255 area 1
network 10.0.2.0 0.0.0.255 area 1
network 30.0.0.0 0.0.0.255 area 1
!
ip classless
!
!
!
no cdp run
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
End
- 路由器router1
Router(config)#rou
Router(config)#router os
Router(config)#router ospf 200
Router(config-router)#rou
Router(config-router)#router-id 2.2.2.2
Router(config-router)#net
Router(config-router)#network 10.0
^
% Invalid input detected at '^' marker.
Router(config-router)#network 10.0.1.0 0.0.0.255 ar
Router(config-router)#network 10.0.1.0 0.0.0.255 area 1
Router(config-router)#network 10.0.2.0 0.0.0.255 area 1
Router(config-router)#network 30.0.0.0 0.0.0.255 are
Router(config-router)#network 30.0.0.0 0.0.0.255 area 1
Router(config-router)#
00:16:00: %OSPF-5-ADJCHG: Process 200, Nbr 1.1.1.1 on Serial1/1 from LOADING to FULL, Loading Done
Router(config)#router ospf 200
Router(config-router)#net
Router(config-router)#network 20.0.0.0 0.0.0.255 ar
Router(config-router)#network 20.0.0.0 0.0.0.255 area 0
Router(config-router)#network 40.0.0.0 0.0.0.255 area 0
Router(config-router)#network 40.0.0.0 0.0.0.255 area 1
Router(config-router)#
00:18:02: %OSPF-6-AREACHG: 40.0.0.0/0 changed from area 0 to area 1
Router(config-router)#network 40.0.0.0 0.0.0.255 area 1
Router(config-router)#network 50.0.0.0 0.0.0.255 area 1
Router(config-router)#end
Router#
%SYS-5-CONFIG_I: Configured from console by console
Router#
Router#sh
Router#show run
Router#show running-config
Building configuration...
Current configuration : 1010 bytes
!
version 12.4
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Router
!
!
!
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
interface FastEthernet0/0
ip address 20.0.0.254 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet0/1
no ip address
duplex auto
speed auto
shutdown
!
interface Serial1/0
ip address 40.0.0.1 255.255.255.0
clock rate 64000
!
interface Serial1/1
ip address 30.0.0.2 255.255.255.0
!
interface Serial1/2
no ip address
shutdown
!
interface Serial1/3
no ip address
shutdown
!
interface Vlan1
no ip address
shutdown
!
router ospf 200
router-id 2.2.2.2
log-adjacency-changes
network 10.0.1.0 0.0.0.255 area 1
network 10.0.2.0 0.0.0.255 area 1
network 30.0.0.0 0.0.0.255 area 1
network 40.0.0.0 0.0.0.255 area 1
network 50.0.0.0 0.0.0.255 area 1
network 20.0.0.0 0.0.0.255 area 0
!
ip classless
!
!
!
no cdp run
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
!
!
End
- 路由器router3
Router(config)#router os
Router(config)#router ospf 300
Router(config-router)#rou
Router(config-router)#router-id 3.3.3.3
Router(config-router)#net
Router(config-router)#network 40.0.0.0 0.0.0.255 area 2
Router(config-router)#network 50.0.0.0 0.0.0.255 area 2
三、实验结果
PC>ping 50.0.0.1
Pinging 50.0.0.1 with 32 bytes of data:
Request timed out.
Reply from 50.0.0.1: bytes=32 time=22ms TTL=125
Reply from 50.0.0.1: bytes=32 time=2ms TTL=125
Reply from 50.0.0.1: bytes=32 time=3ms TTL=125
Ping statistics for 50.0.0.1:
Packets: Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum = 2ms, Maximum = 22ms, Average = 9ms
四、实验总结
- 通过配置OSPF协议,实现网络互联互通
- 降低了区域内每个路由器的压力
网友评论