简介
本文档介绍在思科集成服务路由器(ISR)2900系列上使用DHCP配置双ISP故障切换的过程。
先决条件
要求
本文档没有任何特定的要求。
使用的组件
本文档不限于特定的软件和硬件版本。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您使用的是真实网络,请确保您已经了解所有命令的潜在影响。
配置
网络图
配置
当路由器上有两个ISP端点,并且都通过DHCP从ISP获取IP地址时,此设置非常有用。
CLIENT#sh ip int b
Interface IP-Address OK? Method Status Protocol
Embedded-Service-Engine0/0 unassigned YES NVRAM administratively down down
GigabitEthernet0/0 10.106.38.136 YES DHCP up up
GigabitEthernet0/1 unassigned YES NVRAM up up
GigabitEthernet0/1.100 1.1.1.4 YES DHCP up up
GigabitEthernet0/1.200 2.2.2.4 YES DHCP up up
GigabitEthernet0/2 unassigned YES NVRAM down down
Loopback0 11.11.11.11 YES NVRAM up up
interface gigabitethernet 0/1.100和interface gigabitethernet 0/1.200是两个接口,分别从两个ISP获取dhcp ip地址。
interface gigabitethernet 0/1.100为主接口,interface gigabitethernet 0/1.200为辅助接口。
静态路由配置:
具有更高AD值的辅助路由:
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/1.200 dhcp 200
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/1.100 dhcp
接口配置:
CLIENT#sh run int GigabitEthernet0/1.100
Building configuration...
Current configuration : 112 bytes
!
interface GigabitEthernet0/1.100
encapsulation dot1Q 100
ip dhcp client route track 2
ip address dhcp
end
注意:在接口上发出ip address dhcp命令之前,必须配置ip dhcp client命令。仅当从DHCP获取IP地址时,才会检查ip dhcp client命令。如果在从DHCP获取IP地址后发出ip dhcp client命令,则直到路由器下一次从DHCP获取IP地址时才会生效。
CLIENT#sh run int GigabitEthernet0/1.200
Building configuration...
Current configuration : 82 bytes
!
interface GigabitEthernet0/1.200
encapsulation dot1Q 200
ip address dhcp
end
IP服务级别协议(SLA):跟踪路由来源主接口:
CLIENT#sh run | sec ip sla
track 2 ip sla 2 reachability
ip sla 2
icmp-echo 11.11.11.11 source-interface GigabitEthernet0/1.100
ip sla schedule 2 life forever start-time now
ip sla auto discovery
CLIENT#sh ip route
C 1.1.1.0/24 is directly connected, GigabitEthernet0/1.100
L 1.1.1.4/32 is directly connected, GigabitEthernet0/1.100
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, GigabitEthernet0/1.200
L 2.2.2.4/32 is directly connected, GigabitEthernet0/1.200
验证
使用本部分可确认配置能否正常运行。
当跟踪启动时,默认网关将路由指向主路由:
CLIENT#sh ip route track-table
ip route 0.0.0.0 0.0.0.0 1.1.1.1 254 track 2 state is [up]
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/1.100 1.1.1.1 track 2 state is [up]
CLIENT#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is 1.1.1.1 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 1.1.1.1, GigabitEthernet0/1.100
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, GigabitEthernet0/1.100
L 1.1.1.5/32 is directly connected, GigabitEthernet0/1.100
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, GigabitEthernet0/1.200
L 2.2.2.4/32 is directly connected, GigabitEthernet0/1.200
当路径断开时,默认网关将路由指向辅助路由:
CLIENT#sh ip route track-table
ip route 0.0.0.0 0.0.0.0 1.1.1.1 254 track 2 state is [down]
ip route 0.0.0.0 0.0.0.0 GigabitEthernet0/1.100 1.1.1.1 track 2 state is [down]
CLIENT#sh ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
+ - replicated route, % - next hop override
Gateway of last resort is 2.2.2.1 to network 0.0.0.0
S* 0.0.0.0/0 [200/0] via 2.2.2.1, GigabitEthernet0/1.200
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, GigabitEthernet0/1.100
L 1.1.1.5/32 is directly connected, GigabitEthernet0/1.100
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, GigabitEthernet0/1.200
L 2.2.2.4/32 is directly connected, GigabitEthernet0/1.200
10.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 10.106.38.0/24 is directly connected, GigabitEthernet0/0
L 10.106.38.136/32 is directly connected, GigabitEthernet0/0
故障排除
目前没有针对此配置的故障排除信息。