配置OSPF单区域

Target:


实验目的:

配置OSPF单区域实验,实现简单的OSPF配置。

背景描述:

拓扑图中有三台路由器,共有五个网段,并且是无类的子网。

需求分析:

在本拓扑图中使用OSPF路由协议学习路由信息,并且使用的是单区域,所有的路由器都在区域0中。

实验原理:

在路由器上启用OSFP进程,使用所有的路由信息通过OSFP路由协议传递。

实验拓扑图:

   Router Configuration<10>_OSPF 基本配置    


Step:

第一步:在路由器上配置IP地址

RA#config t

RA(config)# interface FastEthernet 0/0

RA(config-if)#ip address 192.168.20.1 255.255.255.252

RA(config)#interface Loopback 0

RA(config-if)#ip address 192.168.30.9 255.255.255.248

RB#config t

RB(config)# interface FastEthernet 0/0

RB(config-if)#ip address 192.168.20.2 255.255.255.252

RB(config)#interface FastEthernet 0/1

RB(config-if)#ip address 192.168.10.1 255.255.255.224

RC#config t

RC(config)# interface FastEthernet 0/0

RC(config-if)#ip address 192.168.10.2 255.255.255.224

RC(config)#interface Loopback 0

RC(config-if)#ip address 192.168.10.33 255.255.255.240

RC(config)#interface Loopback 1

RC(config-if)#ip address 192.168.10.65 255.255.255.192

第二步:配置OSPF

RA(config)#router ospf 10

RA(config-router)#network 192.168.30.8 0.0.0.7 area 0

RA(config-router)#network 192.168.20.0 0.0.0.3 area 0

RB(config)# router ospf 10

RB(config-router)#network 192.168.10.0 0.0.0.31 area 0

RB(config-router)#network 192.168.20.0 0.0.0.3 area 0

RC(config)# router ospf 10

RC(config-router)#network 192.168.10.0 0.0.0.31 area 0

RC(config-router)#network 192.168.10.32 0.0.0.15 area 0

RC(config-router)#network 192.168.10.64 0.0.0.63 area 0

第三步:验证测试

RA#show ip interface brief

Interface IP-Address(Pri) OK? Status

FastEthernet 0/0 192.168.20.1/30 YES UP

FastEthernet 0/1 no address YES DOWN

Loopback 0 192.168.30.9/29 YES UP

RB#show ip interface brief

Interface IP-Address(Pri) OK? Status

FastEthernet 0/0 192.168.20.2/30 YES UP

FastEthernet 0/1 192.168.10.1/27 YES UP

RC#show ip interface brief

Interface IP-Address(Pri) OK? Status

FastEthernet 0/0 192.168.10.2/27 YES UP

FastEthernet 0/1 no address YES DOWN

Loopback 0 192.168.10.33/28 YES UP

Loopback 1 192.168.10.65/26 YES UP

用命令show ip route和sh ip ospf neighbor来验证配置

RA#sh ip route

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

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

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default

Gateway of last resort is no set

O 192.168.10.0/27 [110/2] via 192.168.20.2, 00:01:32, FastEthernet 0/0

C 192.168.30.8/29 is directly connected, Loopback 0

C 192.168.30.9/32 is local host.

O 192.168.10.33/32 [110/2] via 192.168.20.2, 00:01:32, FastEthernet 0/0

O 192.168.10.65/32 [110/2] via 192.168.20.2, 00:01:32, FastEthernet 0/0

C 192.168.20.0/30 is directly connected, FastEthernet 0/0

C 192.168.20.1/32 is local host.

RB#show ip route

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

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

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default

Gateway of last resort is no set

C 192.168.10.0/27 is directly connected, FastEthernet 0/1

C 192.168.10.1/32 is local host.

O 192.168.10.33/32 [110/1] via 192.168.10.2, 00:02:25, FastEthernet 0/1

O 192.168.10.65/32 [110/1] via 192.168.10.2, 00:02:14, FastEthernet 0/1

C 192.168.20.0/30 is directly connected, FastEthernet 0/0

C 192.168.20.2/32 is local host.

O 192.168.30.9/32 [110/1] via 192.168.20.1, 00:05:16, FastEthernet 0/0

RC#show ip route

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

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

i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area

* - candidate default

Gateway of last resort is no set

C 192.168.10.0/27 is directly connected, FastEthernet 0/0

C 192.168.10.2/32 is local host.

C 192.168.10.32/28 is directly connected, Loopback 0

C 192.168.10.33/32 is local host.

C 192.168.10.64/26 is directly connected, Loopback 1

C 192.168.10.65/32 is local host.

O 192.168.20.0/30 [110/2] via 192.168.10.1, 00:01:23, FastEthernet 0/0

O 192.168.30.9/32 [110/2] via 192.168.10.1, 00:01:23, FastEthernet 0/0

RB#show ip ospf neighbor

OSPF process 1:

Neighbor ID Pri State Dead Time Address Interface

192.168.10.65 1 Full/BDR 00:00:38 192.168.10.2 FastEthernet 0/1

192.168.30.9 1 Full/DR 00:00:33 192.168.20.1 FastEthernet 0/0

RB#show ip ospf neighbor detail

Neighbor 192.168.10.65, interface address 192.168.10.2

In the area 0.0.0.0 via interface FastEthernet 0/1

Neighbor priority is 1, State is Full, 5 state changes

DR is 192.168.10.1, BDR is 192.168.10.2

Options is 0x42 (*|O|-|-|-|-|E|-)

Dead timer due in 00:00:37

Neighbor is up for 00:04:33

Database Summary List 0

Link State Request List 0

Link State Retransmission List 0

Crypt Sequence Number is 0

Thread Inactivity Timer on

Thread Database Description Retransmission off

Thread Link State Request Retransmission off

Thread Link State Update Retransmission off

Neighbor 192.168.30.9, interface address 192.168.20.1

In the area 0.0.0.0 via interface FastEthernet 0/0

Neighbor priority is 1, State is Full, 6 state changes

DR is 192.168.20.1, BDR is 192.168.20.2

Options is 0x42 (*|O|-|-|-|-|E|-)

Dead timer due in 00:00:30

Neighbor is up for 00:07:50

Database Summary List 0

Link State Request List 0

Link State Retransmission List 0

Crypt Sequence Number is 0

Thread Inactivity Timer on

Thread Database Description Retransmission off

Thread Link State Request Retransmission off

Thread Link State Update Retransmission off

【备注事项】

在做本实验前,注意子网掩码的换算。

【参考配置】

RA#show running-config

Building configuration...

Current configuration : 587 bytes

!

version RGNOS 10.1.00(4), Release(18443)(Tue Jul 17 20:50:30 CST 2007 -ubu1server)

hostname RA

!

interface FastEthernet 0/0

ip address 192.168.20.1 255.255.255.252

duplex auto

speed auto

!

interface FastEthernet 0/1

duplex auto

speed auto

!

interface Loopback 0

ip address 192.168.30.9 255.255.255.248

!

router ospf 1

network 192.168.20.0 0.0.0.3 area 0

network 192.168.30.8 0.0.0.7 area 0

!

line con 0

line aux 0

line vty 0 4

login

!

end

RB#show running-config

Building configuration...

Current configuration : 563 bytes

!

version RGNOS 10.1.00(4), Release(18443)(Tue Jul 17 20:50:30 CST 2007 -ubu1server)

hostname RB

!

interface FastEthernet 0/0

ip address 192.168.20.2 255.255.255.252

duplex auto

speed auto

!

interface FastEthernet 0/1

ip address 192.168.10.1 255.255.255.224

duplex auto

speed auto

!

router ospf 1

network 192.168.10.0 0.0.0.31 area 0

network 192.168.20.0 0.0.0.3 area 0

!

line con 0

line aux 0

line vty 0 4

login

!

end

RC#show running-config

Building configuration...

Current configuration : 699 bytes

!

version RGNOS 10.1.00(4), Release(18443)(Tue Jul 17 20:50:30 CST 2007 -ubu1server)

hostname RC

!

interface FastEthernet 0/0

ip address 192.168.10.2 255.255.255.224

duplex auto

speed auto

!

interface FastEthernet 0/1

duplex auto

speed auto

!

interface Loopback 0

ip address 192.168.10.33 255.255.255.240

!

interface Loopback 1

ip address 192.168.10.65 255.255.255.192

!

router ospf 1

network 192.168.10.0 0.0.0.31 area 0

network 192.168.10.32 0.0.0.15 area 0

network 192.168.10.64 0.0.0.63 area 0

!

line con 0

line aux 0

line vty 0 4

login

!

end