先上拓扑图

思科模拟器做RIP&OSPF实验_OSPF

我们的目的就是能从PC0  ping  通到PC3和PC2。

这里我们用两个路由协议,一个是RIP,是一个OSPF。

RIP是矢量路由,会把自己的路由表分发给附近的路由器。

OSPF是动态路由。同一个area区间会自动更新。

上R0 R1 R2 R3 的路由配置和路由表。

R0路由配置:

R0#sho run
Building configuration...

Current configuration : 979 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R0
!
!
!
!
!
!
!
!
no ip cef
no ipv6 cef
!
!
!
!
license udi pid CISCO2911/K9 sn FTX15244LBT-
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface GigabitEthernet0/0
 ip address 192.168.0.253 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/1
 ip address 192.168.1.254 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/2
 ip address 192.168.101.1 255.255.255.252
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router ospf 1
 log-adjacency-changes
 network 192.168.0.0 0.0.0.255 area 1
 network 192.168.1.0 0.0.0.255 area 1
 network 192.168.101.0 0.0.0.3 area 1
!
router rip
 version 2
 network 192.168.0.0
 network 192.168.1.0
 network 192.168.101.0
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

 R1路由配置: 

R1#sho run
Building configuration...

Current configuration : 880 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R1
!
!
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
license udi pid CISCO2911/K9 sn FTX1524E529-
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface GigabitEthernet0/0
 ip address 192.168.101.2 255.255.255.252
 duplex auto
 speed auto
!
interface GigabitEthernet0/1
 ip address 192.168.101.13 255.255.255.252
 duplex auto
 speed auto
!
interface GigabitEthernet0/2
 ip address 192.168.101.5 255.255.255.252
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router ospf 1
 log-adjacency-changes
 network 192.168.101.0 0.0.0.3 area 1
!
router rip
 version 2
 network 192.168.101.0
 no auto-summary
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

R2路由配置:

R2#sho run
Building configuration...

Current configuration : 936 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R2
!
!
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
license udi pid CISCO2911/K9 sn FTX15247LE2-
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface GigabitEthernet0/0
 ip address 192.168.2.254 255.255.255.0
 duplex auto
 speed auto
!
interface GigabitEthernet0/1
 ip address 192.168.101.9 255.255.255.252
 duplex auto
 speed auto
!
interface GigabitEthernet0/2
 ip address 192.168.101.6 255.255.255.252
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router ospf 1
 log-adjacency-changes
 network 192.168.2.0 0.0.0.255 area 0
 network 192.168.101.0 0.0.0.3 area 0
!
router rip
 version 2
 network 192.168.2.0
 network 192.168.101.0
 no auto-summary
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

R3路由配置:

R3#sho run
Building configuration...

Current configuration : 900 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname R3
!
!
!
!
!
!
!
!
ip cef
no ipv6 cef
!
!
!
!
license udi pid CISCO2911/K9 sn FTX1524BAIV-
!
!
!
!
!
!
!
!
!
!
!
spanning-tree mode pvst
!
!
!
!
!
!
interface GigabitEthernet0/0
 ip address 192.168.101.14 255.255.255.252
 duplex auto
 speed auto
!
interface GigabitEthernet0/1
 ip address 192.168.101.10 255.255.255.252
 duplex auto
 speed auto
!
interface GigabitEthernet0/2
 ip address 192.168.3.254 255.255.255.0
 duplex auto
 speed auto
!
interface Vlan1
 no ip address
 shutdown
!
router ospf 1
 log-adjacency-changes
 network 192.168.3.0 0.0.0.255 area 0
!
router rip
 version 2
 network 192.168.3.0
 network 192.168.101.0
 no auto-summary
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
!
line con 0
!
line aux 0
!
line vty 0 4
 login
!
!
!
end

 R0路由表:

R0#sho ip route 
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

     192.168.0.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.0.0/24 is directly connected, GigabitEthernet0/0
L       192.168.0.253/32 is directly connected, GigabitEthernet0/0
     192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.1.0/24 is directly connected, GigabitEthernet0/1
L       192.168.1.254/32 is directly connected, GigabitEthernet0/1
R    192.168.2.0/24 [120/2] via 192.168.101.2, 00:00:17, GigabitEthernet0/2
R    192.168.3.0/24 [120/2] via 192.168.101.2, 00:00:17, GigabitEthernet0/2
     192.168.101.0/24 is variably subnetted, 5 subnets, 2 masks
C       192.168.101.0/30 is directly connected, GigabitEthernet0/2
L       192.168.101.1/32 is directly connected, GigabitEthernet0/2
R       192.168.101.4/30 [120/1] via 192.168.101.2, 00:00:17, GigabitEthernet0/2
R       192.168.101.8/30 [120/2] via 192.168.101.2, 00:00:17, GigabitEthernet0/2
R       192.168.101.12/30 [120/1] via 192.168.101.2, 00:00:17, GigabitEthernet0/2

  

R1路由表:

R1#sho ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

O    192.168.0.0/24 [110/2] via 192.168.101.1, 00:27:10, GigabitEthernet0/0
O    192.168.1.0/24 [110/2] via 192.168.101.1, 00:27:10, GigabitEthernet0/0
R    192.168.2.0/24 [120/1] via 192.168.101.6, 00:00:04, GigabitEthernet0/2
R    192.168.3.0/24 [120/1] via 192.168.101.14, 00:00:02, GigabitEthernet0/1
     192.168.101.0/24 is variably subnetted, 7 subnets, 2 masks
C       192.168.101.0/30 is directly connected, GigabitEthernet0/0
L       192.168.101.2/32 is directly connected, GigabitEthernet0/0
C       192.168.101.4/30 is directly connected, GigabitEthernet0/2
L       192.168.101.5/32 is directly connected, GigabitEthernet0/2
R       192.168.101.8/30 [120/1] via 192.168.101.6, 00:00:04, GigabitEthernet0/2
                         [120/1] via 192.168.101.14, 00:00:02, GigabitEthernet0/1
C       192.168.101.12/30 is directly connected, GigabitEthernet0/1
L       192.168.101.13/32 is directly connected, GigabitEthernet0/1

  

R2路由表:

R2#sho ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

R    192.168.0.0/24 [120/2] via 192.168.101.5, 00:00:17, GigabitEthernet0/2
R    192.168.1.0/24 [120/2] via 192.168.101.5, 00:00:17, GigabitEthernet0/2
     192.168.2.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.2.0/24 is directly connected, GigabitEthernet0/0
L       192.168.2.254/32 is directly connected, GigabitEthernet0/0
R    192.168.3.0/24 [120/1] via 192.168.101.10, 00:00:20, GigabitEthernet0/1
     192.168.101.0/24 is variably subnetted, 6 subnets, 2 masks
R       192.168.101.0/30 [120/1] via 192.168.101.5, 00:00:17, GigabitEthernet0/2
C       192.168.101.4/30 is directly connected, GigabitEthernet0/2
L       192.168.101.6/32 is directly connected, GigabitEthernet0/2
C       192.168.101.8/30 is directly connected, GigabitEthernet0/1
L       192.168.101.9/32 is directly connected, GigabitEthernet0/1
R       192.168.101.12/30 [120/1] via 192.168.101.5, 00:00:17, GigabitEthernet0/2
                          [120/1] via 192.168.101.10, 00:00:20, GigabitEthernet0/1

  

R3路由表:

R3#sho ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

R    192.168.0.0/24 [120/2] via 192.168.101.13, 00:00:15, GigabitEthernet0/0
R    192.168.1.0/24 [120/2] via 192.168.101.13, 00:00:15, GigabitEthernet0/0
R    192.168.2.0/24 [120/1] via 192.168.101.9, 00:00:18, GigabitEthernet0/1
     192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
C       192.168.3.0/24 is directly connected, GigabitEthernet0/2
L       192.168.3.254/32 is directly connected, GigabitEthernet0/2
     192.168.101.0/24 is variably subnetted, 6 subnets, 2 masks
R       192.168.101.0/30 [120/1] via 192.168.101.13, 00:00:15, GigabitEthernet0/0
R       192.168.101.4/30 [120/1] via 192.168.101.13, 00:00:15, GigabitEthernet0/0
                         [120/1] via 192.168.101.9, 00:00:18, GigabitEthernet0/1
C       192.168.101.8/30 is directly connected, GigabitEthernet0/1
L       192.168.101.10/32 is directly connected, GigabitEthernet0/1
C       192.168.101.12/30 is directly connected, GigabitEthernet0/0
L       192.168.101.14/32 is directly connected, GigabitEthernet0/0

  

 

最后的测试结果,从PC0到PC2  PC3

思科模拟器做RIP&OSPF实验_OSPF_02

 

思科模拟器做RIP&OSPF实验_EIGRP_03

 

思科模拟器做RIP&OSPF实验_R3_04