OSPF配置

  • ​​实验拓扑​​
  • ​​端口配置​​
  • ​​OSPF配置,进程号1​​
  • ​​避免不必要的路由流量,设置被动端口​​
  • ​​配置路由器的 router-id​​
  • ​​实验结果​​

主机

端口

Ip

子网掩码

默认网关

PC1

192.168.0.222

255.255.255.224

192.168.0.193

PC2

192.168.0.190

255.255.255.192

192.168.0.129

PC3

192.168.0.126

255.255.255.128

192.168.0.1

R1

F0/0

10.0.0.1

255.255.255.252

R1

F0/1

192.168.0.193

255.255.255.224

R2

F0/0

10.0.0.5

255.255.255.252

R2

F0/1

192.168.0.129

255.255.255.192

R3

F0/0

10.0.0.9

255.255.255.252

R3

F0/1

192.168.0.1

255.255.255.128

R4

F0/0

10.0.0.2

255.255.255.252

R4

F0/1

10.0.0.6

255.255.255.252

R4

F0/2

10.0.0.10

255.255.255.252

实验拓扑

OSPF配置_OSPF

OSPF配置_网络规划设计(路由与交换)_02

端口配置

R1#configure terminal 
R1(config)#interface f0/0
R1(config-if)#ip address 10.0.0.1 255.255.255.252
R1(config-if)#no shutdown
R1(config-if)#interface f0/1
R1(config-if)#ip address 192.168.0.193 255.255.255.224
R1(config-if)#no shutdown

R2(config)#interface f0/0
R2(config-if)#ip address 10.0.0.5 255.255.255.252
R2(config-if)#no shutdown
R2(config)#interface f0/1
R2(config-if)#ip address 192.168.0.129 255.255.255.128
R2(config-if)#no shutdown

R3(config)#interface f0/0
R3(config-if)#ip address 10.0.0.9 255.255.255.252
R3(config-if)#no shutdown
R3(config-if)#interface f0/1
R3(config-if)#ip address 192.168.0.1 255.255.255.128
R3(config-if)#no shutdown


R4(config)#interface f0/0
R4(config-if)#ip address 10.0.0.2 255.255.255.252
R4(config-if)#no shutdown
R4(config-if)#interface f0/1
R4(config-if)#ip address 10.0.0.6 255.255.255.252
R4(config-if)#no shutdown
R4(config-if)#interface f0/1
R4(config-if)#ip address 10.0.0.6 255.255.255.252
R4(config-if)#no shutdown

OSPF配置,进程号1

R1(config)#router ospf 1
R1(config-router)#network 10.0.0.0 0.0.0.3 area 0
R1(config-router)#network 192.168.0.192 0.0.0.31 area 0


R2(config)#router ospf 1
R2(config-router)#network 10.0.0.0 0.0.0.3 area 0
R2(config-router)#network 10.0.0.4 0.0.0.3 area 0
R2(config-router)#network 192.168.0.128 0.0.0.63 area 0

R3(config)#router ospf 1
R3(config-router)#network 10.0.0.0 0.0.0.3 area 0
R3(config-router)#network 10.0.0.8 0.0.0.3 area 0
R3(config-router)#network 192.168.0.0 0.0.0.127 area 0

R4(config)#router ospf 1
R4(config-router)#network 10.0.0.0 0.0.0.3 area 0
R4(config-router)#network 10.0.0.4 0.0.0.3 area 0
R4(config-router)#network 10.0.0.8 0.0.0.3 area 0

避免不必要的路由流量,设置被动端口

R1(config)#router ospf 1
R1(config-router)#passive-interface f0/1

R2(config)#router ospf 1
R2(config-router)#passive-interface f0/1

R3(config)#router ospf 1
R3(config-router)#passive-interface f0/1

配置路由器的 router-id

R1(config)#router ospf 1
R1(config-router)#router-id 172.16.1.1
R1(config-router)#end
R1#clear ip ospf process

R2(config)#router ospf 1
R2(config-router)#rout
R2(config-router)#router-id 172.16.1.2
R2(config-router)#end
R2#clear ip ospf process

R3(config)#router ospf 1
R3(config-router)#router-id 172.16.1.3
R3(config-router)#end
R3#clear ip ospf process

R4(config)#router ospf 1
R4(config-router)#router-id 172.16.1.4
R4(config-router)#end
R4#clear ip ospf process

实验结果

OSPF配置_路由器_03