一、实验拓扑¶

二、实验需求¶
1、R1、R2、R3都是各自网络的网关设备
2、通过OSPF动态路由协议实现网络之间互联互通
3、R1-R3配置OSPF认证(R1的1口配置接口认证,R3的1口配置区域认证),R1-R2配置接口认证,R2-R3配置OSPF认证(R2的2口配置接口认证,R3的3口配置区域认证)
4、假设R1为所有网络的出口,在R1上下发默认路由
5、通过修改cost值来改变R1-R2的路径为R1-R3-R2.
三、实验说明¶
这里的Loopback口用作OSPF的Router-id.
四、实验配置¶
1、设备命名 [Huawei]sysname R1 [Huawei]sysname R2 [Huawei]sysname R3 2、配置各自接口地址 [R1-GigabitEthernet0/0/1]ip address 10.0.13.1 24 [R1-GigabitEthernet0/0/3]ip address 10.0.12.1 24 [R1-LoopBack0]ip address 10.0.1.1 32 [R2-GigabitEthernet0/0/3]ip address 10.0.12.2 24 [R2-GigabitEthernet0/0/2]ip address 10.0.23.2 24 [R2-LoopBack0]ip address 10.0.1.2 32 [R3-GigabitEthernet0/0/1]ip address 10.0.13.3 24 [R3-GigabitEthernet0/0/3]ip address 10.0.23.3 24 [R3-LoopBack0]ip address 10.0.1.3 32 3、OSPF基本配置 R1配置 ospf 1 area 0.0.0.0 network 10.0.13.1 0.0.0.0 network 10.0.12.1 0.0.0.0 network 10.0.1.1 0.0.0.0 R2配置 ospf 1 area 0.0.0.0 network 10.0.1.2 0.0.0.0 network 10.0.12.2 0.0.0.0 network 10.0.23.2 0.0.0.0 R3配置 ospf 1 area 0.0.0.0 network 10.0.1.3 0.0.0.0 network 10.0.23.3 0.0.0.0 network 10.0.13.3 0.0.0.0 4、查看OSPF邻居状态 [R2]display ospf peer brief
OSPF Process 1 with Router ID 10.0.1.2
Peer Statistic Information
-----------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/2 10.0.1.3 Full
0.0.0.0 GigabitEthernet0/0/3 10.0.1.1 Full
-----------------------------------------------------------------------
5、配置OSPF认证 [R1-GigabitEthernet0/0/1]ospf authentication-mode md5 1 cipher HCIA-Datacom [R1-GigabitEthernet0/0/3]ospf authentication-mode md5 1 cipher HCIA-Datacom [R2-GigabitEthernet0/0/2]ospf authentication-mode md5 1 cipher HCIA-Datacom [R2-GigabitEthernet0/0/3]ospf authentication-mode md5 1 cipher HCIA-Datacom [R3-ospf-1-area-0.0.0.0]authentication-mode md5 1 cipher HCIA-Datacom 6、验证认证结果 [R2]display ospf peer brief
OSPF Process 1 with Router ID 10.0.1.2
Peer Statistic Information
-----------------------------------------------------------------------
Area Id Interface Neighbor id State
0.0.0.0 GigabitEthernet0/0/2 10.0.1.3 Full
0.0.0.0 GigabitEthernet0/0/3 10.0.1.1 Full
-----------------------------------------------------------------------
7、R1配置默认路由 [R1-ospf-1]default-route-advertise always 8、修改R1接口开销值来改变路径 [R1-GigabitEthernet0/0/3]ospf cost 5 配置前 [R1]tracert -a 10.0.1.1 10.0.1.2
traceroute to 10.0.1.2(10.0.1.2), max hops: 30 ,packet length: 40,press CTRL_C to break
1 10.0.12.2 40 ms 50 ms 30 ms 配置后 [R1]tracert -a 10.0.1.1 10.0.1.2
traceroute to 10.0.1.2(10.0.1.2), max hops: 30 ,packet length: 40,press CTRL_C to break
1 10.0.13.3 70 ms 30 ms 30 ms
2 10.0.23.2 60 ms 60 ms 70 ms