# 创建ACL匹配需要走第一个公网IP的内网网段
acl advanced 3000
rule 5 permit ip source 192.168.1.0 0.0.0.255
rule 10 permit ip source 192.168.2.0 0.0.0.255
# 创建ACL匹配需要走第二个公网IP的内网网段
acl advanced 3001
rule 5 permit ip source 192.168.3.0 0.0.0.255
rule 10 permit ip source 192.168.4.0 0.0.0.255
# 创建流分类
traffic classifier c1 operator and
if-match acl 3000
traffic classifier c2 operator and
if-match acl 3001
# 创建流行为 - 指定下一跳为对应公网IP的网关
traffic behavior b1
redirect next-hop [第一个公网IP的网关地址]
traffic behavior b2
redirect next-hop [第二个公网IP的网关地址]
# 创建QoS策略
qos policy pbr
classifier c1 behavior b1
classifier c2 behavior b2
# 在流量进入的接口应用策略(通常是内网接口)
interface GigabitEthernet1/0/1 # 内网接口
qos apply policy pbr inbound
# 创建NAT地址组
nat address-group group1 0
address [公网IP1] [公网IP1]
nat address-group group2 0
address [公网IP2] [公网IP2]
# 创建ACL匹配内网网段
acl basic 2000
rule 5 permit source 192.168.1.0 0.0.255.255 # 匹配前两个网段
# 配置NAT出方向转换
interface GigabitEthernet1/0/0 # 外网接口
nat outbound 2000 address-group group1
nat outbound address-group group2
# 为每个公网IP创建默认路由,设置不同优先级
ip route-static 0.0.0.0 0.0.0.0 [网关1] preference 60
ip route-static 0.0.0.0 0.0.0.0 [网关2] preference 70
# 创建策略路由引导流量
policy-based-route pbr permit node 10
if-match acl 3000
apply ip-address next-hop [网关1]
policy-based-route pbr permit node 20
if-match acl 3001
apply ip-address next-hop [网关2]
# 查看策略路由状态
display policy-based-route
# 查看NAT会话,确认源IP转换
display nat session
# 查看QoS策略应用情况
display qos policy interface
# 实时调试(谨慎使用)
debugging nat packet
terminal debugging
我是这么做的,然后在外网口调用,但是没成功,流量都是走的1个出口出去的 policy-based-route 1 permit node 1 if-match acl 3000 apply next-hop 1.1.1.2 # policy-based-route 1 permit node 2 if-match acl 3001 apply next-hop 2.2.2.2
policy-based-route 1 permit node 200 这样呗,为啥要加这个啊
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
policy-based-route 1 permit node 200 这样呗,为啥要加这个啊