天天看點

「幹貨」史上最全的OSPF綜合實驗,還不趕緊收藏起來?

作者:微笑橙子mR

今天給大家分享的是OSPF綜合實驗,OSPF的理論一旦掌握好,實驗其實就非常簡單了,那麼下面大家就打開Ensp模拟器開啟實驗之旅吧!

「幹貨」史上最全的OSPF綜合實驗,還不趕緊收藏起來?

實驗需求

按照圖示配置好IP位址,PC1網關指向為R8

OSPF劃分為4個區域,其中192.168.0.0/24,192.168.1.0/24,192.168.2.0/24屬于AREA 0,192.168.10.0/24屬于AREA1,192.168.4.0/24,100.0.0.0/24屬于AREA2,192.168.5.0,100.1.1.0/24屬于AREA3

為了防止鍊路中斷引起的骨幹區域隔離,在R3和R4上配置虛連接配接

在R5上配置到達172.16.0.0/24和172.16.1.0/24網段的靜态路由,并引入到OSPF内部

在R7和R8上配置預設路由,下一跳指向R5和R6

在ASBR上對172.16.0.0/24和172.16.1.0/24網段進行準确的路由聚合

在R3和R4上分别對AREA 0的網段進行路由聚合

将AREA3配置為NSSA區域

在R6上配置到達100.2.2.0/24網段的靜态路由,并引入到AREA3

在AREA0配置區域認證,密碼為123456

實驗步驟

01

配置相應接口IP位址及loopback 環回口位址

02按照圖示分區域配置OSPF

AR1

[Huawei]ospf

[Huawei-ospf-1]area 0

[Huawei-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.0.255

[Huawei-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255

AR2

[Huawei]ospf

[Huawei-ospf-1]area

[Huawei-ospf-1]area 0

[Huawei-ospf-1-area-0.0.0.0]net

[Huawei-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.0.255

[Huawei-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255

[Huawei-ospf-1-area-0.0.0.0]ar

[Huawei-ospf-1-area-0.0.0.0]arp-ping

[Huawei-ospf-1-area-0.0.0.0]area

[Huawei-ospf-1-area-0.0.0.0]area

[Huawei-ospf-1-area-0.0.0.0]area 3

[Huawei-ospf-1-area-0.0.0.3]net

[Huawei-ospf-1-area-0.0.0.3]network 192.168.5.0 0.0.0.255

[Huawei-ospf-1-area-0.0.0.3]area 1

[Huawei-ospf-1-area-0.0.0.1]net

[Huawei-ospf-1-area-0.0.0.1]network 192.168.10.0 0.0.0.255

AR3

[Huawei]ospf

[Huawei-ospf-1]area 0

[Huawei-ospf-1-area-0.0.0.0]net

[Huawei-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255

[Huawei-ospf-1-area-0.0.0.0]area 1

[Huawei-ospf-1-area-0.0.0.1]network 192.168.10.0 0.0.0.255

[Huawei-ospf-1-area-0.0.0.1]area 2

[Huawei-ospf-1-area-0.0.0.2]net

[Huawei-ospf-1-area-0.0.0.2]network 192.168.4.0 0.0.0.255

AR4

[Huawei]ospf

[Huawei-ospf-1]area 0

[Huawei-ospf-1-area-0.0.0.0]net

[Huawei-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255

AR5

[Huawei]ospf

[Huawei-ospf-1]ar

[Huawei-ospf-1]area 2

[Huawei-ospf-1-area-0.0.0.2]net

[Huawei-ospf-1-area-0.0.0.2]network 192.168.4.0 0.0.0.255

[Huawei-ospf-1-area-0.0.0.2]network 100.0.0.0 0.0.0.255

AR6

[Huawei]ospf

[Huawei-ospf-1]ar

[Huawei-ospf-1]area 3

[Huawei-ospf-1-area-0.0.0.3]net

[Huawei-ospf-1-area-0.0.0.3]network 192.168.5.0 0.0.0.255

[Huawei-ospf-1-area-0.0.0.3]net

[Huawei-ospf-1-area-0.0.0.3]network 100.1.1.0 0.0.0.255

03在R3和R4上配置虛連接配接

AR3

[Huawei-ospf-1-area-0.0.0.1]vlink-peer 192.168.10.2

AR4

[Huawei-ospf-1-area-0.0.0.1]vlink-peer 192.168.1.1

04靜态路由,并引入到OSPF内部

AR5

[Huawei]IP route-static 172.16.0.1 24 100.0.0.1

[Huawei]IP route-static 172.16.1.1 24 100.0.0.1

[Huawei-ospf-1]import-route static

在AR3上檢視OSPF 路由表

[Huawei]dis ip routing-table protocol ospf

Route Flags: R - relay, D - download to fib

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

Public routing table : OSPF

Destinations : 7 Routes : 7

OSPF routing table status : <Active>

Destinations : 7 Routes : 7

Destination/Mask Proto Pre Cost Flags NextHop Interface

100.0.0.0/24 OSPF 10 2 D 192.168.4.1 GigabitEthernet

0/0/2

100.1.1.0/24 OSPF 10 3 D 192.168.10.2 GigabitEthernet

0/0/1

172.16.0.0/24 O_ASE 150 1 D 192.168.4.1 GigabitEthernet

0/0/2

172.16.1.0/24 O_ASE 150 1 D 192.168.4.1 GigabitEthernet

0/0/2

192.168.0.0/24 OSPF 10 2 D 192.168.1.2 GigabitEthernet

0/0/0

192.168.2.0/24 OSPF 10 2 D 192.168.10.2 GigabitEthernet

0/0/1

192.168.5.0/24 OSPF 10 2 D 192.168.10.2 GigabitEthernet

0/0/1

05在R7和R8上配置預設路由,下一跳指向R5和R6

AR7

[Huawei]ip route-static 192.168.4.0 24 100.0.0.2

AR8

[Huawei]ip route-static 192.168.5.0 24 100.1.1.1

06在ASBR上對172.16.0.0/24和172.16.1.0/24網段進行準确的路由聚合

[Huawei-ospf-1]asbr-summary 172.16.0.0 255.255.254.0

在AR7上PING 測試連通性

[Huawei]ping 192.168.4.1

PING 192.168.4.1: 56 data bytes, press CTRL_C to break

Reply from 192.168.4.1: bytes=56 Sequence=1 ttl=255 time=30 ms

Reply from 192.168.4.1: bytes=56 Sequence=2 ttl=255 time=40 ms

Reply from 192.168.4.1: bytes=56 Sequence=3 ttl=255 time=10 ms

Reply from 192.168.4.1: bytes=56 Sequence=4 ttl=255 time=40 ms

Reply from 192.168.4.1: bytes=56 Sequence=5 ttl=255 time=10 ms

--- 192.168.4.1 ping statistics ---

5 packet(s) transmitted

5 packet(s) received

0.00% packet loss

round-trip min/avg/max = 10/26/40 ms

在AR8上測試連通性

[Huawei]ping 192.168.5.1

PING 192.168.5.1: 56 data bytes, press CTRL_C to break

Reply from 192.168.5.1: bytes=56 Sequence=1 ttl=254 time=30 ms

Reply from 192.168.5.1: bytes=56 Sequence=2 ttl=254 time=30 ms

Reply from 192.168.5.1: bytes=56 Sequence=3 ttl=254 time=30 ms

Reply from 192.168.5.1: bytes=56 Sequence=4 ttl=254 time=20 ms

Reply from 192.168.5.1: bytes=56 Sequence=5 ttl=254 time=30 ms

--- 192.168.5.1 ping statistics ---

5 packet(s) transmitted

5 packet(s) received

0.00% packet loss

round-trip min/avg/max = 20/28/30 ms

07在R3和R4上分别對AREA 0的網段進行路由聚合

AR3

abr-summary 192.168.0.0 255.255.252.0

AR4

abr-summary 192.168.0.0 255.255.252.0

檢視OSPF 路由表,發現已經聚合

[Huawei]DIS IP routing-table protocol ospf

Route Flags: R - relay, D - download to fib

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

Public routing table : OSPF

Destinations : 5 Routes : 5

OSPF routing table status : <Active>

Destinations : 5 Routes : 5

Destination/Mask Proto Pre Cost Flags NextHop Interface

100.0.0.0/24 OSPF 10 4 D 192.168.5.1 GigabitEthernet

0/0/1

172.16.0.0/23 O_ASE 150 2 D 192.168.5.1 GigabitEthernet

0/0/1

192.168.0.0/22 OSPF 10 3 D 192.168.5.1 GigabitEthernet

0/0/1

192.168.4.0/24 OSPF 10 3 D 192.168.5.1 GigabitEthernet

0/0/1

192.168.10.0/24 OSPF 10 2 D 192.168.5.1 GigabitEthernet

0/0/1

08将AREA3配置為NSSA區域

AR4

[Huawei]ospf

[Huawei-ospf-1]area 3

[Huawei-ospf-1-area-0.0.0.3]nssa

AR6

[Huawei]ospf

[Huawei-ospf-1]area 3

[Huawei-ospf-1-area-0.0.0.3]nssa

09在R6上配置到達100.2.2.0/24網段的靜态路由,并引入到AREA3

AR6

[Huawei]ip route-static 100.2.2.0 24 100.1.1.2

[Huawei-ospf-1]import-route static

010在AREA0配置區域認證,密碼為123456

AR1

[Huawei-ospf-1-area-0.0.0.0]authentication-mode simple cipher 123456

AR2

[Huawei-ospf-1-area-0.0.0.0]authentication-mode simple cipher 123456

AR3

[Huawei-ospf-1-area-0.0.0.0]authentication-mode simple cipher 123456

AR4

[Huawei-ospf-1-area-0.0.0.0]authentication-mode simple cipher 123456

繼續閱讀