ospf:基於鏈路狀態,用dijkstra選擇最短路由路徑
拓撲圖:
配置代碼:
R1:
En
Conf t
Host r1
No ip domain-lookup
Int f0/0
Ip address 192.168.1.254 255.255.255.0
No shut
int f1/0
ip address 10.0.0.1 255.0.0.0
No shut
int s2/0
ip address 30.0.0.2 255.0.0.0
no shut
exit
router ospf 100
!進程號1-65535任意
network 30.0.0.0 0.255.255.255 area 0
!掩碼用反碼
network 10.0.0.0 0.255.255.255 area 0
network 192.168.1.0 0.0.0.255 area 0
End
Show ip route
R2:
En
Conf t
Host r2
No ip domain-lookup
Int f0/0
ip address 20.0.0.2 255.0.0.0
No shut
int f1/0
ip address 10.0.0.2 255.0.0.0
no shut
exit
router ospf 100
!進程號1-65535任意
network 20.0.0.0 0.255.255.255 area 0
network 10.0.0.0 0.255.255.255 area 0
End
Show ip route
R3:
En
Conf t
Host r3
No ip domain-lookup
Int f0/0
Ip address 192.168.0.254 255.255.255.0
No shut
int f1/0
ip address 20.0.0.1 255.0.0.0
No shut
int s2/0
ip address 30.0.0.1 255.0.0.0
no shut
exit
router ospf 100
!進程號1-65535任意
network 30.0.0.0 0.255.255.255 area 0
network 20.0.0.0 0.255.255.255 area 0
network 192.168.0.0 0.0.0.255 area 0
End
Show ip route