1、静态NAT地址转换
#ip nat inside source static 192.168.12.1 192.168.23.4 //将12.1转为23.4 必须精确到主机IP 而不能是某个网段
#interface gigabitEthernet 0/0/0 //端口0做nat in
#ip nat inside
#interface gigabitEthernet 0/0/1 //端口1做nat out
#ip nat outside
#debug ip nat //开启natdebug
#show ip nat translation
2、动态NAT地址转换
#access-list 1 permit 192.168.3.0 0.0.0.255 //设置允许转换的ip段
#ip nat pool test 192.168.4.1 192.168.4.3 netmask 255.255.255.0 //设置NAT地址池 4.1是开始地址 4.3是结束地址
#ip nat inside source list 1 pool test //需转换的地址段与NAT地址池关联
#interface gigabitEthernet 0/0/0 //端口0做nat in
#ip nat inside
#interface gigabitEthernet 0/0/1 //端口1做nat out
#ip nat outside
做出上述配置后,当0/0/0端口有IP为192.168.3.X时,就会被转换为192.168.4.1至192.168.4.3中随机一个地址(从0/0/1出去后生效)