作者:jcelsius
51cto博客原创
实验拓扑:
IP地址表:
设备 | 接口 | IP地址 | 对端设备 | 对端接口 | 对端IP地址 | 备注 |
R1 | E0/0 | 12.1.1.10/24 | R2 | E0/0 | 12.1.1.1/24 |
|
R2 | E0/1 | 23.1.1.1/30 | R3 | E0/1 | 23.1.1.2/30 |
|
R2 | E0/2 | 24.1.1.1/30 | R4 | E0/1 | 24.1.1.2/30 |
|
R3 | E0/0 | 123.1.1.3/24 | SW1 | Port1 | / |
|
R4 | E0/0 | 123.1.1.4/24 | SW1 | Port2 | / |
|
R5 | E0/0 | 123.1.1.5/24 | SW1 | Port3 | / |
|
R5 | Loop0 | 5.5.5.5/32 | / | / | / | 回环地址 |
实验需求:
1. R1为模拟PC,R2为出口路由器,R3、R4、R5为Internet公网
2. 从R1 ping 5.5.5.5时,数据包路径为R1 => R2 (NAT转换) => R3 => R5
3. 从R1 ping 123.1.1.5时,数据包路径为 R1 => R2 (NAT转换) => R4 => R5
4. R2、R3、R4、R5之间不准运行动态路由协议(只在每个设备添加最优静态路由)
实验说明:
本次实验目的在于模拟双出口网络通信,越来越多的企业采用电信、联通双线路出口。
要求目标为联通地址时通过联通出口,电信地址通过电信出口。
实验采取模拟地址形式进行。
技术声明:
本次实验所使用的技术主要包括:静态路由、地址转换、访问列表、路由策略。
主要参数:
R1模拟PC配置:
- !
- no ip routing
- !
- !
- interface Ethernet0/0
- ip address 12.1.1.10 255.255.255.0
- !
- ip default-gateway 12.1.1.1
- !
R2配置:(关键配置点)
- !
- interface Ethernet0/0
- ip address 12.1.1.1 255.255.255.0
- ip nat inside
- !
- interface Ethernet0/1
- ip address 23.1.1.1 255.255.255.252
- ip nat outside
- !
- interface Ethernet0/2
- ip address 24.1.1.1 255.255.255.252
- ip nat outside
- !
- ip route 0.0.0.0 0.0.0.0 23.1.1.2
- ip route 0.0.0.0 0.0.0.0 24.1.1.2
- !
- ip nat translation timeout 1
- ip nat inside source route-map nat23 interface Ethernet0/1 overload
- ip nat inside source route-map nat24 interface Ethernet0/2 overload
- !
- access-list 123 permit ip any host 5.5.5.5
- access-list 124 permit ip any 123.1.1.0 0.0.0.255
- !
- route-map nat23 permit 10
- match ip address 123
- set default interface Ethernet0/1
- !
- route-map nat24 permit 10
- match ip address 124
- set default interface Ethernet0/2
- !
- !
R3配置:
- !
- !
- interface Ethernet0/0
- ip address 123.1.1.3 255.255.255.0
- half-duplex
- !
- interface Ethernet0/1
- ip address 23.1.1.2 255.255.255.252
- half-duplex
- !
- ip route 5.5.5.5 255.255.255.255 123.1.1.5
- ip route 24.1.1.0 255.255.255.252 123.1.1.4
- !
R4配置:
- !
- interface Ethernet0/0
- ip address 123.1.1.4 255.255.255.0
- half-duplex
- !
- interface Ethernet0/1
- ip address 24.1.1.2 255.255.255.252
- half-duplex
- !
- ip route 5.5.5.5 255.255.255.255 123.1.1.5
- ip route 23.1.1.0 255.255.255.252 123.1.1.3
- !
R5配置:
- !
- interface Loopback0
- ip address 5.5.5.5 255.255.255.255
- !
- interface Ethernet0/0
- ip address 123.1.1.5 255.255.255.0
- half-duplex
- !
- ip route 23.1.1.0 255.255.255.252 123.1.1.3
- ip route 24.1.1.0 255.255.255.252 123.1.1.4
- !
测试结果:
R1(PC) ping 5.5.5.5测试
在R2查看NAT转换:
分段测试R1(PC) ping 5.5.5.5
继续查看R2转换表
转换地址为23.1.1.1,符合R2 =>R3,并且没有发现出口IP漂移,测试成功。
R1(PC) ping 123.1.1.5测试
在R2查看转换表
分段测试R1(PC) ping 123.1.1.5
查看R2转换表:
同样转换地址为24.1.1.1,符合R2 =>R4,并且没有发现出口IP漂移,测试成功。
分别ping 5.5.5.5 和 123.1.1.5
查看R2转换表:
发现目标为5.5.5.5时通过R2 => R3的E0/1接口IP地址
目标为123.1.1.5时通过R2 => R4的E0/2接口IP地址
本文提供配置文件附件,供学习参考使用。转载请注明出处,谢谢合作!
目标完成,实验结束
转载于:https://blog.51cto.com/777676/937375