外接兩根網絡進線,(一根專線,一根普通家用寬帶)。應用場景描述,局域網內小部分電腦實現通過普通家用寬帶上網,其餘大部分電腦通過專線上網。請問如何設置。謝謝。設備為F1000-AK125。
目前組裝為:路由器-行為管理器-核心交換機-樓層交換機-客戶端設備。每個樓層劃分vlan,vlan間互通。
(0)
最佳答案
配置策略路由:
防火牆作為網絡出口設備,外網有移動和聯通兩條線路。內網有192.168.1.0和192.168.2.0兩個網段,需要實現192.168.1.0網段走移動線路,192.168.2.0網段走聯通線路。當兩條線路中的一條線路故障時數據可以通過正常鏈路轉發。
防火牆上網配置請參考“2.2.2 防火牆外網使用固定IP地址上網配置方法”進行配置,本文隻針對策略路由配置進行介紹。
# 創建ACL 3000匹配192.168.1.0網段數據
<H3C>system-view
[H3C]acl advanced 3000
[H3C-acl-ipv4-adv-3000]rule 0 permit ip source 192.168.1.0 0.0.0.255
[H3C-acl-ipv4-adv-3000]quit
# 創建ACL 3001匹配192.168.2.0網段數據
[H3C]acl advanced 3001
[H3C-acl-ipv4-adv-3001]rule 0 permit ip source 192.168.2.0 0.0.0.255
[H3C-acl-ipv4-adv-3001]quit
# 創建策略路由neiwang節點5匹配192.168.1.0網段的數據由移動線路轉發。
[H3C]policy-based-route neiwang node 5
[H3C-pbr-neiwang-5]if-match acl 3000
[H3C-pbr-neiwang-5]apply next-hop 1.1.1.2
[H3C-pbr-neiwang-5]quit
注:next-hop後的地址為移動線路的網關
# 創建策略路由neiwang節點10匹配192.168.2.0網段的數據由聯通線路轉發。
[H3C]policy-based-route neiwang node 10
[H3C-pbr-neiwang-10]if-match acl 3001
[H3C-pbr-neiwang-10]apply next-hop 2.2.2.2
[H3C-pbr-neiwang-10]quit
注:next-hop後的地址為聯通線路的網關
# 在防火牆連接內網的接口GigabitEthernet 1/0/4口調用策略路由
[H3C]interface GigabitEthernet 1/0/4
[H3C-GigabitEthernet1/0/4]ip policy-based-route neiwang
[H3C-GigabitEthernet1/0/4]quit
注:策略路由必須調用在內網接口才能生效。
[H3C]save force
(0)
policy-based-route neiwang node 5 配置後如果一條線路故障時數據還可以通過正常鏈路轉發嗎?
如圖1所示,缺省情況下,Device的VLAN接口2上收到的所有訪問Server的報文根據路由表轉發的下一跳均為10.4.1.2。
現要求在Device上配置IPv4策略路由,對於訪問Server的報文實現如下要求:
(1) 首先匹配Vlan-interface2上收到的源IP地址為10.2.1.1的報文,將該報文的下一跳重定向到10.5.1.2;
(2) 其次匹配Vlan-interface2上收到的HTTP報文,將該報文的下一跳重定向到10.3.1.2。
圖1 IPv4策略路由特性典型配置組網圖
· 為了確保能同時滿足對於兩種不同類型的報文重定向到不同的下一跳,需要配置兩個訪問控製列表,一個用於匹配Vlan-interface2上收到的源IP地址為10.2.1.1的報文,另一個用於匹配Vlan-interface2上收到的HTTP報文,並在策略路由中創建兩個節點,分別對匹配上的報文進行重定向;
· 同一條策略路由中,創建的節點編號越小,優先級越高。為了確保Vlan-interface2上收到源IP地址為10.2.1.1的HTTP報文下一跳能優先被重定向到10.5.1.2,需要在策略路由中配置該策略使用較小的節點編號(本例中使用0號節點,另一策略使用1號節點)。
#配置Vlan-interface2的IP地址。
<Device> system-view
[Device] interface vlan-interface 2
[Device-Vlan-interface2] ip address 10.1.2.1 255.255.255.0
[Device-Vlan-interface2] quit
#請參考以上方法配置圖1中其它接口的IP地址,配置步驟這裏省略。
# 配置靜態路由,保證三條路徑都可達,並且缺省下一跳為10.4.1.2。
[Device] ip route-static 192.168.1.0 24 10.3.1.2
[Device] ip route-static 192.168.1.0 24 10.4.1.2 preference 40
[Device] ip route-static 192.168.1.0 24 10.5.1.2
# 定義訪問控製列表ACL 3005,用於匹配源IP地址為10.2.1.1的報文。
[Device] acl advanced 3005
[Device-acl-ipv4-adv-3005] rule 0 permit ip source 10.2.1.1 0
[Device-acl-ipv4-adv-3005] quit
# 定義訪問控製列表ACL 3006,用於匹配HTTP報文。
[Device] acl advanced 3006
[Device-acl-ipv4-adv-3006] rule 0 permit tcp destination-port eq www
[Device-acl-ipv4-adv-3006] quit
# 創建策略路由pbr1的0號節點,將匹配ACL 3005的報文下一跳重定向到10.5.1.2。
[Device] policy-based-route pbr1 permit node 0
[Device-pbr-pbr1-0] if-match acl 3005
[Device-pbr-pbr1-0] apply next-hop 10.5.1.2
[Device-pbr-pbr1-0] quit
# 創建策略路由pbr1的1號節點,將匹配ACL 3006的報文下一跳重定向到10.3.1.2。
[Device] policy-based-route pbr1 permit node 1
[Device-pbr-pbr1-1] if-match acl 3006
[Device-pbr-pbr1-1] apply next-hop 10.3.1.2
[Device-pbr-pbr1-1] quit
# 在Device的接口Vlan-interface2上應用策略。
[Device] interface vlan-interface 2
[Device-Vlan-interface2] ip policy-based-route pbr1
[Device-Vlan-interface2] quit
通過display ip policy-based-route命令可以查看到當前策略路由配置已經配置成功:
[Device] display ip policy-based-route policy pbr1
Policy name: pbr1
node 0 permit:
if-match acl 3005
apply next-hop 10.5.1.2
node 1 permit:
if-match acl 3006
apply next-hop 10.3.1.2
# 通過tracert命令查看以下報文的轉發路徑(使用Tracert功能需要在中間設備上開啟ICMP超時報文發送功能,在目的端開啟ICMP目的不可達報文發送功能):
源IP為10.1.1.1的非HTTP報文,重定向到10.4.1.2進行轉發。
<Switch> tracert -a 10.1.1.1 192.168.1.1
traceroute to 192.168.1.1 (192.168.1.1) from 10.1.1.1, 30 hops at most, 40 bytes
each packet, press CTRL_C to break
1 10.1.2.1 (10.1.2.1) 2.178 ms 1.364 ms 1.058 ms
2 10.4.1.2 (10.4.1.2) 1.548 ms 1.248 ms 1.112 ms
3 192.168.1.1 (192.168.1.1) 1.594 ms 1.321 ms 1.093 ms
源IP為10.2.1.1的報文,重定向到10.5.1.2進行轉發。
<Switch> tracert -a 10.2.1.1 192.168.1.1
traceroute to 192.168.1.1 (192.168.1.1) from 10.2.1.1, 30 hops at most, 40 bytes
each packet, press CTRL_C to break
1 10.1.2.1 (10.1.2.1) 1.721 ms 1.226 ms 1.050 ms
2 10.5.1.2 (10.5.1.2) 4.494 ms 1.385 ms 1.170 ms
3 192.168.1.1 (192.168.1.1) 1.448 ms 1.304 ms 1.093 ms
#
vlan 1
#
vlan 2 to 5
#
policy-based-route pbr1 permit node 0
if-match acl 3005
apply next-hop 10.5.1.2
#
policy-based-route pbr1 permit node 1
if-match acl 3006
apply next-hop 10.3.1.2
#
interface Vlan-interface2
ip address 10.1.2.1 255.255.255.0
ip policy-based-route pbr1
#
interface Vlan-interface3
ip address 10.3.1.1 255.255.255.0
#
interface Vlan-interface4
ip address 10.4.1.1 255.255.255.0
#
interface Vlan-interface5
ip address 10.5.1.1 255.255.255.0
#
interface Ten-GigabitEthernet3/0/1
port link-mode bridge
port access vlan 2
#
interface Ten-GigabitEthernet3/0/3
port link-mode bridge
port access vlan 3
#
interface Ten-GigabitEthernet3/0/4
port link-mode bridge
port access vlan 4
#
interface Ten-GigabitEthernet3/0/5
port link-mode bridge
port access vlan 5
#
ip route-static 192.168.1.0 24 10.3.1.2
ip route-static 192.168.1.0 24 10.4.1.2 preference 40
ip route-static 192.168.1.0 24 10.5.1.2
#
acl advanced 3005
rule 0 permit ip source 10.2.1.1 0
#
acl advanced 3006
rule 0 permit tcp destination-port eq www
(0)
親~登錄後才可以操作哦!
確定你的郵箱還未認證,請認證郵箱或綁定手機後進行當前操作
舉報
×
侵犯我的權益
×
侵犯了我企業的權益
×
抄襲了我的內容
×
原文鏈接或出處
誹謗我
×
對根叔社區有害的內容
×
不規範轉載
×
舉報說明
policy-based-route neiwang node 5 配置後如果一條線路故障時數據還可以通過正常鏈路轉發嗎?