1. 网络拓扑
2. R1配置
[R1-GigabitEthernet0/0/0] ip address 192.168.12.1 24
[R1-GigabitEthernet0/0/1] ip address 192.168.1.254 24
[R1] interface loopback 0
[R1-LoopBack0] ip address 1.1.1.1 32
#在R1的GE0/0/0及GE0/0/1口上激活OSPF:
[R1] ospf 1 router-id 1.1.1.1
[R1-ospf-1] area 0
[R1-ospf-1-area-0.0.0.0] network 192.168.12.0 0.0.0.255
[R1-ospf-1-area-0.0.0.0] network 192.168.1.0 0.0.0.255
3. R2配置
[R2-GigabitEthernet0/0/0] ip address 192.168.12.2 24
[R2-GigabitEthernet0/0/1] ip address 192.168.23.2 24
[R2] interface loopback 0
[R2-LoopBack0] ip address 2.2.2.2 32
[R2] ospf 1 router-id 2.2.2.2
[R2-ospf-1] area 0
[R2-ospf-1-area-0.0.0.0] network 192.168.12.0 0.0.0.255
[R2-ospf-1] area 1
[R2-ospf-1-area-0.0.0.1] network 192.168.23.0 0.0.0.255
4. R3配置
[R3-GigabitEthernet0/0/0] ip address 192.168.23.3 24
[R3-GigabitEthernet0/0/1] ip address 192.168.2.254 24
[R3] interface loopback 0
[R3-LoopBack0] ip address 3.3.3.3 32
[R3] ospf 1 router-id 3.3.3.3
[R3-ospf-1] area 1
[R3-ospf-1-area-0.0.0.1] network 192.168.2.0 0.0.0.255
[R3-ospf-1-area-0.0.0.1] network 192.168.23.0 0.0.0.255
5. 查看配置