NAT实验
一、静态NAT:
1、把R3、R4、R5当作PC机,关闭路由,配置网关
2、在R1和R2上开Rip v2,关闭自动汇总
3、在R2上配置NAT:
ip nat inside source static 192.168.1.2 110.1.1.3
ip nat inside source static 192.168.1.3 110.1.1.4
ip nat inside source static 192.168.1.4 110.1.1.5
4、在R2上配置NAT的内部和外部端口:
inter e0
ip nat instde
inter s0
ip nat outside
5、分别在R3、R4、R5上ping 220.2.2.2
6、在R2上查看
Show ip nat translation
二、动态NAT
1、在R2上配置NAT的内部局部地址池:
access-list 1 permit 192.168.1.0 0.0.0.255
2、在R2上配置NAT的内部全局地址池:
ip nat pool test 110.1.1.10 110.1.1.11 netmask 255.255.255.0
3、在R2上配置转换:
ip nat inside source list 1 pool test
4、分别在R3、R4、R5上ping 220.2.2.2,可以发行只有R3、R4能够ping通,R5 ping不通,因为只有两个地址可用
5、在R2上查看
Show ip nat translation
三、端口复用:
1、在R2上配置NAT的内部局部地址池:
access-list 1 permit 192.168.1.0 0.0.0.255
2、在R2上配置PAT,不需要配置内部全局地址池,直接转换:
ip nat inside source list 1 inter s0 overload
3、分别在R3、R4、R5上ping 220.2.2.2,都能ping通
4、在R2上查看,可发现多了端口号
四、TCP负载均衡:
1、在R2上用ACL定义虚拟IP地址:
access-list 1 permit host 192.168.1.10
2、在R2上定义真实主机地址池:
ip nat pool test2 192.168.1.2 192.168.1.4 netmask 255.255.255.0 type rotary
3、在R2上配置转换:
ip nat inside destination list 1 pool test2
(注意:是转换内部的目的地址)
4、分别在R3、R4、R5上配置Telnet:
enable secret xxx
line vty 0 15
login
password xxx
5、在R1上telnet 192.168.1.10,三次
五、地址交叉:
1、搭建一台DNS服务器
2、在R2上配置NAT的内部局部地址池:(内部主机和外部主机用的是相同网段地址)
access-list 1 permit 192.168.1.0 0.0.0.255
3、在R2上定义内部全局地址池:
ip nat pool neibu 110.1.1.10 110.1.1.11 netmask 255.255.255.0
在R2上定义外部局部地址池:
ip nat pool waibu 120.1.1.10 120.1.1.11 netmask 255.255.255.0
a) 在R2上配置转换:
4、把内部局部地址转换成内部全局地址
ip nat inside source list 1 pool neibu
把外部全局地址转换成外部局部地址
ip nat outside source list 1 pool waibu
六、NAT端口映射:
ip nat inside source static tcp /udp 内部IP 端口号 外部IP 端口号