NAT实验
 
1
2
5
4
3
S0  1.2
S0  1.1
E0  1.2
E0  1.3
E0  1.4
E0  1.1
192.168.1.0
110.1.1.0
Loopback 0
220.2.2.2
Loopback 1
192.168.1.5
一、静态NAT:
1、R3R4R5当作PC机,关闭路由,配置网关
2、R1R2上开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、分别在R3R4R5ping  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、分别在R3R4R5ping  220.2.2.2,可以发行只有R3R4能够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、分别在R3R4R5ping  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、分别在R3R4R5上配置Telnet
       enable  secret  xxx
       line  vty  0  15
       login
       password  xxx
5、R1telnet  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  端口号