1. 配置步骤:
- 要在路由器上配置OSPF,必须首先进入系统视图,然后执行 ospf [ process-id |router-id router-id ]命令以使能OSPF进程,并进入OSPF 视图。
- 执行ospf命令时,如果不输入process-id(该参数表示OSPF进程编号)的值,则process-id默认取值为1。router-id是一个32比特的二进制数,也经常表示为点分十进制数。如果在执行ospf命令时不指定router-id,则路由器会根据某种规则自动生成一个值来作为router-id。
R1:
ospf router-id 11.1.1.1
area 0
network 12.0.0.0 0.255.255.255
network 13.0.0.0 0.255.255.255
quit
area 1
network 172.16.0.0 0.0.0.255
network 1.0.0.0 0.255.255.255
quit
interface GigabitEthernet 2/0/0
ip address 172.16.0.1 24
quit
interface GigabitEthernet 2/0/1
ip address 1.0.0.1 8
quit
interface GigabitEthernet 0/0/1
ip address 13.0.0.1 8
interface GigabitEthernet 0/0/0
ip address 12.0.0.1 8
quit
R2:
ospf router-id 22.2.2.2
area 0
network 12.0.0.0 0.255.255.255
network 23.0.0.0 0.255.255.255
quit
area 2
network 2.0.0.0 0.255.255.255
network 10.0.0.0 0.255.255.255
quit
interface GigabitEthernet 2/0/1
ip address 12.0.0.2 8
quit
interface GigabitEthernet 2/0/0
ip address 23.0.0.1 8
quit
interface GigabitEthernet 0/0/0
ip address 2.0.0.1 8
quit
interface GigabitEthernet 0/0/1
ip address 10.0.0.0 8
quit
R3:
ospf router-id 33.3.3.3
area 0
network 13.0.0.0 0.255.255.255
network 23.0.0.0 0.255.255.255
quit
area 3
network 192.168.0.0 0.0.0.255
network 3.0.0.0 0.255.255.255
quit
interface GigabitEthernet 2/0/0
ip address 192.168.0.1 24
quit
interface GigabitEthernet 2/0/1
ip address 3.0.0.1 8
quit
interface GigabitEthernet 0/0/1
ip address 13.0.0.2 8
quit
interface GigabitEthernet 0/0/0
ip address 23.0.0.2 8
quit
在完成上述配置后,我们可以通过以下命令来对配置进行验证。
- display ospf [ process-id ] peer 查看路由器的邻居信息。
- display ospf [ process-id ] routing 查看路由器的OSPF 路由表。
nb
为何使用不了:reset ospf proces
应该是 reset ospf process