pbr 多出口_双线(多线)接入的PBR+NAT+IPSLA配置方案

该博客提供了一种适用于小型企业或部门的多出口双线接入策略,通过PBR(策略路由)、NAT(网络地址转换)和IPSLA(IP服务级别协议)实现智能路由选择。当某个互联网出口出现故障时,流量将自动切换到另一个出口。配置包括DHCP地址池分配、接口设置、ACL定义、PBR配置、IP SLA主动探测和NAT动态转换等步骤。
摘要由CSDN通过智能技术生成

拓扑参考: (适用于小型企业单位或部门级别)

方案 1:

平时内网 192.168.1.0 网段走互联网出口(ISP1), 2.0 网段走互联网出口2(ISP2)

当出口 1 接口无法 ping 通运营商网关, 内网上网流量全走出口 ISP2

当出口 2 接口无法 ping 通运营商网关, 内网上网流量全走出口 ISP1

给内网主机分配地址 dhcp(可选):

ip dhcp pool 1

network 192.168.1.0 255.255.255.0

default-router 192.168.1.1 (内网 1 网关)

dns-server 1.1.1.1(ISP1 链路 dns) 2.2.2.2(ISP2 链路 dns)

ip dhcp pool 2

network 192.168.2.0 255.255.255.0

default-router 192.168.2.1 (内网 2 网关)

dns-server 2.2.2.2 1.1.1.1

给路由器本地分配 dns(可选):

ip name-server 1.1.1.1 2.2.2.2

接口设置(内网接口需匹配策略路由):

interface FastEthernet0/0(内网 1.0 网段)

ip address 192.168.1.1 255.255.255.0

ip nat inside

ip policy route-map ISP

interface FastEthernet0/1(内网 2.0 网段)

ip address 192.168.2.1 255.255.255.0

ip nat inside

ip policy route-map ISP

interface FastEthernet1/0(公网 ISP1 出接口)

ip address 10.1.1.2 255.255.255.248

ip nat outside

interface FastEthernet1/1(公网 ISP2 出接口)

ip address 20.1.1.2 255.255.255.248

ip nat outside

利用ACL定义感兴趣流:

access-list 101 permit ip 192.168.1.0 0.0.0.255 any

access-list 102 permit ip 192.168.2.0 0.0.0.255 any

PBR 配置:

route-map ISP permit 10

match ip address 101

set ip next-hop verify-availability 10.1.1.1 1 track 10

(优先走 10.1.1.1 的下一跳,如果 track10 的实例(也就是 sla1)down 掉,则该命令失效)

set ip next-hop 20.1.1.1

route-map ISP permit 20

match ip address 102

set ip next-hop verify-availability 20.1.1.1 2 track 20

set ip next-hop 10.1.1.1

(优先走 20.1.1.1 的下一跳,如果 track10 的实例(也就是 sla1)down 掉,则该命令失效)

配置思科 IP SLA 主动探测功能,起两个探测进程分别探测两个 ISP 网关的可达性:

ip sla 1

icmp-echo 10.1.1.1

frequency 10000

(每 10 秒钟由出口 1 去 ping 一次网关(1 个包),如果 ping 通,sla 状态为 up, ping 不通为

down)

ip sla 2

icmp-echo 20.1.1.1

frequency 10000

开始探测两个 IP SLA 进程:

ip sla schedule 1 life forever start-time now

ip sla schedule 2 life forever start-time now

绑定 sla 进程为实例,方便调用(进程 1 绑定为 track10,进程 2 绑定为 track20):

track 10 ip sla 1 reachability

track 20 ip sla 2 reachability

如果出口 2 为 ADSL 并且 ISP2 的网关 IP 可能会变化

那么 ip sla 进程 2 就没办法做了

可以根据出接口 2 协议的 up 或 down 状态来绑定 track20 实例可达性思密达:

track 20 interface FastEthernet1/1 line-protocol

----------------

默认路由分别指向两个出接口和下一跳(若 adsl 不知道网关IP,可以只填出接口)度量值一样:

ip route 0.0.0.0 0.0.0.0 FastEthernet1/0 10.1.1.1

ip route 0.0.0.0 0.0.0.0 FastEthernet1/1 20.1.1.1

动态 PAT 写法:

ip nat inside source route-map ISP11 interface FastEthernet1/0

overload

ip nat inside source route-map ISP12 interface FastEthernet1/1

overload

ip nat inside source route-map ISP22 interface FastEthernet1/1

overload

ip nat inside source route-map ISP21 interface FastEthernet1/0

overload

NAT 动态转换的 route-map 配置:

route-map ISP11 permit 10

match ip address 101

match interface FastEthernet1/0(匹配出口 1)

route-map ISP12 permit 10

match ip address 101

route-map ISP22 permit 10

match ip address 110

match interface FastEthernet1/1 (匹配出口 2)

route-map ISP21 permit 10

match ip address 102

  • 1
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值