2、动态NAT配置
命令:
ip nat pool pool-name start-ip end-ip { netmask netmask | prefix-length prefix-length }[type rotary]
ip nat inside source list access-list-number pool pool-name
注释:pool-name: 地址集的名称;start-ip:地址集的起始IP;end-ip:地址集的终止IP;netmask:网络掩码;prefix-length:网络位的长度;type rotary:用于表明地址集中的地址是真实的内部主机地址,地址转换时将循环使用地址集中的地址,用于TCP负载均衡。
实例:
access-list 1 permit 10.1.1.0 0.0.0.255
ip nat pool dyn-nat 192.168.2.1 192.168.2.254 netmask 255.255.255.0
ip nat inside source list 1 pool dyn-nat
interface Ethernet 0
ip address 10.1.1.10 255.255.255.0
ip nat inside
interface Serial 0
ip address 172.16.2.1 255.255.255.0
ip nat outside
功效:通过接口Ethernet0发往外部网络的数据流,在经过Serial0接口时,如果源地址在网络10.1.1.0内,源地址将被动态转换为192.168.2.0网络内的任意一个IP地址。