公司两条宽带。我现在内网有两段地址。分别是192.168.0.0/24 。192.168.1.0/24.现在想用192.168.0.0走第一条宽带。192.168.1.0走第二条宽带。。这个策略路由怎么设置。命令是多少?
(0)
最佳答案
可参考如下:
交换机SW1上配置一条静态路由,使终端访问114.114.114.114的时候通过R2,其中192.168.2.0这个网段,访问114.114.114.114 的时候匹配策略路由从R3去访问。
一.交换机和路由器上ip地址基本配置
#在SW1上进图系统视图
<H3C>system-view
System View: return to User View with Ctrl+Z.
#创建vlan 1-4
[H3C]vlan 1 to 4
#配置vlan 1-vlan 4虚接口IP地址
[H3C]interface Vlan-interface 1
[H3C-Vlan-interface1] ip address 192.168.1.1 255.255.255.0
[H3C-Vlan-interface1]quit
[H3C]interface Vlan-interface 2
[H3C-Vlan-interface2] ip address 192.168.2.1 255.255.255.0
[H3C-Vlan-interface2]quit
[H3C]interface Vlan-interface 3
[H3C-Vlan-interface3] ip address 10.10.10.1 255.255.255.0
[H3C-Vlan-interface3]quit
[H3C]interface Vlan-interface 4
[H3C-Vlan-interface4] ip address 20.20.20.1 255.255.255.0
[H3C-Vlan-interface4]quit
#将端口分别划分到所属vlan,端口1属于vlan 3,端口4属于vlan 4,端口5属于默人vlan 1,端口6属于vlan 2。
[H3C]interface GigabitEthernet 1/0/1
[H3C-GigabitEthernet1/0/1] port access vlan 3
[H3C-GigabitEthernet1/0/1]quit
[H3C]interface GigabitEthernet 1/0/4
[H3C-GigabitEthernet1/0/4] port access vlan 4
[H3C-GigabitEthernet1/0/4]quit
[H3C]interface GigabitEthernet 1/0/6
[H3C-GigabitEthernet1/0/6] port access vlan 2
[H3C-GigabitEthernet1/0/6]quit
#配置到114.114.114.0网段的静态路由
[H3C] ip route-static 114.114.114.0 24 10.10.10.2
[H3C]save force
#在R1上进图系统视图
<H3C>system-view
System View: return to User View with Ctrl+Z.
#创建环回接口LoopBack 0用来模拟主机,地址是114.114.114.114/24
[H3C]interface LoopBack 0
[H3C-LoopBack0]ip address 114.114.114.114 255.255.255.0
[H3C-LoopBack0]quit
#为路由器1口和2口分别配置IP地址。
[H3C]int GigabitEthernet 0/1
[H3C-GigabitEthernet0/1] ip address 30.30.30.1 255.255.255.0
[H3C]int GigabitEthernet 0/2
[H3C-GigabitEthernet0/2] ip address 40.40.40.1 255.255.255.0
[H3C-GigabitEthernet0/2]quit
#配置到192.168.1.0网段的静态路由
[H3C]ip route-static 192.168.1.0 24 30.30.30.2
#配置到114.114.114.0网段的静态路由
[H3C]ip route-static 192.168.2.0 24 40.40.40.2
#开启设备的ICMP目的不可达报文的发送功能
[H3C]ip unreachables enable
#开启ICMP超时报文发送功能
[H3C]ip ttl-expires enable
[H3C]save force
#在R2上进图系统视图
<H3C>system-view
System View: return to User View with Ctrl+Z.
#为路由器1口和2口分别配置IP地址。
[H3C]int GigabitEthernet 0/0
[H3C-GigabitEthernet0/0] ip address 30.30.30.2 255.255.255.0
[H3C]int GigabitEthernet 0/1
[H3C-GigabitEthernet0/1] ip address 10.10.10.2 255.255.255.0
#配置到114.114.114.0网段的静态路由
[H3C] ip route-static 114.114.114.0 24 30.30.30.1
#配置到192.168.1.0网段的静态路由
[H3C] ip route-static 192.168.1.0 24 10.10.10.1
#配置到114.114.114.0网段的静态路由
[H3C] ip route-static 192.168.2.0 24 10.10.10.1
#开启设备的ICMP目的不可达报文的发送功能
[H3C]ip unreachables enable
#开启ICMP超时报文发送功能
[H3C]ip ttl-expires enable
[H3C]save force
#在R3上进图系统视图
<H3C>system-view
System View: return to User View with Ctrl+Z.
#为路由器1口和2口分别配置IP地址。
[H3C]int GigabitEthernet 0/0
[H3C-GigabitEthernet0/0] ip address 40.40.40.2 255.255.255.0
[H3C]int GigabitEthernet 0/1
[H3C-GigabitEthernet0/1] ip address 20.20.20.2 255.255.255.0
#配置到114.114.114.0网段的静态路由
[H3C] ip route-static 114.114.114.0 24 40.40.40.1
#配置到192.168.1.0网段的静态路由
[H3C] ip route-static 192.168.1.0 24 10.10.10.2
#配置到114.114.114.0网段的静态路由
[H3C] ip route-static 192.168.2.0 24 10.10.10.
#开启设备的ICMP目的不可达报文的发送功能
[H3C]ip unreachables enable
#开启ICMP超时报文发送功能
[H3C]ip ttl-expires enable
[H3C]save force
二.交换机策略路由配置
<H3C>system-view
System View: return to User View with Ctrl+Z.
#定义访问控制列表3000,用来匹配内网源地址为192.168.2.0/24网段的数据流
[H3C]acl advanced 3000
[H3C-acl-ipv4-adv-3000]rule permit ip source 192.168.2.0 0.0.0.255
[H3C-acl-ipv4-adv-3000]quit
# 定义访问控制列表3001,用来匹配内网192.168.2.0/24网段去访问内网192.168.1.0/24网段的数据流。
[H3C]acl advanced 3001
[H3C-acl-adv-3001]rule permit ip source 192.168.2.0 0.0.0.255 destination 192.168.1.0 0.0.0.255
[H3C-acl-adv-3001]quit
# 创建策略路由,名称为aaa,节点为10,匹配acl 3001的数据流,不设置apply动作(如果不设置动作,则匹配到的数据转发时根据路由表来进行转,且不再匹配下一节点,配置这个节点的作用是实现内网不同网段之间互访的流量不匹配策略路由,达到可以互访的目的。备注:默认情况下,网关在路由器上的不同网段是可以互相访问的)。
[H3C]policy-based-route aaa permit node 10
[H3C-pbr-aaa-10]if-match acl 3001
[H3C-pbr-aaa-10]quit
#创建策略路由aaa的节点20,匹配acl 3000的数据流,设置apply动作,指定数据的下一跳为20.20.20.2。
[H3C]policy-based-route aaa permit node 20
[H3C-pbr-aaa-20]if-match acl 3000
[H3C-pbr-aaa-20]apply next-hop 20.20.20.2
[H3C-pbr-aaa-20]quit
#在内网VLAN虚接口(网关)上应用策略路由
[H3C]interface vlan 2
[H3C-Vlan-interface2]ip policy-based-route aaa
[H3C-Vlan-interface2]quit
[H3C]save force
# 交换机上没有配置策略路由的时候,在两台终端上tracert路径的结果如下:
192.168.1.2:
192.168.2.2:
# 配置了策略路由以后
192.168.1.2:
192.168.2.2:
(0)
建议PBR+NQA联动
policy-based-route PBR permit node 10
if-match acl 2001
apply next-hop 10.18.44.1 track 1
apply next-hop 115.238.199.137
#
nqa entry admin to_ct ////电信
type icmp-echo
destination ip
115.238.199.137
frequency 5000
history-record enable
history-record number 10
next-hop ip
115.238.199.137
probe count 10
probe timeout 500
reaction 1 checked-element probe-fail threshold-type consecutive 3 action-type trigger-only
#
nqa entry admin to_education ////教育网
type icmp-echo
destination
10.18.77.1
frequency 5000
history-record enable
history-record number 10
next-hop ip
10.18.77.1
probe count 10
probe timeout 500
reaction 1 checked-element probe-fail threshold-type consecutive 3 action-type trigger-only
#
nqa schedule admin to_ct start-time now lifetime forever
nqa schedule admin to_education start-time now lifetime forever
两条去两个公网的默认路由+内网ACL
#
ip route-static 0.0.0.0 0
115.238.199.137 track 2
ip route-static 0.0.0.0 0 10.18.77.1 preference 65
ip route-static 172.20.0.0 16 172.20.1.254
#
acl basic 2000
rule 5 permit source 172.20.0.0 0.0.255.255
#
acl basic 2001
rule 5 permit source 172.20.30.0 0.0.0.255
rule 10 permit source 172.20.20.0 0.0.0.255
rule 16 permit source 172.20.40.90 0
rule 17 permit source 172.20.40.91 0
rule 18 permit source 172.20.40.92 0
rule 19 permit source 172.20.40.93 0
rule 20 permit source 172.20.40.94 0
(0)
暂无评论
亲~登录后才可以操作哦!
确定你的邮箱还未认证,请认证邮箱或绑定手机后进行当前操作
举报
×
侵犯我的权益
×
侵犯了我企业的权益
×
抄袭了我的内容
×
原文链接或出处
诽谤我
×
对根叔社区有害的内容
×
不规范转载
×
举报说明
暂无评论