实验需求:
将内部地址192.168.100.0/24网段转换为外部地址12.0.0.10~12.0.0.100
动态NAT的地址转换,不须要手动进行指定,自动转换的都是区间范围内的地址
实验拓扑图
配置sw接口网络
输入如下命令:
conf t
no ip routing
int f1/0
speed 100
dup full
ex
配置路由器R1的接口
输入如下命令:
conf t
int f0/0
ip add 192.168.100.1 255.255.255.0
no shut
int f0/1
ip add 12.0.0.1 255.255.255.0
no shut
exide
动态NAT地址转换配置测试
输入如下命令:
access-list 1 permit 192.168.100.0 0.0.0.255 #内地转换地址池
ip nat pool test 12.0.0.10 12.0.0.100 netmask 255.255.255.0 #外部转换地址池
ip nat inside source list 1 pool test #引用地址池
int f0/0
ip nat inside
int f0/1
ip nat outside
end
debug ip natdebug
配置PC机IP地址
PC1> ip 192.168.100.10 192.168.100.1
PC2> ip 192.168.100.20 192.168.100.1
PC3> ip 12.0.0.12 12.0.0.13d
测试地址转换结果
PC1> ping 12.0.0.12blog
PC2> ping 12.0.0.12接口
实验需求:
将内部地址192.168.100.0/24网段转换为外部网络接口
实验拓扑图ip
配置sw接口路由
输入如下命令:
conf t
no ip routing
int f1/0
speed 100
dup full
exit
配置路由器R1的接口
输入如下命令:
conf t
int f0/0
ip add 192.168.100.1 255.255.255.0
no shut
int f0/1
ip add 12.0.0.1 255.255.255.0
no shut
ex
PAT地址转换配置
输入如下命令:
access-list 1 permit 192.168.100.0 0.0.0.255
ip nat inside source list 1 interface fastEthernet 0/1 overload
int f0/0
ip nat inside
int f0/1
ip nat outside
end
debug ip nat
配置PC机IP地址
PC1> ip 192.168.100.10 192.168.100.1
PC2> ip 192.168.100.20 192.168.100.1
PC3> ip 12.0.0.12 12.0.0.1
测试PAT配置结果
PC1> ping 12.0.0.12
PC2> ping 12.0.0.12
由实验结果可看出此时内部地址192.168.100.0/24网段均可以转换成外部网关地址12.0.0.1