您好,作为网络方面的入门菜鸟,我对OSPF的理解不是很懂,想请前辈谈谈如何掌握这种协议。

举个形象例子甚好。

OSPF(Open Shortest Path First开放式最短路径优先)[1]是一个内部网关协议(Interior Gateway Protocol,简称IGP),用于在单一自治系统(autonomous system,AS)内决策路由。与RIP相比,OSPF是链路状态路由协议,而RIP是距离矢量路由协议。

实例1 无安全,无路由总结的OSPF设置
  
  
  2511-1的设置
  
  Current configuration:
  
  !
  
  version 11.3
  
  no service password-encryption
  
  !
  
  hostname 2511-1
  
  !
  
  enable password cisco
  
  !
  
  interface Ethernet0
  
  ip address 192.4.1.1 255.255.255.0
  
  !
  
  interface Serial0
  
  ip address 192.3.1.1 255.255.255.0
  
  encapsulation frame-relay IETF
  
  no ip mroute-cache
  
  bandwidth 2000
  
  frame-relay map ip 192.3.1.2 100 broadcast
  
  frame-relay lmi-type cisco
  
  !
  
  interface Serial1
  
  ip address 192.1.1.1 255.255.255.0
  
  encapsulation ppp
  
  bandwidth 64
  
  !
  
  router ospf 1
  
  passive-interface Ethernet0
  
  network 192.1.1.0 0.0.0.255 area 0
  
  network 192.3.1.0 0.0.0.255 area 0
  
  network 192.4.1.0 0.0.0.255 area 0
  
  neighbor 192.1.1.2 priority 1
  
  neighbor 192.3.1.2 priority 1
  
  !
  
  ip classless
  
  !
  
  line con 0
  
  line 1 8
  
  line aux 0
  
  line vty 0 4
  
  !
  
  end
  
  2505的设置
  
  Current configuration:
  
  !
  
  version 11.2
  
  no service udp-small-servers
  
  no service tcp-small-servers
  
  !
  
  hostname 2505
  
  !
  
  enable secret 5 $1$GbYT$OR05giiLZxI4hEAO0F8kV1
  
  !
  
  hub ether 0 1
  
  link-test
  
  auto-polarity
  
  !
  
  hub ether 0 2
  
  link-test
  
  auto-polarity
  
  !
  
  hub ether 0 3
  
  link-test
  
  auto-polarity
  
  !
  
  hub ether 0 4
  
  link-test
  
  auto-polarity
  
  !
  
  hub ether 0 5
  
  link-test
  
  auto-polarity
  
  !
  
  hub ether 0 6
  
  link-test
  
  auto-polarity
  
  !
  
  hub ether 0 7
  
  link-test
  
  auto-polarity
  
  !
  
  hub ether 0 8
  
  link-test
  
  auto-polarity
  
  !
  
  interface Ethernet0
  
  ip address 192.1.4.1 255.255.255.0
  
  !
  
  interface Serial0
  
  ip address 192.1.2.1 255.255.255.0
  
  ip ospf network non-broadcast
  
  bandwidth 2000
  
  clockrate 2000000
  
  !
  
  interface Serial1
  
  ip address 192.1.1.2 255.255.255.0
  
  enpsuration ppp
  
  ip ospf network non-broadcast
  
  bandwidth 64
  
  clockrate 64000
  
  !
  
  router ospf 1
  
  passive-interface Ethernet0
  
  network 192.1.1.0 0.0.0.255 area 0
  
  network 192.1.2.0 0.0.0.255 area 2
  
  network 192.1.4.0 0.0.0.255 area 2
  
  neighbor 192.1.1.1 priority 1
  
  neighbor 192.1.2.2 priority 1
  
  !
  
  no ip classless
  
  ip ospf name-lookup
  
  !
  
  line con 0
  
  line aux 0
  
  line vty 0 4
  
  login
  
  !
  
  end
  
  internal -2的设置
  
  Current configuration :
  
  !
  
  version 11.2
  
  no service udp-small-servers
  
  no service tcp-small-servers
  
  !
  
  hostname internal-2
  
  !
  
  enable secret 5 $1$KX00$rTI/2TvDokWxT4xC6wvmi/
  
  !
  
  interface Ethernet0
  
  no ip address
  
  shutdown
  
  !
  
  interface Serial0
  
  ip address 192.1.2.2 255.255.255.0
  
  ip ospf network non-broadcast
  
  !
  
  interface Serial1
  
  no ip address
  
  shutdown
  
  !
  
  router ospf 1
  
  network 192.1.2.0 0.0.0.255 area 2
  
  neighbor 192.1.2.1 priority 1
  
  !
  
  no ip classless
  
  !
  
  line con 0
  
  line 1 16
  
  line aux 0
  
  line vty 0 4
  
  !
  
  end
  
   
  
  2514的设置
  
  Current configuration :
  
  !
  
  version 11.2
  
  no service udp-small-servers
  
  no service tcp-small-servers
  
  !
  
  hostname 2514
  
  !
  
  enable secret 5 $1$uoHU$Vks/lY CRi33z4TXs4qekI0
  
  !
  
  frame-relay switching
  
  !
  
  interface Ethernet0
  
  ip address 192.5.1.1 255.255.255.0
  
  !
  
  interface Ethernet1
  
  no ip address
  
  shutdown
  
  !
  
  interface Serial0
  
  ip address 192.3.1.2 255.255.255.0
  
  encapsulation frame-relay IETF
  
  bandwidth 2000
  
  clockrate 2000000
  
  frame-relay map ip 192.3.1.1 100 broadcast
  
  frame-relay intf-type dce
  
  !
  
  interface Serial1
  
  ip address 192.2.1.1 255.255.255.0
  
  no ip mroute-cache
  
  encapsulation X25 dce
  
  bandwidth 64
  
  x25 address 1234
  
  x25 htc 16
  
  x25 nvc 4
  
  x来自:求助得到的回答
温馨提示:答案为网友推荐,仅供参考