作者:jcelsius

51cto博客原创

实验拓扑:

CISCO设备策略NAT实现双WAN分流_思科

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配置:

  1.  
  2. no ip routing 
  3.  
  4.  
  5.  
  6. interface Ethernet0/0 
  7.  
  8. ip address 12.1.1.10 255.255.255.0 
  9.  
  10.  
  11. ip default-gateway 12.1.1.1 
  12.  

 

R2配置:(关键配置点)

 

  1.  
  2. interface Ethernet0/0 
  3.  
  4. ip address 12.1.1.1 255.255.255.0 
  5.  
  6. ip nat inside 
  7.  
  8.  
  9. interface Ethernet0/1 
  10.  
  11. ip address 23.1.1.1 255.255.255.252 
  12.  
  13. ip nat outside 
  14.  
  15.  
  16. interface Ethernet0/2 
  17.  
  18. ip address 24.1.1.1 255.255.255.252 
  19.  
  20. ip nat outside 
  21.  
  22.  
  23. ip route 0.0.0.0 0.0.0.0 23.1.1.2 
  24.  
  25. ip route 0.0.0.0 0.0.0.0 24.1.1.2 
  26.  
  27.  
  28. ip nat translation timeout 1 
  29.  
  30. ip nat inside source route-map nat23 interface Ethernet0/1 overload 
  31.  
  32. ip nat inside source route-map nat24 interface Ethernet0/2 overload 
  33.  
  34.  
  35. access-list 123 permit ip any host 5.5.5.5 
  36.  
  37. access-list 124 permit ip any 123.1.1.0 0.0.0.255 
  38.  
  39.  
  40. route-map nat23 permit 10 
  41.  
  42. match ip address 123 
  43.  
  44. set default interface Ethernet0/1 
  45.  
  46.  
  47. route-map nat24 permit 10 
  48.  
  49. match ip address 124 
  50.  
  51. set default interface Ethernet0/2 
  52.  
  53.  

R3配置:

  1.  
  2.  
  3. interface Ethernet0/0 
  4.  
  5. ip address 123.1.1.3 255.255.255.0 
  6.  
  7. half-duplex 
  8.  
  9.  
  10. interface Ethernet0/1 
  11.  
  12. ip address 23.1.1.2 255.255.255.252 
  13.  
  14. half-duplex 
  15.  
  16.  
  17. ip route 5.5.5.5 255.255.255.255 123.1.1.5 
  18.  
  19. ip route 24.1.1.0 255.255.255.252 123.1.1.4 
  20.  

R4配置:

  1.  
  2. interface Ethernet0/0 
  3.  
  4. ip address 123.1.1.4 255.255.255.0 
  5.  
  6. half-duplex 
  7.  
  8.  
  9. interface Ethernet0/1 
  10.  
  11. ip address 24.1.1.2 255.255.255.252 
  12.  
  13. half-duplex 
  14.  
  15.  
  16. ip route 5.5.5.5 255.255.255.255 123.1.1.5 
  17.  
  18. ip route 23.1.1.0 255.255.255.252 123.1.1.3 
  19.  

R5配置:

  1.  
  2. interface Loopback0 
  3.  
  4. ip address 5.5.5.5 255.255.255.255 
  5.  
  6.  
  7. interface Ethernet0/0 
  8.  
  9. ip address 123.1.1.5 255.255.255.0 
  10.  
  11. half-duplex 
  12.  
  13.  
  14. ip route 23.1.1.0 255.255.255.252 123.1.1.3 
  15.  
  16. ip route 24.1.1.0 255.255.255.252 123.1.1.4 
  17.  

测试结果:

R1(PC) ping 5.5.5.5测试

CISCO设备策略NAT实现双WAN分流_cisco_02

在R2查看NAT转换:

CISCO设备策略NAT实现双WAN分流_cisco_03

分段测试R1(PC) ping 5.5.5.5

CISCO设备策略NAT实现双WAN分流_cisco_04

继续查看R2转换表

CISCO设备策略NAT实现双WAN分流_cisco_05

转换地址为23.1.1.1,符合R2 =>R3,并且没有发现出口IP漂移,测试成功。

R1(PC) ping 123.1.1.5测试

CISCO设备策略NAT实现双WAN分流_cisco_06

在R2查看转换表

CISCO设备策略NAT实现双WAN分流_cisco_07

分段测试R1(PC) ping 123.1.1.5

CISCO设备策略NAT实现双WAN分流_思科_08

查看R2转换表:

CISCO设备策略NAT实现双WAN分流_cisco_09

同样转换地址为24.1.1.1,符合R2 =>R4,并且没有发现出口IP漂移,测试成功。

分别ping 5.5.5.5 和 123.1.1.5

CISCO设备策略NAT实现双WAN分流_cisco_10

查看R2转换表:

CISCO设备策略NAT实现双WAN分流_cisco_11

发现目标为5.5.5.5时通过R2 => R3的E0/1接口IP地址

目标为123.1.1.5时通过R2 => R4的E0/2接口IP地址

本文提供配置文件附件,供学习参考使用。转载请注明出处,谢谢合作!

目标完成,实验结束