動態路由協議
ospf:開放式最短路徑優先(Open Shortest Path First)協議是IETF定義的一種基於鏈路狀態的內部網關路由協議
作用:主要用於大型網絡,運營商,政府機構。這種環境有多個節點需要互聯互通,此時建議使用動態路由協議ospf
相比靜態路由優點:支持更多網絡節點,配置更簡單,網絡更加穩定,可靠性更高,容易擴展,更加靈活,自動識別最優的下一跳
ospf兩層結構(層次化結構)
骨幹區域(核心區域)
常規區域
配置直連路由以及各PC的網絡配置
PC1:
ip: 1.1.1.2
netmask: 255.255.255.0
gateway: 1.1.1.1
PC2:
ip: 3.3.3.2
netmask: 255.255.255.0
gateway: 3.3.3.1
PC3:
ip: 2.2.2.2
netmask: 255.255.255.0
gateway: 2.2.2.1
R1配置命令:
system-view
sysname R1
interface e0/0/0
ip address 12.1.1.1 24
interface e0/0/1
ip address 1.1.1.1 24
R2配置命令:
system-view
sysname R2
interface e0/0/0
ip address 12.1.1.2 24
interface e0/0/1
ip address 23.1.1.2 24
interface g0/0/0
ip address 2.2.2.1 24
R3配置命令:
system-view
sysname R3
interface e0/0/0
ip address 23.1.1.1 24
interface e0/0/1
ip address 3.3.3.1 24
配置ospf路由
PS: 使用正掩碼和反掩碼都可
R1:
ospf
area 0
network 1.1.1.0 255.255.255.0
network 12.1.1.0 0.0.0.255
display this
R2:
ospf
area 0
network 12.1.1.0 0.0.0.255
network 23.1.1.0 0.0.0.255
network 2.2.2.0 0.0.0.255
display this
R1:
ospf
area 0
network 23.1.1.0 255.255.255.0
network 3.3.3.0 0.0.0.255
display this
查看各個的路由表
R1:
R2:
R3:
驗證結果