ospf实验

需求

要求:

1.如图连接,合理规划IP地址,所有路由器各自创建一个loopback接口

2.R1再创建三个接口IP地址为201.1.1.1/24、201.1.2.1/24、201.1.3.1/24

   R5再创建三个接口IP地址为202.1.1.1/24、202.1.2.1/24、202.1.3.1/24

   R7再创建三个接口IP地址为203.1.1.1/24、203.1.2.1/24、203.1.3.1/24

3.如图运行路由协议

   3.1 R1 -R2  -R3之间使用MGRE网络,为hub-spoke 网络结构,R1为hub端 ,

部署OSPF网络,MGRE修改为BMA网络类型

   3.2  R2-R3之间启用PPP pap 单项认证  , R3-R4之间启用PPP的chap双向认证

4.area  1  区域不得出现4.5类LSA

5.其他区域优先通过R3访问R1 三个环回接口

6.尽量减少路由条目数量

7.area 1 区域增加安全性

8.全网可达

实验步骤

1 配置合理IP

[r1]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              18.1.1.1/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         1.1.1.1/24           up         up(s)     
LoopBack1                         201.1.1.1/24         up         up(s)     
LoopBack2                         201.1.2.1/24         up         up(s)     
LoopBack3                         201.1.3.1/24         up         up(s)     
NULL0                             unassigned           up         up(s)     
[r2]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 3

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              28.1.1.1/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         2.2.2.2/24           up         up(s)     
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       24.1.1.1/24          up         up        
Serial4/0/1                       unassigned           down       down      
[r3]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 3
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 3

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              38.1.1.1/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         3.3.3.3/24           up         up(s)     
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       34.1.1.1/24          up         up        
[r4-LoopBack0]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              45.1.1.1/24          up         up        
GigabitEthernet0/0/1              46.1.1.1/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         4.4.4.4/24           up         up(s)     
NULL0                             unassigned           up         up(s)     
Serial4/0/0                       34.1.1.2/24          up         up        
Serial4/0/1                       24.1.1.2/24          up         up        
[r5]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              45.1.1.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         5.5.5.5/24           up         up(s)     
LoopBack1                         202.1.1.1/24         up         up(s)     
LoopBack2                         202.1.2.1/24         up         up(s)     
LoopBack3                         202.1.3.1/24         up         up(s)     
NULL0                             unassigned           up         up(s)     

[r6-GigabitEthernet0/0/1]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 1
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 1

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              46.1.1.2/24          up         up        
GigabitEthernet0/0/1              67.1.1.1/24          up         up        
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         6.6.6.6/24           up         up(s)     
NULL0                             unassigned           up         up(s)     
[r7-LoopBack3]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 6
The number of interface that is DOWN in Physical is 2
The number of interface that is UP in Protocol is 6
The number of interface that is DOWN in Protocol is 2

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              67.1.1.2/24          up         up        
GigabitEthernet0/0/1              unassigned           down       down      
GigabitEthernet0/0/2              unassigned           down       down      
LoopBack0                         7.7.7.7/24           up         up(s)     
LoopBack1                         203.1.1.1/24         up         up(s)     
LoopBack2                         203.1.2.1/24         up         up(s)     
LoopBack3                         203.1.3.1/24         up         up(s)     
NULL0                             unassigned           up         up(s)     
[r8]dis ip int b
*down: administratively down
^down: standby
(l): loopback
(s): spoofing
The number of interface that is UP in Physical is 4
The number of interface that is DOWN in Physical is 0
The number of interface that is UP in Protocol is 4
The number of interface that is DOWN in Protocol is 0

Interface                         IP Address/Mask      Physical   Protocol  
GigabitEthernet0/0/0              18.1.1.2/24          up         up        
GigabitEthernet0/0/1              28.1.1.2/24          up         up        
GigabitEthernet0/0/2              38.1.1.2/24          up         up        
NULL0                             unassigned           up         up(s)     

2  R1 -R2  -R3之间使用MGRE网络,为hub-spoke 网络结构,R1为hub端 ,

部署OSPF网络,MGRE修改为BMA网络类型

先配置三条缺省 让路由器先通

[r1]ip route-static 0.0.0.0 0 18.1.1.2
[r2]ip route-static 0.0.0.0 0 28.1.1.2 
[r3]ip route-static 0.0.0.0 0 38.1.1.2

进行hub-spoke配置

[r1-Tunnel0/0/0]tunnel-protocol g	
[r1-Tunnel0/0/0]tunnel-protocol gre ?
  p2mp  Point to multi-point GRE mode
  <cr>  Please press ENTER to execute command 
[r1-Tunnel0/0/0]tunnel-protocol gre p	
[r1-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r1-Tunnel0/0/0]source 18.1.1.1
[r1-Tunnel0/0/0]nhrp	
[r1-Tunnel0/0/0]nhrp n	
[r1-Tunnel0/0/0]nhrp network-id 100
[r1-Tunnel0/0/0]nhrp entry m	
[r1-Tunnel0/0/0]nhrp entry multicast d	
[r1-Tunnel0/0/0]nhrp entry multicast dynamic 
[r1-Tunnel0/0/0]ip add	
[r1-Tunnel0/0/0]ip address 100.1.1.1 24
[r2-Tunnel0/0/0]tunnel-protocol gre 	
[r2-Tunnel0/0/0]tunnel-protocol gre ?
  p2mp  Point to multi-point GRE mode
  <cr>  Please press ENTER to execute command 
[r2-Tunnel0/0/0]tunnel-protocol gre p2	
[r2-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r2-Tunnel0/0/0]so	
[r2-Tunnel0/0/0]source 28.1.1.1
[r2-Tunnel0/0/0]nhrp	
[r2-Tunnel0/0/0]nhrp 
[r2-Tunnel0/0/0]nhrp n	
[r2-Tunnel0/0/0]nhrp network-id 100
[r2-Tunnel0/0/0]nhrp entry 100.1.1.1 18.1.1.1
[r2-Tunnel0/0/0]nhrp entry 100.1.1.1 18.1.1.1
Info: This peer exists already.
[r2-Tunnel0/0/0]ip add 100.1.1.2 24
Aug 11 2024 20:34:23-08:00 r2 %%01IFNET/4/LINK_STATE(l)[2]:The line protocol IP 
on the interface Tunnel0/0/0 has entered the UP state. 
[r2-Tunnel0/0/0]nhrp entry 100.1.1.1 18.1.1.1 r	
[r2-Tunnel0/0/0]nhrp entry 100.1.1.1 18.1.1.1 register 
[r3]int Tunnel 0/0/0
[r3-Tunnel0/0/0]tu	
[r3-Tunnel0/0/0]tunnel-protocol 
[r3-Tunnel0/0/0]tunnel-protocol gre p	
[r3-Tunnel0/0/0]tunnel-protocol gre p2mp 
[r3-Tunnel0/0/0]nhrp n	
[r3-Tunnel0/0/0]nhrp network-id 100
[r3-Tunnel0/0/0]s	
[r3-Tunnel0/0/0]set
[r3-Tunnel0/0/0]shutdown
[r3-Tunnel0/0/0]source 38.1.1.1
[r3-Tunnel0/0/0]nhrp e	
[r3-Tunnel0/0/0]nhrp entry 100.1.1.1 18.1.1.1 r	
[r3-Tunnel0/0/0]nhrp entry 100.1.1.1 18.1.1.1 register 
[r3-Tunnel0/0/0]ip add 100.1.1.3 24

3 R2-R3之间启用PPP pap 单项认证  , R3-R4之间启用PPP的chap双向认证

单向认证

[r2]aaa
[r2-aaa]l	
[r2-aaa]local-user ljl p	
[r2-aaa]local-user ljl password c	
[r2-aaa]local-user ljl password cipher huawei
Info: Add a new user.
[r2-aaa]lo	
[r2-aaa]local-user ljl s	
[r2-aaa]local-user ljl service-type ppp
[r2-aaa]int s 4/0/1
[r2-Serial4/0/1]ppp a	
[r2-Serial4/0/1]ppp authentication-mode pap



[r4-Serial4/0/1]ppp pap local-user ljl password cipher huawei

双向认证

[r3-aaa]local-user r4 p	
[r3-aaa]local-user r4 password c	
[r3-aaa]local-user r4 password cipher huawei
Info: Add a new user.
[r3-aaa]l	
[r3-aaa]local-user r4 s	
[r3-aaa]local-user r4 service-type ppp
[r3]interface s 4/0/0
[r3-Serial4/0/0]pppa	 	
[r3-Serial4/0/0]ppp a	
[r3-Serial4/0/0]ppp authentication-mode ?
  chap  Enable CHAP authentication
  pap   Enable PAP authentication
[r3-Serial4/0/0]ppp authentication-mode chap
[r3-Serial4/0/0]ppp authentication-mode chap





r4-Serial4/0/0]ppp chap user r4 ?
[r4-Serial4/0/0]ppp chap password cipher huawei

4 运行协议并且修改网络类型以及ospf一些问题

[r1-ospf-100]ar	
[r1-ospf-100]area 0
[r1-ospf-100-area-0.0.0.0]net	
[r1-ospf-100-area-0.0.0.0]network 100.1.1.1 0.0.0.0
[r1-ospf-100-area-0.0.0.0]network 1.1.1.1 0.0.0.0
[r1-ospf-100-area-0.0.0.0]net	
[r1-ospf-100-area-0.0.0.0]network 201.1.0.0 0.0.255.255
[r1-ospf-100-area-0.0.0.0]int l	
[r1-ospf-100-area-0.0.0.0]int l 0
[r1-LoopBack0]ospf n	
[r1-LoopBack0]ospf network-type b	
[r1-LoopBack0]ospf network-type broadcast 
[r1-LoopBack0]intl 1
              ^
Error: Unrecognized command found at '^' position.
[r1-LoopBack0]int l 1
[r1-LoopBack1]ospf 	
[r1-LoopBack1]ospf n	
[r1-LoopBack1]ospf network-type bro	
[r1-LoopBack1]ospf network-type broadcast 
[r1-LoopBack1]int l 2
[r1-LoopBack2]ospf network-type broadcast
[r1-LoopBack2]int l 3
[r1-LoopBack3]ospf network-type broadcast
[r2-Serial4/0/1]q
[r2]ospf 100 r	
[r2]ospf 100 router-id 92.2.2.2
[r2-ospf-100]net	
[r2-ospf-100]a	
[r2-ospf-100]area 0
[r2-ospf-100-area-0.0.0.0]net	
[r2-ospf-100-area-0.0.0.0]network 100.1.1.2 0.0.0.0
[r2-ospf-100-area-0.0.0.0]network 100.1.1.2 0.0.0.0




[r2-ospf-100-area-0.0.0.0]network 100.1.1.2 0.0.0.0
[r2-ospf-100-area-0.0.0.0]q
[r2-ospf-100]are	
[r2-ospf-100]area 1
[r2-ospf-100-area-0.0.0.1]n	
[r2-ospf-100-area-0.0.0.1]network 2.2.2.2 0.0.0.0
[r2-ospf-100-area-0.0.0.1]network 24.1.1.1 0.0.0.0
[r2-ospf-100-area-0.0.0.1]int l 0
[r2-LoopBack0]ospf 	
[r2-LoopBack0]ospfv3
[r2-LoopBack0]ospf n	
[r2-LoopBack0]ospf network-type b	
[r2-LoopBack0]ospf network-type broadcast 
[r3]ospf 100 r	
[r3]ospf 100 router-id 93.3.3.3
[r3-ospf-100]ar	
[r3-ospf-100]area 0
[r3-ospf-100-area-0.0.0.0]ne	
[r3-ospf-100-area-0.0.0.0]network 100.1.1.3 0.0.0.0


[r3-ospf-100]ar	
[r3-ospf-100]area 1
[r3-ospf-100-area-0.0.0.1]net	
[r3-ospf-100-area-0.0.0.1]network 3.3.3.3 0.0.0.0
[r3-ospf-100-area-0.0.0.1]network 34.1.1.1 0.0.0.0
[r3-ospf-100-area-0.0.0.1]int l 0
[r3-LoopBack0]ospf n	
[r3-LoopBack0]ospf network-type b	
[r3-LoopBack0]ospf network-type broadcast
[r4]ospf 100 r	
[r4]ospf 100 router-id 94.4.4.4
[r4-ospf-100]are 	
[r4-ospf-100]area 1
[r4-ospf-100-area-0.0.0.1]net	
[r4-ospf-100-area-0.0.0.1]network 24.1.1.2 0.0.0.0
[r4-ospf-100-area-0.0.0.1]network 24.1.1.2 0.0.0.


[r4-ospf-100-area-0.0.0.1]q
[r4-ospf-100]are	
[r4-ospf-100]area 2
[r4-ospf-100-area-0.0.0.2]net	
[r4-ospf-100-area-0.0.0.2]network 46.1.1.1 0.0.0.0
[r4-ospf-100-area-0.0.0.2]int l	
[r4-ospf-100-area-0.0.0.2]int l 0
[r4-LoopBack0]ospf	
[r4-LoopBack0]ospf n	
[r4-LoopBack0]ospf network-type b	
[r4-LoopBack0]ospf network-type broadcast 
[r4-LoopBack0]q
[r4]ospf 100
[r4-ospf-100]are	
[r4-ospf-100]area 0
[r4-ospf-100-area-0.0.0.0]net	
[r4-ospf-100-area-0.0.0.0]network 4.4.4.4 0.0.0.0
[r4-ospf-100-area-0.0.0.0]q
[r4-ospf-100]q
[r4]rip 200
[r4-rip-200]v	
[r4-rip-200]verify-source
[r4-rip-200]version 2
[r4-rip-200]net	
[r4-rip-200]network 45.0.0.0
[r5]rip 200
[r5-rip-200]v	
[r5-rip-200]verify-source
[r5-rip-200]version 2
[r5-rip-200]net	
[r5-rip-200]network 45.0.0.0
[r5-rip-200]q
[r5]rip 200
[r5-rip-200]net	
[r5-rip-200]network 202.1.1.0
[r5-rip-200]network 202.1.2.0
[r5-rip-200]network 202.1.3.0
[r5-rip-200]network 5.0.0.0
[r6]ospf 100 router-id 96.6.6.6
[r6-ospf-100]are	
[r6-ospf-100]area 2
[r6-ospf-100-area-0.0.0.2]net	
[r6-ospf-100-area-0.0.0.2]network 46.1.1.2 0.0.0.0
[r6-ospf-100-area-0.0.0.2]network 6.6.6.6 0.0.0.0



[r6-ospf-100-area-0.0.0.2]int l 0
[r6-LoopBack0]net	
[r6-LoopBack0]ospf	
[r6-LoopBack0]ospf n	
[r6-LoopBack0]ospf network-type b	
[r6-LoopBack0]ospf network-type broadcast 
[r6-LoopBack0]q
[r6]rip 100
[r6-rip-100]ne	
[r6-rip-100]v	
[r6-rip-100]verify-source
[r6-rip-100]version 2
[r6-rip-100]net	
[r6-rip-100]network 67.0.0.0 
[r7]rip 100
[r7-rip-100]v	
[r7-rip-100]verify-source
[r7-rip-100]version 2
[r7-rip-100]net	
[r7-rip-100]network 67.0.0.0
[r7-rip-100]network 7.0.0.0
[r7-rip-100]network 203.1.1.0
[r7-rip-100]network 203.1.2.0
[r7-rip-100]network 203.1.3.0
[r7-rip-100]dis ip rou pro rip
[r7-rip-100]q
[r7]dis ip ro pro rip
[r7]dis ip rou pro rip
[r7]dis ip rou pro rip
[r1-Tunnel0/0/0]ospf network-type broadcast 

[r2-Tunnel0/0/0]ospf network-type broadcast 
[r2-Tunnel0/0/0]ospf dr-priority 0


[r3-Tunnel0/0/0]ospf network-type broadcast 
[r3-Tunnel0/0/0]ospf dr-priority 0

5.area  1  区域不得出现4.5类LSA

[r4-ospf-100-area-0.0.0.1]nssa


[r2-ospf-100-area-0.0.0.1]nssa


[r3-ospf-100-area-0.0.0.1]nssa

6 做通道使不规则的ospf区域协议通讯

[r2]int t 0/0/1
[r2-Tunnel0/0/1]ip add 42.1.1.1 24
[r2-Tunnel0/0/1]tu	
[r2-Tunnel0/0/1]tunnel-protocol gre
[r2-Tunnel0/0/1]s	
[r2-Tunnel0/0/1]so	
[r2-Tunnel0/0/1]source 2.2.2.2
[r2-Tunnel0/0/1]de	
[r2-Tunnel0/0/1]description 4.4.4.4


[r4-Tunnel0/0/1]ip add 42.1.1.2 24
[r4-Tunnel0/0/1]t	
[r4-Tunnel0/0/1]tu	
[r4-Tunnel0/0/1]tunnel-protocol gre
[r4-Tunnel0/0/1]so	
[r4-Tunnel0/0/1]source 4.4.4.4
[r4-Tunnel0/0/1]de	
[r4-Tunnel0/0/1]description 2.2.2.2
[r4-Tunnel0/0/1]int t0/0/2
[r4-Tunnel0/0/2]ip address 43.1.1.2 24
[r4-Tunnel0/0/2]tunnel-protocol gre
[r4-Tunnel0/0/2]source 4.4.4.4
[r4-Tunne10/0/2]destination 3.3.3.3


[r3-Tunnel0/0/2]tunnel-protocol gre
[r3-Tunnel0/0/2]ip address 43.1.1.1 24
[r3-Tunnel0/0/2]source 3.3.3.3
[r3-Tunnel0/0/2]destination 4.4.4.4

将通道宣告到area2区域

[r2-ospf-100-area-0.0.0.2]network 42.1.1.1 0.0.0.0

[r4-ospf-100-area-0.0.0.2]network 42.1.1.2 0.0.0.8
[r4-ospf-100-area-0.0.0.2]net
[r4-ospf-100-area-0.0.0.2]network 43.1.1.2 0.0.0.0


[r3-ospf-100-area-0.0.0.2]network 43.1.1.1 0.0.0.0

7 做汇总

[r2-ospf-100-area-0.0.0.0]abr-summary 201.1.0.0 255.255.252.0
[r2-ospf-100-area-0.0.0.0]abr-summary 201.1.0.0 255.255.252.0 cost 100

[r3-ospf-100-area-0.0.0.0]abr-summary 201.1.0.0 255.255.252.0
[r3-ospf-100-area-0.0.0.0]abr-summary 201.1.0.0 255.255.252.0 cost 50

8 做area 1 区域增加安全性

[r2-ospf-100-area-0.0.0.1]authentication-mode
Please press ENTER to execute command<Cr>
[r2-ospf-100-area-0.0.0.1]authentication-modesimple huawei simple huawei

[r3-ospf-100-area-0.0.0.1]authentication-mode simple
[r3-ospf-100-area-0.0.0.1]authentication-mode simple huawei

[r4-ospf-100-area-0.0.0.1]authentication-mode
[r4-ospf-100-area-0.0.0.1]authentication-mode simple huawei

9 将rip协议重发布到ospf中或者补一条缺省

[r4-ospf-100]import-route rip
[r4-ospf-100]import-route rip 200


[r4-rip-200]default-route originate


[r6-rip-100]import-route ospf 100

10 全网可达

[r7]ping 201.1.1.1
PING 201.1.1.1:56 data bytes, press cTRL_c to break
Reply from 201.1.1.1: bytes=56 Sequence=1 tt1=252 time=170 ms
Reply from 201.1.1.1: bytes=56Sequence=2 ttl=252 time=40 ms
Reply from201.1.1.1: bytes=56Sequence=3 ttl=252 time=60 msmS
Reply from201.1.1.1:bytes=56Sequence=4 ttl=252 time=60
Reply from 201.1.1.1: bytes=56Sequence=5ttl=252 time=50 ms

以此类推故全网可达

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值