网络初级篇之OSPF(二)实验
一、实验目的:
下面关于OSPF的实验,仔细看配置过程,以增加对OSPF的理解。
二、实现目标:
使用OSPF实现所有主机之间的通信
三、配置过程:
1、AR1的配置过程:
<Huawei>system-view
[Huawei]sysname AR1
[AR1]interface GigabitEthernet 0/0/0
[AR1-GigabitEthernet0/0/0]ip address 192.168.0.254 24
[AR1-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[AR1-GigabitEthernet0/0/1]ip address 10.0.1.1 24
[AR1-GigabitEthernet0/0/1]quit
[AR1]ospf router-id 1.1.1.1 //配置此路由器的router-id为1.1.1.1
[AR1-ospf-1]area 0 //设置为区域0 (0为主干区域)
[AR1-ospf-1-area-0.0.0.0]network 192.168.0.0 0.0.0.255
[AR1-ospf-1-area-0.0.0.0]network 10.0.1.0 0.0.0.255 //配置路由器两端的网段(网段后填写反掩码:反掩码就是转化为二进制后,1改为0,0改为1)上同
<AR1>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
2、AR2的配置过程:
<Huawei>system-view
[Huawei]sysname AR2
[AR2]interface GigabitEthernet 0/0/0
[AR2-GigabitEthernet0/0/0]ip address 192.168.1.254 24
[AR2-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[AR2-GigabitEthernet0/0/1]ip address 10.0.1.2 24
[AR2-GigabitEthernet0/0/1]quit
[AR2]ospf router-id 2.2.2.2 //配置此路由器的router-id为2.2.2.2
[AR2-ospf-1]area 0 //设置为区域0 (0为主干区域)
[AR2-ospf-1-area-0.0.0.0]network 192.168.1.0 0.0.0.255
[AR2-ospf-1-area-0.0.0.0]network 10.0.1.0 0.0.0.255 //配置路由器两端的网段(网段后填写反掩码:反掩码就是转化为二进制后,1改为0,0改为1)上同
<AR2>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
3、AR3(特殊)的配置过程:
<Huawei>system-view
[Huawei]sysname AR3
[AR3]interface GigabitEthernet 0/0/0
[AR3-GigabitEthernet0/0/0]ip address 192.168.2.254 24
[AR3-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[AR3-GigabitEthernet0/0/1]ip address 10.0.1.3 24
[AR3-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[AR3-GigabitEthernet0/0/2]ip address 10.0.2.1 24
[AR3-GigabitEthernet0/0/2]quit
[AR3]ospf router-id 3.3.3.3 //配置此路由器的router-id为3.3.3.3
[AR3-ospf-1]area 0 //设置为区域0 (0为主干区域)
[AR3-ospf-1-area-0.0.0.0]network 192.168.2.0 0.0.0.255
[AR3-ospf-1-area-0.0.0.0]network 10.0.1.0 0.0.0.255 //配置路由器两端的网段(网段后填写反掩码:反掩码就是转化为二进制后,1改为0,0改为1)上同
[AR3-ospf-1-area-0.0.0.0]quit
[AR3-ospf-1]area 1 //设置为区域1
[AR3-ospf-1-area-0.0.0.1]network 10.0.2.0 0.0.0.255 //与上同
<AR3>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
4、AR4的配置过程:
<Huawei>system-view
[Huawei]sysname AR4
[AR4]interface GigabitEthernet 0/0/0
[AR4-GigabitEthernet0/0/0]ip address 192.168.3.254 24
[AR4-GigabitEthernet0/0/0]interface GigabitEthernet 0/0/1
[AR4-GigabitEthernet0/0/1]ip address 10.0.2 2 24
[AR4-GigabitEthernet0/0/2]quit
[AR4]ospf router-id 4.4.4.4 //配置此路由器的router-id为4.4.4.4
[AR4-ospf-1]area 1 //设置为区域1
[AR4-ospf-1-area-0.0.0.1]network 192.168.3.0 0.0.0.255
[AR4-ospf-1-area-0.0.0.1]network 10.0.2.0 0.0.0.255 //配置路由器两端的网段(网段后填写反掩码:反掩码就是转化为二进制后,1改为0,0改为1)上同
<AR4>save
The current configuration will be written to the device.
Are you sure to continue? (y/n)[n]:y
四、测试:
使用PC1 ping其他的三台主机