1. 程式人生 > >OSPF配置實例

OSPF配置實例

OSPF

配置ospf使得pc1和pc2能互通
技術分享圖片
接口的基本配置

R1:
R1(config)#int f0/0
R1(config-if)#ip address 192.168.2.1 255.255.255.0
R1(config-if)#no shutdown
R1(config)#int s1/0
R1(config-if)#ip address 172.16.0.1 255.255.255.252
R1(config-if)#clock rate 64000
R1(config-if)#no shutdown
R2:
R2(config)#int s1/0
R2(config-if)#ip address 172.16.0.2 255.255.255.252

R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R2(config)#int s1/1
R2(config-if)#ip address 172.16.0.5 255.255.255.252
R2(config-if)#clock rate 64000
R2(config-if)#no shutdown
R3:
R3(config)#int f0/0
R3(config-if)#ip address 192.168.1.1 255.255.255.0
R3(config-if)#no shutdown
R3(config)#int s1/1
R3(config-if)#ip address 172.16.0.6 255.255.255.252
R3(config-if)#clock rate 64000
R3(config-if)#no shutdown
PC1:
PC1> ip 192.168.2.2 24 192.168.2.1
Checking for duplicate address...
PC1 : 192.168.2.2 255.255.255.0 gateway 192.168.2.1
PC2:
PC2> ip 192.168.1.2 24 192.168.1.1
Checking for duplicate address...
PC1 : 192.168.1.2 255.255.255.0 gateway 192.168.1.1


ospf配置
R1:
R1(config)#router ospf 1
R1(config-router)#network 192.168.2.0 0.0.0.255 area 0
R1(config-router)#network 172.16.0.0 0.0.0.3 area 0
R2:
R2(config)#router ospf 1
R2(config-router)#network 172.16.0.0 0.0.0.3 area 0
R2(config-router)#network 172.16.0.4 0.0.0.3 area 0
R3:
R1(config)#router ospf 1
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0
R1(config-router)#network 172.16.0.4 0.0.0.3 area 0
技術分享圖片

OSPF配置實例