您好,登錄后才能下訂單哦!
【實驗目的】
掌握在路由器上配置 OSPF 單區域。
【背景描述】
假設校園網通過 1 臺三層交換機連到校園網出口路由器,路由器再和校園外的另 1 臺
路由器連接,現做適當配置,實現校園網內部主機與校園網外部主機的相互通信。
本實驗以兩臺路由器、1 臺三層交換機為例。S3550 上劃分有 VLAN10 和 VLAN50,
其中 VLAN10 用于連接 RA,VLAN50 用于連接校園網主機。
【需求分析】
需要在路由器和交換機上配置 OSPF 路 由協議,使全網互通,從而實現信息的共享和
傳遞。
【實驗設備】
三層交換機 1 臺
路由器 2 臺
交叉線或直連線 3 條
【預備知識】
路由器基本配置知識、OSPF
【實驗原理】
OSPF(Open Shortest Path First,開放式最短路徑優先)協議,是目前網絡中應用最
廣泛的路由協議之一。屬于內部網關路由協議,能夠適應各種規模的網絡環境,是典型的鏈
路狀態(link-state)協議。
OSPF 路由協議通過向全網擴散本設備的鏈路狀態信息,使網絡中每臺設備最終同步一
個具有全網鏈路狀態的數據庫(LSDB),然后路由器采用 SPF 算法,以自己為根,計算到
達其他網絡的最短路徑,最終形成全網路由信息。
OSPF 屬于無類路由協議,支持 VLSM(變長子網掩碼)。OSPF 是以組播的形式進行
鏈路狀態的通告的。
在大模型的網絡環境中,OSPF 支持區域的劃分,將網絡進行合理規劃。劃分區域時必
須存在 area0(骨干區域)。其他區域和骨干區域直接相連,或通過虛鏈路的方式連接。
【實驗步驟】
第一步:在路由器和三層交換機配置 IP 地址
switch#configure terminal
switch(config)#hostname S3750
S3750(config)#vlan 10
S3750(config-vlan)#exit
S3750(config)#vlan 50
S3750(config-vlan)#exit
S3750(config)#interface f0/1
S3750(config-if)#switchport access vlan 10
S3750(config-if)#exit
S3750(config)#interface f0/2
S3750(config-if)#switchport access vlan 50
S3750(config-if)#exit
S3750(config)#interface vlan 10
S3750(config-if)#ip address 172.16.1.2 255.255.255.0
S3750(config-if)#no shutdown
S3750(config-if)#exit
S3750(config)#interface vlan 50
S3750(config-if)#ip address 172.16.5.1 255.255.255.0
S3750(config-if)#no shutdown
S3750(config-if)#exit
RouterA(config)# interface fastethernet 0/1
RouterA(config-if)# ip address 172.16.1.1 255.255.255.0
RouterA(config-if)# no shutdown
RouterA(config-if)#exit
RouterA(config)# interface fastethernet 0/0
RouterA(config-if)# ip address 172.16.2.1 255.255.255.0
RouterB(config-if)# no shutdown
RouterB(config)# interface fastethernet 0/1
RouterB(config-if)# ip address 172.16.3.1 255.255.255.0
RouterB(config-if)# no shutdown
RouterB(config-if)#exit
RouterB(config)# interface fastethernet 0/0
RouterB(config-if)# ip address 172.16.2.2 255.255.255.0
RouterB(config-if)# no shutdown
第二步:配置 OSPF 路由協議
S3750(config)#router ospf
S3750(config-router)#network 172.16.5.0 0.0.0.255 area 0
S3750(config-router)#network 172.16.1.0 0.0.0.255 area 0
S3750(config-router)#end
RouterA(config)# router ospf
RouterA(config-router)#network 172.16.1.0 0.0.0.255 area 0
RouterA(config-router)#network 172.16.2.0 0.0.0.255 area 0
RouterA(config-router)#end
RouterB(config)#router ospf
RouterB(config-router)#network 172.16.2.0 0.0.0.255 area 0
RouterB(config-router)#network 172.16.3.0 0.0.0.255 area 0
RouterB(config-router)#end
第三步:驗證測試
S3750#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -----------------------------------
1 VLAN0001 STATIC Fa0/3, Fa0/4, Fa0/5, 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/22
Fa0/19, Fa0/20, Fa0/21,
Fa0/23, Fa0/24, Gi0/25,
Gi0/26 ,Gi0/27, Gi0/28
10 VLAN0010 STATIC Fa0/1
50 VLAN0050 STATIC Fa0/2
S3750#show ip interface brief
Interface IP-Address(Pri) OK? Status
VLAN 10 172.16.1.2/24 YES UP
VLAN 50 172.16.5.1/24 YES UP
RA#show ip interface brief
Interface IP-Address(Pri) OK? Status
FastEthernet 0/0 172.16.2.1/24 YES UP
FastEthernet 0/1 172.16.1.1/24 YES UP
RB#show ip interface brief
Interface IP-Address(Pri) OK? Status
FastEthernet 0/0 172.16.2.2/24 YES UP
FastEthernet 0/1 172.16.1.3/24 YES UP
Loopback 0 no address YES DOWN
S3750#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 172.16.1.0/24 is directly connected, VLAN 10
C 172.16.1.2/32 is local host.
O 172.16.2.0/24 [110/2] via 172.16.1.1, 00:14:09, VLAN 10
O 172.16.3.0/24 [110/3] via 172.16.1.1, 00:04:39, VLAN 10
C 172.16.5.0/24 is directly connected, VLAN 50
C 172.16.5.1/32 is local host.
RA#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 172.16.1.0/24 is directly connected, FastEthernet 0/1
C 172.16.1.1/32 is local host.
C 172.16.2.0/24 is directly connected, FastEthernet 0/0
C 172.16.2.1/32 is local host.
O 172.16.3.0/24 [110/2] via 172.16.2.2, 00:05:21, FastEthernet 0/0
O 172.16.5.0/24 [110/2] via 172.16.1.2, 00:14:51, FastEthernet 0/1
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
O 172.16.1.0/24 [110/2] via 172.16.2.1, 00:05:58, FastEthernet 0/0
C 172.16.2.0/24 is directly connected, FastEthernet 0/0
C 172.16.2.2/32 is local host.
C 172.16.3.0/24 is directly connected, FastEthernet 0/1
C 172.16.3.1/32 is local host.
O 172.16.5.0/24 [110/3] via 172.16.2.1, 00:15:22, FastEthernet 0/0
RA#show ip ospf neighbor
OSPF process 1:
Neighbor ID Pri State Dead Time Address Interface
172.16.5.1 1 Full/DR 00:00:38 172.16.1.2 FastEthernet 0/1
172.16.2.2 1 Full/DR 00:00:36 172.16.2.2 FastEthernet 0/0
RA#show ip ospf interface fastEthernet 0/0
FastEthernet 0/0 is up, line protocol is up
Internet Address 172.16.2.1/24, Ifindex 1, Area 0.0.0.0, MTU 1500
Matching network config: 172.16.2.0/24
Process ID 1, Router ID 172.167.1.1, Network Type BROADCAST, Cost: 1
Transmit Delay is 1 sec, State BDR, Priority 1
Designated Router (ID) 172.16.2.2, Interface Address 172.16.2.2
Backup Designated Router (ID) 172.167.1.1, Interface Address 172.16.2.1
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:05
Neighbor Count is 1, Adjacent neighbor count is 1
Crypt Sequence Number is 82589
Hello received 114 sent 115, DD received 4 sent 5
LS-Req received 1 sent 1, LS-Upd received 5 sent 9
LS-Ack received 6 sent 4, Discarded 0
【注意事項】
1、在申明直連網段時,注意要寫該網段的反掩碼。
2、在申明直連網段時,必須指明所屬的區域。
【參考配置】
S3750#show running-config
Building configuration...
Current configuration : 1399 bytes
!
version RGNOS 10.1.00(4), Release(18443)(Tue Jul 17 19:51:54 CST 2007
-ubu6server)
hostname S3750
!
vlan 1
!
vlan 10
!
vlan 50
!
interface FastEthernet 0/1
switchport access vlan 10
!
interface FastEthernet 0/2
switchport access vlan 50
!
interface FastEthernet 0/3
!
interface FastEthernet 0/4
!
interface FastEthernet 0/5
!
interface FastEthernet 0/6
!
interface FastEthernet 0/7
!
interface FastEthernet 0/8
!
interface FastEthernet 0/9
!
interface FastEthernet 0/10
!
interface FastEthernet 0/11
!
interface FastEthernet 0/12
!
interface FastEthernet 0/13
!
interface FastEthernet 0/14
!
interface FastEthernet 0/15
!
interface FastEthernet 0/16
!
interface FastEthernet 0/17
!
interface FastEthernet 0/18
!
interface FastEthernet 0/19
!
interface FastEthernet 0/20
!
interface FastEthernet 0/21
!
interface FastEthernet 0/22
!
interface FastEthernet 0/23
!
interface FastEthernet 0/24
!
interface GigabitEthernet 0/25
!
interface GigabitEthernet 0/26
!
interface GigabitEthernet 0/27
!
interface GigabitEthernet 0/28
!
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 ospf 1
network 172.16.1.0 0.0.0.255 area 0
network 172.16.5.0 0.0.0.255 area 0
!
line con 0
line vty 0 4
login
!
end
RB#show running-config
Building configuration...
Current configuration : 579 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 172.16.2.2 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet 0/1
ip address 172.16.3.1 255.255.255.0
duplex auto
speed auto
!
interface Loopback 0
!
router ospf 1
network 172.16.2.0 0.0.0.255 area 0
network 172.16.3.0 0.0.0.255 area 0
!
line con 0
line aux 0
line vty 0 4
login
!
end
RA#show running-config
Building configuration...
Current configuration : 554 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 172.16.2.1 255.255.255.0
duplex auto
speed auto
!
interface FastEthernet 0/1
ip address 172.16.1.1 255.255.255.0
duplex auto
speed auto
!
router ospf 1
network 172.16.1.0 0.0.0.255 area 0
network 172.16.2.0 0.0.0.255 area 0
!
line con 0
line aux 0
line vty 0 4
login
!
end
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。