动态路由协议实验-------OSPF
链路状态路由选择协议又被称为最短路径优先协议,它基SPF(shortest path first )算法
实验要求:各个PC之间能够互通
1.四台PC配置如下
PC1
PC2
PC3
PC4
2.配置各个交换机的口子的IP
R1
<HUAWEI>sys
[Huawei]interface g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 192.168.1.254 255.255.255.0
[Huawei-GigabitEthernet0/0/1]display this
[Huawei-GigabitEthernet0/0/1]q
[Huawei]interface g 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 12.1.1.1 255.255.255.0
[Huawei-GigabitEthernet0/0/0]display this
[Huawei-GigabitEthernet0/0/0]q
R2
<HUAWEI>sys
[Huawei]interface g 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 12.1.1.2 255.255.255.0
[Huawei-GigabitEthernet0/0/0]display this
[Huawei-GigabitEthernet0/0/0]q
[Huawei]interface g 0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 172.16.1.254 255.255.255.0
[Huawei-GigabitEthernet0/0/2]display this
[Huawei-GigabitEthernet0/0/2]q
[Huawei]interface g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 23.1.1.2 255.255.255.0
[Huawei-GigabitEthernet0/0/1]display this
[Huawei-GigabitEthernet0/0/1]q
R3
<HUAWEI>sys
interface g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 23.1.1.3 255.255.255.0
[Huawei-GigabitEthernet0/0/1]display this
[Huawei-GigabitEthernet0/0/1]q
[Huawei]interface g 0/0/2
[Huawei-GigabitEthernet0/0/2]ip address 10.1.1.254 255.255.255.0
[Huawei-GigabitEthernet0/0/2]display this
[Huawei-GigabitEthernet0/0/2]q
[Huawei]interface g 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 34.1.1.2 255.255.255.0
[Huawei-GigabitEthernet0/0/0]display this
[Huawei-GigabitEthernet0/0/0]q
R4
<HUAWEI>sys
[Huawei]interface g 0/0/0
[Huawei-GigabitEthernet0/0/0]ip address 34.1.1.4 255.255.255.0
[Huawei-GigabitEthernet0/0/0]display this
[Huawei-GigabitEthernet0/0/0]q
[Huawei]interface g 0/0/1
[Huawei-GigabitEthernet0/0/1]ip address 1.1.1.254 255.255.255.0
[Huawei-GigabitEthernet0/0/1]display this
[Huawei-GigabitEthernet0/0/1]q
3.配置ospf动态路由
R1
[Huawei]ospf 1 router-id 1.1.1.1
[R1-ospf-1]area 0
[R1-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0]display ip routing-table protocol ospf
R2
[R2]ospf 1 router-id 2.2.2.2
[R2-ospf-1]area 0
[R2-ospf-1-area-0.0.0.0]network 12.1.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]network 172.16.1.0 0.0.0.255
[R2-ospf-1-area-0.0.0.0]display ip routing-table protocol ospf
R3
[R3]ospf 1 router-id 3.3.3.3
[R3-ospf-1]area 0
[R3-ospf-1-area-0.0.0.0]network 23.1.1.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 10.1.1.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[R3-ospf-1-area-0.0.0.0]display ip routing-table protocol ospf
R4
[R4]ospf 1 router-id 4.4.4.4
[R4-ospf-1]area 0
[R4-ospf-1-area-0.0.0.0]network 34.1.1.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]network 1.1.1.0 0.0.0.255
[R4-ospf-1-area-0.0.0.0]display ip routing-table protocol ospf
4.测试各PC之间的连通信
PC1 ping PC2、PC3、PC4
PC2 ping PC3、PC4
PC3 ping PC4