如何实现“访问网通站点走网通线路,访问电信站点走电信线路”呢?现在,我们以华为AR系列路由器为例,说明如何通过配置策略路由的方式满足以上需要。
一:配置访问控制列表,定义访问目的地址为网通的地址段
进入系统视图,创建ACL 3100:<Quidway>systemSystem View: return to User View with Ctrl Z.[Quidway]acl num 3100[Quidway-acl-adv-3100]可以直接复制粘贴如下规则:rule 0 permit ip destination 60.0.0.0 0.7.255.255rule 1 permit ip destination 60.0.0.0 0.8.255.255rule 2 permit ip destination 60.0.0.0 0.9.255.255rule 3 permit ip destination 60.0.0.0 0.10.255.255rule 4 permit ip destination 60.0.0.0 0.11.255.255rule 5 permit ip destination 60.8.0.0 0.3.255.255rule 6 permit ip destination 60.12.0.0 0.0.255.255rule 7 permit ip destination 60.13.0.0 0.0.63.255rule 8 permit ip destination 60.13.128.0 0.0.127.255rule 9 permit ip destination 60.16.0.0 0.15.255.255rule 10 permit ip destination 60.208.0.0 0.7.255.255rule 11 permit ip destination 60.216.0.0 0.1.255.255rule 12 permit ip destination 60.220.0.0 0.3.255.255rule 13 permit ip destination 61.48.0.0 0.3.255.255rule 14 permit ip destination 61.52.0.0 0.1.255.255rule 15 permit ip destination 61.54.0.0 0.0.255.255rule 16 permit ip destination 61.55.0.0 0.0.255.255rule 17 permit ip destination 61.133.0.0 0.0.127.255rule 18 permit ip destination 61.134.64.0 0.0.63.255rule 19 permit ip destination 61.134.128.0 0.0.127.255rule 20 permit ip destination 61.135.0.0 0.0.255.255rule 21 permit ip destination 61.136.0.0 0.0.255.255rule 22 permit ip destination 61.138.0.0 0.0.127.255rule 23 permit ip destination 61.139.128.0 0.0.63.255rule 24 permit ip destination 61.148.0.0 0.0.255.255rule 25 permit ip destination 61.149.0.0 0.0.255.255rule 26 permit ip destination 61.156.0.0 0.0.255.255rule 27 permit ip destination 61.158.0.0 0.0.255.255rule 28 permit ip destination 61.159.0.0 0.0.63.255rule 29 permit ip destination 61.161.0.0 0.0.63.255rule 30 permit ip destination 61.161.128.0 0.0.127.255rule 31 permit ip destination 61.162.0.0 0.0.255.255rule 32 permit ip destination 61.163.0.0 0.0.255.255rule 33 permit ip destination 61.167.0.0 0.0.255.255rule 34 permit ip destination 61.168.0.0 0.0.255.255rule 35 permit ip destination 61.176.0.0 0.0.255.255rule 36 permit ip destination 61.179.0.0 0.0.255.255rule 37 permit ip destination 61.180.128.0 0.0.127.255rule 38 permit ip destination 61.181.0.0 0.0.255.255rule 39 permit ip destination 61.182.0.0 0.0.255.255rule 40 permit ip destination 61.189.0.0 0.0.127.255rule 41 permit ip destination 202.32.0.0 0.31.255.255rule 42 permit ip destination 202.96.64.0 0.0.31.255rule 43 permit ip destination 202.97.128.0 0.0.127.255rule 44 permit ip destination 202.98.0.0 0.0.31.255rule 45 permit ip destination 202.99.0.0 0.0.255.255rule 46 permit ip destination 202.102.128.0 0.0.63.255rule 47 permit ip destination 202.102.224.0 0.0.1.255rule 48 permit ip destination 202.106.0.0 0.0.255.255rule 49 permit ip destination 202.107.0.0 0.0.127.255rule 50 permit ip destination 202.108.0.0 0.0.255.255rule 51 permit ip destination 202.110.0.0 0.0.127.255rule 52 permit ip destination 202.110.192.0 0.0.63.255rule 53 permit ip destination 202.111.128.0 0.0.63.255rule 54 permit ip destination 210.51.0.0 0.0.255.255rule 55 permit ip destination 210.52.0.0 0.1.255.255rule 56 permit ip destination 218.4.0.0 0.3.255.255rule 57 permit ip destination 218.10.0.0 0.1.255.255rule 58 permit ip destination 218.21.128.0 0.0.127.255rule 59 permit ip destination 218.24.0.0 0.1.255.255rule 60 permit ip destination 218.26.0.0 0.0.255.255rule 61 permit ip destination 218.27.0.0 0.0.255.255rule 62 permit ip destination 218.28.0.0 0.1.255.255rule 63 permit ip destination 218.56.0.0 0.3.255.255rule 64 permit ip destination 218.60.0.0 0.1.255.255rule 65 permit ip destination 218.62.0.0 0.0.127.255rule 66 permit ip destination 218.67.128.0 0.0.127.255rule 67 permit ip destination 218.68.0.0 0.1.255.255rule 68 permit ip destination 219.141.128.0 0.0.127.255rule 69 permit ip destination 219.142.0.0 0.1.255.255rule 70 permit ip destination 219.154.0.0 0.1.255.255rule 71 permit ip destination 219.156.0.0 0.1.255.255rule 72 permit ip destination 219.158.0.0 0.0.255.255rule 73 permit ip destination 219.159.0.0 0.0.63.255rule 74 permit ip destination 221.0.0.0 0.3.255.255rule 75 permit ip destination 221.4.0.0 0.1.255.255rule 76 permit ip destination 221.6.0.0 0.0.255.255rule 77 permit ip destination 221.7.128.0 0.0.127.255rule 78 permit ip destination 221.8.0.0 0.1.255.255rule 79 permit ip destination 221.10.0.0 0.0.255.255 rule 80 permit ip destination 221.11.0.0 0.0.127.255rule 81 permit ip destination 221.12.0.0 0.3.255.255rule 82 permit ip destination 221.12.0.0 0.0.127.255rule 83 permit ip destination 221.12.128.0 0.0.63.255rule 84 permit ip destination 221.192.0.0 0.3.255.255rule 85 permit ip destination 221.196.0.0 0.1.255.255rule 86 permit ip destination 221.199.0.0 0.0.31.255rule 87 permit ip destination 221.199.32.0 0.0.15.255rule 88 permit ip destination 221.199.128.0 0.0.63.255rule 89 permit ip destination 221.199.192.0 0.0.15.255rule 90 permit ip destination 221.200.0.0 0.3.255.255rule 91 permit ip destination 221.204.0.0 0.1.255.255rule 92 permit ip destination 221.207.0.0 0.0.63.255rule 93 permit ip destination 221.208.0.0 0.15.255.255rule 94 permit ip destination 222.128.0.0 0.3.255.255rule 95 permit ip destination 222.132.0.0 0.3.255.255rule 96 permit ip destination 222.136.0.0 0.7.255.255rule 97 permit ip destination 222.160.0.0 0.3.255.255
注:以上规则已经包含大部分网通地址段,如有更新可以动态添加。
二:定义策略路由指定访问网通地址段的数据报文下一跳为网通网关
[Quidway]route-policy auto permit node 1%New sequence of this list[Quidway-route-policy]if-match acl 3100[Quidway-route-policy]apply ip-address next-hop 10.1.1.2[Quidway-route-policy]dis this#route-policy auto permit node 1if-match acl 3100apply ip-address next-hop 10.1.1.2#return[Quidway-route-policy]
注:上面配置中以地址10.1.1.2为例作为网通网关地址,应用中可根据实际需要修改。
三:在连接局域网接口下应用此策略路由
[Quidway]int e3/0[Quidway-Ethernet3/0]dis this#interface Ethernet3/0ip address 192.168.1.1 255.255.255.0#return[Quidway-Ethernet3/0]ip policy route-policy auto[Quidway-Ethernet3/0]dis this#interface Ethernet3/0ip address 192.168.1.1 255.255.255.0ip policy route-policy auto#return[Quidway-Ethernet3/0]
四:配置默认路由器经过电信网关
ip route-static 0.0.0.0 0.0.0.0 20.1.1.2 preference 60
注:上面配置中以地址20.1.1.2为例作为电信网关地址,应用中可根据实际需要修改。
经过如上三个配置步骤后,路由器便能自动区分网通流量和电信流量,使访问网通站点走网通线路,访问电信站点走电信线路。并且当网通线路出问题后所有流量都会自动切换到电信线路上,使用户能够不间断访问网络。
编者注:对于这个问题,在IXPUB论坛里,还有更详细的回答与讨论,详情请参看:
IXPUB论坛:路由器电信、网通双线路智能切换配置指导