A-A+

使用ospf协议的ISP双线冗余路由器配置方法和命令行

2015年11月18日 站长资讯 暂无评论

本文通过一个并不复杂的组网来进行一个ISP双线冗余路由器的配置实验,来讲解ospf协议的使用方法和配置操作的步骤,并且附带有拓扑图和全部配置命令。实验共采用6个路由器,如下图所示:

R1、R2、R6组成外网使用ospf协议,R6回环口1.1.1.1

R3为出口路由器f0/0 和f1/0都可以访问到1.1.1.1

R4、R5充当PC机器

R6:配置

  1. interface Loopback0  
  2.   
  3.  ip address 1.1.1.1 255.255.255.255  
  4.   
  5. !  
  6.   
  7. interface FastEthernet0/0  
  8.   
  9.  ip address 16.1.1.6 255.255.255.0  
  10.   
  11.  duplex auto  
  12.   
  13.  speed auto  
  14.   
  15. !  
  16.   
  17. interface FastEthernet1/0  
  18.   
  19.  ip address 26.1.1.6 255.255.255.0  
  20.   
  21.  duplex auto  
  22.   
  23.  speed auto  
  24.   
  25. !  
  26.   
  27. router ospf 1  
  28.   
  29.  log-adjacency-changes  
  30.   
  31.  network 1.1.1.1 0.0.0.0 area 0  
  32.   
  33.  network 16.1.1.0 0.0.0.255 area 0  
  34.   
  35.  network 26.1.1.0 0.0.0.255 area 0  
  36.   
  37. !  

R5 配置

  1. interface FastEthernet0/0  
  2.   
  3.  ip address 192.168.2.2 255.255.255.0  
  4.   
  5.  no ip route-cache  
  6.   
  7.  duplex auto  
  8.   
  9.  speed auto  
  10.   
  11. !  
  12.   
  13. ip default-gateway 192.168.2.1  

R4配置

  1. interface FastEthernet0/0  
  2.   
  3.  ip address 192.168.1.2 255.255.255.0  
  4.   
  5.  no ip route-cache  
  6.   
  7.  duplex auto  
  8.   
  9.  speed auto  
  10.   
  11. !  
  12.   
  13. ip default-gateway 192.168.1.1  

R3配置

SLA配置

  1. ip sla monitor 1  
  2.   
  3.  type echo protocol ipIcmpEcho 13.1.1.1  
  4.   
  5. ip sla monitor schedule 1 life forever start-time now  
  6.   
  7. ip sla monitor 2  
  8.   
  9.  type echo protocol ipIcmpEcho 23.1.1.2  
  10.   
  11.  timeout 60000 这里我延迟一分钟切换  
  12.   
  13. ip sla monitor schedule 2 life forever start-time now  

定义跟踪

  1. track 123 rtr 1 reachability         
  2.   
  3. track 124 rtr 2 reachability  
  4.   
  5. interface FastEthernet0/0  
  6.   
  7.  ip address 13.1.1.3 255.255.255.0  
  8.   
  9.  ip nat outside  
  10.   
  11.  ip virtual-reassembly  
  12.   
  13.  duplex auto  
  14.   
  15.  speed auto  
  16.   
  17. !  
  18.   
  19. interface FastEthernet1/0  
  20.   
  21.  ip address 23.1.1.3 255.255.255.0  
  22.   
  23.  ip nat outside  
  24.   
  25.  ip virtual-reassembly  
  26.   
  27.  duplex auto  
  28.   
  29.  speed auto  
  30.   
  31. !  
  32.   
  33. interface FastEthernet2/0  
  34.   
  35.  ip address 192.168.1.1 255.255.255.0  
  36.   
  37.  ip nat inside  
  38.   
  39.  ip virtual-reassembly  
  40.   
  41.  ip policy route-map 1  
  42.   
  43.  duplex auto  
  44.   
  45.  speed auto  
  46.   
  47. !  
  48.   
  49. interface FastEthernet3/0  
  50.   
  51.  ip address 192.168.2.1 255.255.255.0  
  52.   
  53.  ip nat inside  
  54.   
  55.  ip virtual-reassembly  
  56.   
  57.  ip policy route-map 1  
  58.   
  59.  duplex auto  
  60.   
  61.  speed auto  
  62.   
  63. !  
  64.   
  65. ip http server  
  66.   
  67. no ip http secure-server  
  68.   
  69. ip route 0.0.0.0 0.0.0.0 13.1.1.1 track 123  
  70.   
  71. ip route 0.0.0.0 0.0.0.0 23.1.1.2 track 124  
  72.   
  73. !  
  74.   
  75. !  
  76.   
  77. ip nat inside source route-map 2 interface FastEthernet0/0 overload  
  78.   
  79. ip nat inside source route-map 3 interface FastEthernet1/0 overload  
  80.   
  81. ip nat inside source route-map 4 interface FastEthernet0/0 overload  
  82.   
  83. ip nat inside source route-map 5 interface FastEthernet1/0 overload  
  84.   
  85. !  
  86.   
  87. ip access-list extended all-net  
  88.   
  89. access-list 1 permit 192.168.1.0 0.0.0.255  
  90. http://www.xiaoxiongboke.com   
  91. access-list 2 permit 192.168.2.0 0.0.0.255  
  92.   
  93. !  
  94.   
  95. route-map 1 permit 10  
  96.   
  97.  match ip address 1  
  98.   
  99.  set ip next-hop verify-availability 13.1.1.1 1 track 123  
  100.   
  101.  set ip next-hop verify-availability 23.1.1.2 2 track 124  
  102.   
  103. !  
  104.   
  105. route-map 1 permit 20  
  106.   
  107.  match ip address 2  
  108.   
  109.  set ip next-hop verify-availability 23.1.1.2 1 track 124  
  110.   
  111.  set ip next-hop verify-availability 13.1.1.1 2 track 123  
  112.   
  113. !  
  114.   
  115. route-map 2 permit 10  
  116.   
  117.  match ip address 1  
  118.   
  119.  match ip next-hop 3  
  120.   
  121. !  
  122.   
  123. route-map 3 permit 10  
  124.   
  125.  match ip address 1  
  126.   
  127.  match ip next-hop 4  
  128.   
  129. !  
  130.   
  131. route-map 4 permit 10  
  132.   
  133.  match ip address 2  
  134.   
  135.  match ip next-hop 3  
  136.   
  137. !  
  138.   
  139. route-map 5 permit 10  
  140.   
  141.  match ip address 2  
  142.   
  143.  match ip next-hop 4  

R2配置

  1. interface FastEthernet0/0  
  2.   
  3.  ip address 26.1.1.2 255.255.255.0  
  4.   
  5.  duplex auto  
  6.   
  7.  speed auto  
  8.   
  9. !           
  10.   
  11. interface FastEthernet1/0  
  12.   
  13.  ip address 23.1.1.2 255.255.255.0  
  14.   
  15.  duplex auto  
  16.   
  17.  speed auto  
  18.   
  19. !  
  20.   
  21. router ospf 1  
  22.   
  23.  log-adjacency-changes  
  24.   
  25.  network 23.1.1.0 0.0.0.255 area 0  
  26.   
  27.  network 26.1.1.0 0.0.0.255 area 0  

R1配置

  1. interface FastEthernet0/0  
  2.   
  3.  ip address 16.1.1.1 255.255.255.0  
  4.   
  5.  duplex auto  
  6.   
  7.  speed auto  
  8.   
  9. !           
  10.   
  11. interface FastEthernet1/0  
  12.   
  13.  ip address 13.1.1.1 255.255.255.0  
  14.   
  15.  duplex auto  
  16.   
  17.  speed auto  
  18.   
  19. !  
  20.   
  21. router ospf 1  
  22.   
  23.  log-adjacency-changes  
  24.   
  25.  network 13.1.1.0 0.0.0.255 area 0  
  26.   
  27.  network 16.1.1.0 0.0.0.255 area 0  
标签:

给我留言