A-A+
使用ospf协议的ISP双线冗余路由器配置方法和命令行
本文通过一个并不复杂的组网来进行一个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:配置
- interface Loopback0
- ip address 1.1.1.1 255.255.255.255
- !
- interface FastEthernet0/0
- ip address 16.1.1.6 255.255.255.0
- duplex auto
- speed auto
- !
- interface FastEthernet1/0
- ip address 26.1.1.6 255.255.255.0
- duplex auto
- speed auto
- !
- router ospf 1
- log-adjacency-changes
- network 1.1.1.1 0.0.0.0 area 0
- network 16.1.1.0 0.0.0.255 area 0
- network 26.1.1.0 0.0.0.255 area 0
- !
R5 配置
- interface FastEthernet0/0
- ip address 192.168.2.2 255.255.255.0
- no ip route-cache
- duplex auto
- speed auto
- !
- ip default-gateway 192.168.2.1
R4配置
- interface FastEthernet0/0
- ip address 192.168.1.2 255.255.255.0
- no ip route-cache
- duplex auto
- speed auto
- !
- ip default-gateway 192.168.1.1
R3配置
SLA配置
- ip sla monitor 1
- type echo protocol ipIcmpEcho 13.1.1.1
- ip sla monitor schedule 1 life forever start-time now
- ip sla monitor 2
- type echo protocol ipIcmpEcho 23.1.1.2
- timeout 60000 这里我延迟一分钟切换
- ip sla monitor schedule 2 life forever start-time now
定义跟踪
- track 123 rtr 1 reachability
- track 124 rtr 2 reachability
- interface FastEthernet0/0
- ip address 13.1.1.3 255.255.255.0
- ip nat outside
- ip virtual-reassembly
- duplex auto
- speed auto
- !
- interface FastEthernet1/0
- ip address 23.1.1.3 255.255.255.0
- ip nat outside
- ip virtual-reassembly
- duplex auto
- speed auto
- !
- interface FastEthernet2/0
- ip address 192.168.1.1 255.255.255.0
- ip nat inside
- ip virtual-reassembly
- ip policy route-map 1
- duplex auto
- speed auto
- !
- interface FastEthernet3/0
- ip address 192.168.2.1 255.255.255.0
- ip nat inside
- ip virtual-reassembly
- ip policy route-map 1
- duplex auto
- speed auto
- !
- ip http server
- no ip http secure-server
- ip route 0.0.0.0 0.0.0.0 13.1.1.1 track 123
- ip route 0.0.0.0 0.0.0.0 23.1.1.2 track 124
- !
- !
- ip nat inside source route-map 2 interface FastEthernet0/0 overload
- ip nat inside source route-map 3 interface FastEthernet1/0 overload
- ip nat inside source route-map 4 interface FastEthernet0/0 overload
- ip nat inside source route-map 5 interface FastEthernet1/0 overload
- !
- ip access-list extended all-net
- access-list 1 permit 192.168.1.0 0.0.0.255
- http://www.xiaoxiongboke.com
- access-list 2 permit 192.168.2.0 0.0.0.255
- !
- route-map 1 permit 10
- match ip address 1
- set ip next-hop verify-availability 13.1.1.1 1 track 123
- set ip next-hop verify-availability 23.1.1.2 2 track 124
- !
- route-map 1 permit 20
- match ip address 2
- set ip next-hop verify-availability 23.1.1.2 1 track 124
- set ip next-hop verify-availability 13.1.1.1 2 track 123
- !
- route-map 2 permit 10
- match ip address 1
- match ip next-hop 3
- !
- route-map 3 permit 10
- match ip address 1
- match ip next-hop 4
- !
- route-map 4 permit 10
- match ip address 2
- match ip next-hop 3
- !
- route-map 5 permit 10
- match ip address 2
- match ip next-hop 4
R2配置
- interface FastEthernet0/0
- ip address 26.1.1.2 255.255.255.0
- duplex auto
- speed auto
- !
- interface FastEthernet1/0
- ip address 23.1.1.2 255.255.255.0
- duplex auto
- speed auto
- !
- router ospf 1
- log-adjacency-changes
- network 23.1.1.0 0.0.0.255 area 0
- network 26.1.1.0 0.0.0.255 area 0
R1配置
- interface FastEthernet0/0
- ip address 16.1.1.1 255.255.255.0
- duplex auto
- speed auto
- !
- interface FastEthernet1/0
- ip address 13.1.1.1 255.255.255.0
- duplex auto
- speed auto
- !
- router ospf 1
- log-adjacency-changes
- network 13.1.1.0 0.0.0.255 area 0
- network 16.1.1.0 0.0.0.255 area 0