策略路由是一种比基于目标网络进行路由更加灵活的数据包路由转发机制。应用了策略路由,路由器将通过路由图决定如何对需要路由的数据包进行处理,路由图决定了一个数据包的下一跳转发路由器。 下面让我们通过一个实验来看一下双出口配置是怎样的过程。
策略路由实验拓朴:
策略路由实验要求:
1、R1连接本地子网,R2为边缘策略路由器,R3模拟双ISP接入的Internet环境。
2、要求R1所连接的局域网部分流量走R2-R3间上条链路(ISP1链路),部分流量走R2-R3间下条链路(ISP2链路)从而实现基于源的供应商链路选择和网络负载均衡。
各路由器配置如下:
R1#sh run //路由器R1的配置
interface Loopback0 //模拟子网一:192.168.1.0/24
ip address 192.168.1.1 255.255.255.0 //模拟子网中***台主机
ip address 192.168.1.2 255.255.255.0 secondary //模拟子网中第二台主机
!
interface Loopback2 //模拟子网二:192.168.2.0/24
ip address 192.168.2.1 255.255.255.0
ip address 192.168.2.2 255.255.255.0 secondary
!
interface FastEthernet0/0
ip address 12.0.0.1 255.255.255.0
bitscn.com
!
!
router rip //通过RIP协议配置网络的连通性
version 2 bitscn.com
network 192.168.1.0
network 192.168.1.0
network 12.0.0.0
R3#sh run //路由器R3的配置
Building configuration
interface Loopback0 //模拟一个连接目标
description to internet
ip address 100.100.100.100 255.255.255.0
!
interface Serial1/1 //模拟ISP1的接入端口
ip address 123.0.0.3 255.255.255.0
serial restart-delay 0
!
interface Serial1/3 //模拟ISP2的接入端口
bitscn.com
ip address 223.0.0.3 255.255.255.0
serial restart-delay 0
!
router rip
version 2
network 100.0.0.0
network 123.0.0.0
network 223.0.0.0
no auto-summary
!
end
R2#sh run //策略路由器R2的配置
Building configuration...
interface FastEthernet0/0
ip address 12.0.0.2 255.255.255.0
ip policy route-map isp-test //在接口上启用策略路由isp-test进行流量控制
duplex half
!
interface Serial1/1
ip address 123.0.0.1 255.255.255.0
serial restart-delay 0
! bitscn_com
interface Serial1/3
ip address 223.0.0.1 255.255.255.0 bitscn.com
serial restart-delay 0
router rip
version 2
network 12.0.0.0
network 123.0.0.0
network 223.0.0.0
no auto-summary
logging alarm informational
access-list 101 permit ip 192.168.1.0 0.0.0.255 host 100.100.100.100 //访问控制列表101,用于过滤原地址,允许子网192.168.1.0流量通过 */
access-list 102 permit ip 192.168.2.0 0.0.0.255 host 100.100.100.100 //访问控制列表102,用于过滤原地址,允许子网192.168.2.0流量通过 */
!
route-map isp-test permit 10 //定义route-map,取名为isp-test,序列为10
match ip address 101 //检查源地址,匹配acl 101
set ip default next-hop 123.0.0.3 //指定下一跳地址
!
feedom.net
route-map isp-test permit 20 //定义isp-test的第二条语句,序列号为20
match ip address 102 //检查源地下,匹配acl102
set ip default next-hop 223.0.0.3
!
route-map isp-test permit 30 //定义isp-test的第三条语句,序列号为30
set default interface Null0 //丢弃不匹配规定标准的包
end
---------------------------------------------------------------------------------
- 1.
- 2.
- 3.
- 4.
- 5.
- 6.
- 7.
- 8.
- 9.
- 10.
- 11.
- 12.
- 13.
- 14.
- 15.
- 16.
- 17.
- 18.
- 19.
- 20.
- 21.
- 22.
- 23.
- 24.
- 25.
- 26.
- 27.
- 28.
- 29.
- 30.
- 31.
- 32.
- 33.
- 34.
- 35.
- 36.
- 37.
- 38.
- 39.
- 40.
- 41.
- 42.
- 43.
- 44.
- 45.
- 46.
- 47.
- 48.
- 49.
- 50.
- 51.
- 52.
- 53.
- 54.
- 55.
- 56.
- 57.
- 58.
- 59.
- 60.
- 61.
- 62.
- 63.
- 64.
- 65.
- 66.
- 67.
- 68.
- 69.
- 70.
- 71.
- 72.
- 73.
- 74.
- 75.
- 76.
- 77.
- 78.
- 79.
- 80.
- 81.
- 82.
- 83.
- 84.
- 85.
- 86.
- 87.
- 88.
- 89.
- 90.
- 91.
- 92.
- 93.
- 94.
- 95.
- 96.
- 97.
- 98.
- 99.
- 100.
- 101.
- 102.
- 103.
- 104.
- 105.
- 106.
- 107.
- 108.
- 109.
- 110.
- 111.
- 112.
- 113.
- 114.
- 115.
- 116.
- 117.
- 118.
- 119.
- 120.
- 121.
- 122.
- 123.
- 124.
- 125.
- 126.
- 127.
- 128.
- 129.
- 130.
- 131.
- 132.
- 133.
- 134.
- 135.
- 136.
- 137.
- 138.
- 139.
- 140.
- 141.
- 142.
- 143.
- 144.
- 145.
- 146.
- 147.
- 148.
- 149.
- 150.
- 151.
- 152.
- 153.
- 154.
- 155.
- 156.
- 157.
策略路由的内容不仅仅局限于以上介绍的内容,我们还会在以后的文章中继续向大家介绍。下一篇我们介绍:策略路由之双出口配置实例(2)
【编辑推荐】