实验:基于源地址的策略路由

简介:
在上一篇笔记中,我说过马上作策略路由的实验吧~
现在将这个实验留在51CTO的博客吧~
 
实验目的:
根据不同来源地址的流量,通过策略路由选择不同的出口:
在这个实验中,源地址为211.141.1.0/24的数据必须经由R2的F0/0流出,经过R3再到达VMware PC 192.168.2.1;
在这个实验中,源地址为172.16.1.0/24的数据必须经由R2的F0/1流出,进过R1再到达VMware PC 192.168.2.1。
 
实验的硬件设施:
路由器 3台 2600系列
交换机 1台 3640系列
桥接虚拟机 1台 VMware XP系统
VPC 2台 DynamipsGUI自带
 
实验拓扑图:
 
硬件器材的物理连接:
Router1 F0/0 <----> Router2 F0/1 
Router3 F0/0 <----> Router2 F0/0 
VPCS V0/1 <----> Router2 E1/0 
VPCS V0/2 <----> Router2 E1/1 
Router1 F0/1 <----> Switch1 F0/14 
Router3 F0/1 <----> Switch1 F0/15 
XPC P0/0 <----> Switch1 F0/0
 
路由器R1的配置信息:
R1# sh run
Building configuration...
Current configuration:
!
version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R1
!
!
memory-size iomem 15
ip subnet-zero
no ip domain-lookup
!
!
interface FastEthernet0/0
 ip address 172.17.1.1 255.255.255.0

 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 192.168.2.2 255.255.255.0

 speed 100
 full-duplex
!
router rip
 version 2
 network 172.17.0.0
 network 192.168.2.0
 no auto-summary

!
ip classless
no ip http server
!
!
line con 0
 exec-timeout 0 0
 logging synchronous
 transport input none
line aux 0
line vty 0 4
!
no scheduler allocate
end
路由器R2的主要配置(大家应该重点看看这里哦):
R2#sh run
Building configuration...
Current configuration:
!
version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R2
!
!
memory-size iomem 15
ip subnet-zero
no ip domain-lookup
!
!
interface FastEthernet0/0
 ip address 172.17.2.1 255.255.255.0

 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 172.17.1.2 255.255.255.0

 duplex auto
 speed auto
!
interface Ethernet1/0
 ip address 211.141.1.254 255.255.255.0
 ip policy route-map ISP_R3 
(将ROUTE-MAP应用在这个接口上,在该接口上检测源IP并将其从特定端口发送出去)
!
interface Ethernet1/1
 ip address 172.16.1.254 255.255.255.0
 ip policy route-map ISP_R1 
(将ROUTE-MAP应用在这个接口上,在该接口上检测源IP并将其从特定端口发送出去)
!
interface Ethernet1/2
 no ip address
 shutdown
!
interface Ethernet1/3
 no ip address
 shutdown 
!
router rip
 version 2
 network 172.16.0.0
 network 172.17.0.0
 network 211.141.1.0
 no auto-summary
!
ip classless
no ip http server
!
access-list 1 permit 211.141.1.0 0.0.0.255 (定义控制访问列表,在本实验中使用“标准”型,1-99)
access-list 2 permit 172.16.1.0 0.0.0.255
route-map ISP_R3 permit 10  
(定义路由映射表route-map,permit表示满足下列条件执行)
 
match ip address 1
 set interface FastEthernet0/0
!
route-map ISP_R1 permit 20
 match ip address 2
 set interface FastEthernet0/1
!
!
line con 0
 exec-timeout 0 0
 logging synchronous
 transport input none
line aux 0
line vty 0 4
!
no scheduler allocate
end
路由器R3的配置:
R3#sh run
Building configuration...
Current configuration:
!
version 12.1
service timestamps debug uptime
service timestamps log uptime
no service password-encryption
!
hostname R3
!
!
memory-size iomem 15
ip subnet-zero
no ip domain-lookup
!
!
interface FastEthernet0/0
 ip address 172.17.2.2 255.255.255.0
 duplex auto
 speed auto
!
interface FastEthernet0/1
 ip address 192.168.2.3 255.255.255.0
 speed 100
 full-duplex
!
router rip
 version 2
 network 172.17.0.0
 network 192.168.2.0
 no auto-summary

!
ip classless
no ip http server
!
!
line con 0
 exec-timeout 0 0
 logging synchronous
 transport input none
line aux 0
line vty 0 4
!
no scheduler allocate
end
 
模拟器自带VPC的配置信息:
 
桥接VMware虚拟机的配置信息:
 
实验结果检验:
1.在R2上看策略的配置情况,命令 sh ip policy
R2#sh ip policy 
Interface      Route map
Ethernet1/0    ISP_R3
Ethernet1/1    ISP_R1
2.对比使用策略前后,VPC1和VPC2使用命令tracert到桥接虚拟机192.168.2.1的所行路径状况:
 使用策略前:
 
 使用策略后:
 
实验后记:
在配置完ROUTE-MAP后,要在源接口处进行应用才能生效,命令ip policy route-map map-tag。
这个实验中使用VMware虚拟机的主要原因是我们的电脑的防火墙设的太安全了,使用虚拟机方便。如果把本地防火墙安全调低,让远端机可以ping通或tracert本地机就可以了。
关于VM-WARE虚拟机的设置大家可以在网上找找资料。不难的。




本文转自 tiger506 51CTO博客,原文链接:http://blog.51cto.com/tiger506/113803,如需转载请自行联系原作者

目录
相关文章
|
4月前
|
网络协议
地址重叠时,用户如何通过NAT访问对端IP网络?
地址重叠时,用户如何通过NAT访问对端IP网络?
|
10月前
|
缓存 网络协议 安全
【网络】IP地址和静态路由
【网络】IP地址和静态路由
100 0
|
网络协议 Shell 网络架构
|
网络协议 网络架构 运维
|
数据库 网络虚拟化 数据安全/隐私保护
|
网络安全 网络架构