![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLiYTMfhHLlN3XnxCM38FdsYkRGZkRG9lcvx2bjxCMy8VZ6l2cs0TP3pVdsdkYzRWbiZHbHVWQClGVF5UMR9Fd4VGdsATNfd3bkFGazxycykFaKdkYzZUbapXNXlleSdVY2pESa9VZwlHdssmch1mclRXY39CXldWYtlWPzNXZj9mcw1ycz9WL49zZuBnLlNDM3YGOwcTY5EDNhZWMiRWM3QzYxUjM0UjMwgDNhR2Lc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
按照要求搭建拓撲圖:
在連線時候注意area0區域内的路由器連線的時候用的是序列槽,需要先在路由器添加接口,然後再用Serial線連接配接。
按照要求劃分網段:
實際工作中劃分考慮:
1.先按照網路中具體幾種協定。
2.考慮具體由幾個區域。
此處因為RIP所需要的網段較少,就按照一個OSPF區域劃分。
172.16.0.0/16
172.16.0.0/19 --- A0
172.16.0.0/24 --- p2p骨幹(一般24位,可用的主機位8位,可以容納254台主機)
172.16.0.0/30 (骨幹一般隻需要兩個網段,是以給兩位)
172.16.0.4/30
172.16.0.8/30
172.16.0.12/30
. . . .
172.16.1.0/24 --- MA骨幹
172.16.1.0/29
172.16.1.8/29
172.16.1.16/29
172.16.1.24/29
. . . .
172.16.2.0/24
172.16.3.0/24
. . .
172.16.32.0/19 --- A1
172.16.64.0/19 --- A2
172.16.96.0/19 --- A3
172.16.128.0/19 --- A4
172.16.160.0/19 --- rip
172.16.160.0/20
172.16.176.0/20
172.16.192.0/19 --- 保留(擴充的時候使用)
172.16.224.0/19 --- 保留
R3:
R4:
R5:
R6:
R7:
搭建MGRE環境
R3:
[r3]int t 0/0/0
[r3-Tunnel0/0/0]ip add 172.16.1.1 29
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp
[r3-Tunnel0/0/0]source 34.0.0.1
Oct 7 2021 19:31:57-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]nhrp entry multicast dynamic
R5:
[r5]int t 0/0/0
[r5-Tunnel0/0/0]ip add 172.16.1.2 29
[r5-Tunnel0/0/0]tunnel-protocol gre p2mp
[r5-Tunnel0/0/0]source Serial 4/0/0
Oct 7 2021 19:35:50-08:00 r5 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r5-Tunnel0/0/0]nhrp network-id 100
[r5-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register
R6:
[r6]int t 0/0/0
[r6-Tunnel0/0/0]ip add 172.16.1.3 29
[r6-Tunnel0/0/0]tunnel-protocol gre p2mp
[r6-Tunnel0/0/0]source Serial 4/0/0
Oct 7 2021 19:39:01-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r6-Tunnel0/0/0]nhrp network-id 100
[r6-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register
R7:
[r7]int t 0/0/0
[r7-Tunnel0/0/0]ip add 172.16.1.4 29
[r7-Tunnel0/0/0]tunnel-protocol gre p2mp
[r7-Tunnel0/0/0]source GigabitEthernet 0/0/0
Oct 7 2021 19:41:44-08:00 r7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface Tunnel0/0/0 has entered the UP state.
[r7-Tunnel0/0/0]nhrp network-id 100
[r7-Tunnel0/0/0]nhrp entry 172.16.1.1 34.0.0.1 register
檢視注冊資訊:
檢驗效果:
area0環回:
[r5]int l 0
[r5-LoopBack0]ip add 172.16.2.1 24
[r6]int l 0
[r6-LoopBack0]ip add 172.16.3.1 24
[r7-Tunnel0/0/0]int l 0
[r7-LoopBack0]ip add 172.16.4.1 24
區域一: AR1:
[Huawei]sys r1
[r1]int g 0/0/0
[r1-GigabitEthernet0/0/0]ip add 172.16.33.1 29
Oct 7 2021 19:52:20-08:00 r1 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r1-GigabitEthernet0/0/0]int l0
[r1-LoopBack0]ip add 172.16.34.1 24
AR2:
[Huawei]sys r2
[r2]int g 0/0/0
[r2-GigabitEthernet0/0/0]ip add 172.16.33.2 29
Oct 7 2021 19:54:57-08:00 r2 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r2-GigabitEthernet0/0/0]int l0
[r2-LoopBack0]ip add 172.16.35.1 24
AR3:
[r3]int g 0/0/0
[r3-GigabitEthernet0/0/0]ip add 172.16.33.3 29
Oct 7 2021 19:56:02-08:00 r3 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r3-GigabitEthernet0/0/0]int l0
[r3-LoopBack0]ip add 172.16.36.1 24
[r3-LoopBack0]
區域二:
AR6:
[r6]int G 0/0/0
[r6-GigabitEthernet0/0/0]ip add 172.16.65.1 29
[r6-GigabitEthernet0/0/0]
Oct 7 2021 19:58:05-08:00 r6 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
AR11:
[r11]int g 0/0/0
[r11-GigabitEthernet0/0/0]ip add 172.16.65.2 29
Oct 7 2021 19:59:09-08:00 r11 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r11-GigabitEthernet0/0/0]int g 0/0/1
[r11-GigabitEthernet0/0/1]ip add 172.16.65.9 29
Oct 7 2021 19:59:35-08:00 r11 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r11-GigabitEthernet0/0/1]int l0
[r11-LoopBack0]ip add 172.16.66.1 24
AR12:
[r12]int g 0/0/0
[r12-GigabitEthernet0/0/0]ip add 172.16.65.10 29
Oct 7 2021 20:01:02-08:00 r12 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
區域三:
AR7:
[r7]int g 0/0/1
[r7-GigabitEthernet0/0/1]ip add 172.16.97.1 29
[r7-GigabitEthernet0/0/1]
Oct 7 2021 20:02:27-08:00 r7 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
AR8:
[Huawei]int g 0/0/0
[Huawei-GigabitEthernet0/0/0]q
[Huawei]sys r8
[r8]int g0/0/0
[r8-GigabitEthernet0/0/0]ip add 172.16.97.2 29
Oct 7 2021 20:03:41-08:00 r8 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r8-GigabitEthernet0/0/0]int g 0/0/1
[r8-GigabitEthernet0/0/1]ip add 172.16.97.9 29
Oct 7 2021 20:03:56-08:00 r8 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r8-GigabitEthernet0/0/1]int l0
[r8-LoopBack0]ip add 172.16.98.1 24
AR9:
[Huawei]sys r9
[r9]int g 0/0/0
[r9-GigabitEthernet0/0/0]ip add 172.16.97.10 29
Oct 7 2021 20:04:57-08:00 r9 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r9-GigabitEthernet0/0/0]int g0/0/1
[r9-GigabitEthernet0/0/1]ip add 172.16.129.1 24
Oct 7 2021 20:05:51-08:00 r9 %%01IFNET/4/LINK_STATE(l)[1]:The line protocol IP
on the interface GigabitEthernet0/0/1 has entered the UP state.
[r9-GigabitEthernet0/0/1]int l0
[r9-LoopBack0]ip add 172.16.130.1 24
區域四:
AR10:
[Huawei]sys r10
[r10]int g0/0/0
[r10-GigabitEthernet0/0/0]ip add 172.16.129.2 29
Oct 7 2021 20:07:21-08:00 r10 %%01IFNET/4/LINK_STATE(l)[0]:The line protocol IP
on the interface GigabitEthernet0/0/0 has entered the UP state.
[r10-GigabitEthernet0/0/0]int l0
[r10-LoopBack0]ip add 172.16.131.1 24
RIP:
AR12:
[r12]int l0
[r12-LoopBack0]ip add 172.16.160.1 20
[r12-LoopBack0]int l1
[r12-LoopBack1]ip add 172.16.176.1 20
激活OSPF: AR1:
[r1]ospf 1 router-id 1.1.1.1
[r1-ospf-1]a 1
[r1-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255
AR2:
[r2]ospf 1 router-id 2.2.2.2
[r2-ospf-1]a 1
[r2-ospf-1-area-0.0.0.1]network 172.16.0.0 0.0.255.255
AR3:
[r3]ospf 1 router-id 3.3.3.3
[r3-ospf-1]a 1
[r3-ospf-1-area-0.0.0.1]network 172.16.32.0 0.0.7.255
[r3-ospf-1-area-0.0.0.1]a 0
[r3-ospf-1-area-0.0.0.0]network 172.16.1.1 0.0.0.0
AR5:
[r5]ospf 1 router-id 5.5.5.5
[r5-ospf-1]a 0
[r5-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.255.255
AR6:
[r6]ospf 1 router-id 6.6.6.6
[r6-ospf-1]a 0
[r6-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.3.255
[r6-ospf-1-area-0.0.0.0]q
[r6-ospf-1]a 2
[r6-ospf-1-area-0.0.0.2]network 172.16.65.1 0.0.0.0
AR7:
[r7]ospf 1 router-id 7.7.7.7
[r7-ospf-1]a 0
[r7-ospf-1-area-0.0.0.0]network 172.16.0.0 0.0.7.255
[r7-ospf-1-area-0.0.0.0]q
[r7-ospf-1]a 3
[r7-ospf-1-area-0.0.0.3]network 172.16.97.1 0.0.0.0
AR8:
[r8]ospf 1 router-id 8.8.8.8
[r8-ospf-1]a 3
[r8-ospf-1-area-0.0.0.3]network 172.16.0.0 0.0.255.255
AR9:
[r9]ospf 1 router-id 9.9.9.9
[r9-ospf-1]a 3
[r9-ospf-1-area-0.0.0.3]network 172.16.97.10 0.0.0.0
[r9-ospf-1-area-0.0.0.3]q
[r9-ospf-1]a 4
[r9-ospf-1-area-0.0.0.4]netw
[r9-ospf-1-area-0.0.0.4]network 172.16.128.0 0.0.3.255
AR10:
[r10]ospf 1 ro
[r10]ospf 1 router-id 10.10.10.10
[r10-ospf-1]a 4
[r10-ospf-1-area-0.0.0.4]network 172.16.0.0 0.0.255.255
AR11:
[r11]ospf 1 rou
[r11]ospf 1 router-id 11.11.11.11
[r11-ospf-1]a 2
[r11-ospf-1-area-0.0.0.2]network 172.16.0.0 0.0.255.255
[r11-ospf-1-area-0.0.0.2]q
AR12:
[r12]ospf 1 rou
[r12]ospf 1 router-id 12.12.12.12
[r12-ospf-1]a 2
[r12-ospf-1-area-0.0.0.2]network 172.16.65.10 0.0.0.0
[r12-ospf-1-area-0.0.0.2]q
[r12]rip
[r12-rip-1]v 2
[r12-rip-1]net
[r12-rip-1]network 172.16.0.0
我們建立的MGRE環境是一個P2P類型,是以他無法和其他路由器建立鄰居關系,我們需要修改它的網絡類型,讓他和其他路由器建立鄰居關系。
AR3:
[r3]int t 0/0/0
[r3-Tunnel0/0/0]ospf network-type p2mp
AR5,AR6,AR7,同樣操作
檢視路由表我們發現我們還缺少area4區域和rip區域的路由,這裡我們使用重釋出的方式導入rip路由和area4的路由資訊
[R12]ospf 1
[R12-ospf-1]import-route rip 1
AR9:
[r9]os
[r9]ospf 1
[r9-ospf-1]a 4
[r9-ospf-1-area-0.0.0.4]undo network 172.16.128.0 0.0.3.255
[r9-ospf-1-area-0.0.0.4]q
[r9-ospf-1]undo a 4
[r9-ospf-1]display this
[V200R003C00]
#
ospf 1 router-id 9.9.9.9
area 0.0.0.3
network 172.16.97.10 0.0.0.0
#
return
[r9-ospf-1]q
[r9]ospf 2 router-id 9.9.9.9
[r9-ospf-2]a 4
[r9-ospf-2-area-0.0.0.4]network 172.16.128.0 0.0.3.255
為了減少LSA的更新量,我們需要做彙總與特殊區域
彙總如下(在彙總時為了避免環路我們還需要配置空接口路由):
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]abr-summary 172.16.32.0 255.255.224.0
[R3]ip route-static 172.16.32.0 19 NULL 0
[R6]ospf 1
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]abr-summary 172.16.64.0 255.255.224.0
[R6]ip route-static 172.16.64.0 19 NULL 0
[R7]ospf 1
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]abr-summary 172.16.96.0 255.255.224.0
[R7]ip route-static 172.16.96.0 19 NULL 0
[R9]ospf 1
[R9-ospf-1]asbr-summary 172.16.128.0 255.255.224.0
[R9]ip route-static 172.16.128.0 19 NULL 0
[R12]ospf 1
[R12-ospf-1]asbr-summary 172.16.160.0 255.255.224.0
[R12]ip route-static 172.16.160.0 19 NULL 0
配置特殊區域:
[R1]ospf 1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]stub
[R2]ospf 1
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]stub
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]stub no-summary
[R7]ospf 1
[R7-ospf-1]area 3
[R7-ospf-1-area-0.0.0.3]nssa no-summary
[R8]ospf 1
[R8-ospf-1]area 3
[R8-ospf-1-area-0.0.0.3]nssa
[R9]ospf 1
[R9-ospf-1]area 3
[R9-ospf-1-area-0.0.0.3]nssa
[R6]ospf 1
[R6-ospf-1]area 2
[R6-ospf-1-area-0.0.0.2]nssa no-summary
[R11]ospf 1
[R11-ospf-1]area 2
[R11-ospf-1-area-0.0.0.2]nssa
[R12]ospf 1
[R12-ospf-1]area 2
[R12-ospf-1-area-0.0.0.2]nssa
[R9]ospf 2
[R9-ospf-2]default-route-advertise
配置NAT環境,完成所有裝置均可通路R4的環回
[R3]acl 2000
[R3-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R3-acl-basic-2000]q
[R3]int Serial 4/0/0
[R3-Serial4/0/0]nat outbound 2000
[R7]acl 2000
[R7-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R7-acl-basic-2000]q
[R7]int g 0/0/0
[R7-GigabitEthernet0/0/0]nat outbound 2000
[R6]acl 2000
[R6-acl-basic-2000]rule permit source 172.16.0.0 0.0.255.255
[R6-acl-basic-2000]q
[R6]int s 4/0/0
[R6-Serial4/0/0]nat outbound 2000
加快收斂
減少計時器時間
[R5]int t 0/0/0
[R5-Tunnel0/0/0]ospf timer hello 5
[R3]int t 0/0/0
[R3-Tunnel0/0/0]ospf timer hello 5
[R6]int t 0/0/0
[R6-Tunnel0/0/0]ospf timer hello 5
[R7]int t 0/0/0
[R7-Tunnel0/0/0]ospf timer hello 5
保障更新安全
進行手工認證,采用區域認證(實際上也是接口認證)
[R2]ospf 1
[R2-ospf-1]area 1
[R2-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
[R1]ospf 1
[R1-ospf-1]area 1
[R1-ospf-1-area-0.0.0.1]authentication-mode md5 1 123456
[R3]ospf 1
[R3-ospf-1]area 1
[R3-ospf-1-area-0.0.0.1]authentication-mode md5 1 cipher 123456
測試全網可達: