OFPF路由1

 

 几个概念

1.ospf是分区域的,其中area0 即区域0是主干区域,其他区域都必须与它相连

2.ospf的基本格式:

router ospf  进程号

network ip地址段  子网掩码的反码 area 进程号

例如network 1.1.1.0 0.0.0.255 area 1

3.划分区域是按照端口来划分

 

上面的图例,如果用ospf联通的话,需要写如下的命令

R1上

  
  
  
  
  1. !  
  2. interface Ethernet0/0  
  3.  no ip address  
  4.  shutdown  
  5.  half-duplex  
  6. !  
  7. interface Ethernet0/1  
  8.  ip address 192.168.12.1 255.255.255.0  
  9.  half-duplex  
  10. !  
  11. interface Ethernet0/2  
  12.  no ip address  
  13.  shutdown  
  14.  half-duplex  
  15. !  
  16. interface Ethernet0/3  
  17.  no ip address  
  18.  shutdown  
  19.  half-duplex  
  20. !  
  21. router ospf 100  
  22.  log-adjacency-changes  
  23.  network 192.168.12.0 0.0.0.255 area 1  

 

R2

  
  
  
  
  1. !  
  2. interface Loopback1  
  3.  ip address 2.2.2.2 255.255.255.0  
  4. !  
  5. interface Ethernet0/0  
  6.  ip address 192.168.12.2 255.255.255.0  
  7.  half-duplex  
  8. !  
  9. interface Ethernet0/1  
  10.  ip address 192.168.23.2 255.255.255.0  
  11.  half-duplex  
  12. !  
  13. interface Ethernet0/2  
  14.  no ip address  
  15.  shutdown  
  16.  half-duplex  
  17. !  
  18. interface Ethernet0/3  
  19.  no ip address  
  20.  shutdown  
  21.  half-duplex  
  22. !  
  23. router ospf 100  
  24.  log-adjacency-changes  
  25.  network 2.2.2.0 0.0.0.255 area 0  
  26.  network 192.168.12.0 0.0.0.255 area 1  
  27.  network 192.168.23.0 0.0.0.255 area 0  

 

R3

  
  
  
  
  1. !  
  2. interface Loopback1  
  3.  ip address 3.3.3.3 255.255.255.0  
  4. !  
  5. interface Ethernet0/0  
  6.  ip address 192.168.23.3 255.255.255.0  
  7.  half-duplex  
  8. !  
  9. interface Ethernet0/1  
  10.  ip address 192.168.34.3 255.255.255.0  
  11.  half-duplex  
  12. !  
  13. interface Ethernet0/2  
  14.  no ip address  
  15.  shutdown  
  16.  half-duplex  
  17. !  
  18. interface Ethernet0/3  
  19.  no ip address  
  20.  shutdown  
  21.  half-duplex  
  22. !  
  23. router ospf 100  
  24.  log-adjacency-changes  
  25.  network 3.3.3.0 0.0.0.255 area 0  
  26.  network 192.168.23.0 0.0.0.255 area 0  
  27.  network 192.168.34.0 0.0.0.255 area 2  

  

R4

 

  
  
  
  
  1. !  
  2. interface Ethernet0/0  
  3.  ip address 192.168.34.4 255.255.255.0  
  4.  half-duplex  
  5. !  
  6. interface Ethernet0/1  
  7.  no ip address  
  8.  shutdown  
  9.  half-duplex  
  10. !  
  11. interface Ethernet0/2  
  12.  no ip address  
  13.  shutdown  
  14.  half-duplex  
  15. !  
  16. interface Ethernet0/3  
  17.  no ip address  
  18.  shutdown  
  19.  half-duplex  
  20. !  
  21. router ospf 100  
  22.  log-adjacency-changes  
  23.  network 192.168.34.0 0.0.0.255 area 2  

 

本文出自 “技术盛宴” 博客,转载请与作者联系!

你可能感兴趣的:(职场,休闲,ospf)