网络地址转换配置命令(思科GNS3)

静态NAT:
int f0/0
ip nat inside
exit
int fa0/1
ip nat outside
exit
ip nat inside source static 192.168.10.10 8.8.8.8    //将192.168.10.10装换为8.8.8.8


no ip nat inside source static 192.168.10.10 8.8.8.8    //取消


动态NAT:

多个公网地址
ip nat pool test1 10.0.0.5 10.0.0.10 prefix-length 24   //建立地址池
ip nat pool test1 10.0.0.5 10.0.0.10 netmask 255.255.255.0

access-list 1 permit 192.168.10.0 0.0.0.255   //建立ACL列表

ip nat inside source list 1 pool test1  //允许列表1里面的主机可以去地址池里面拿公网地址。只能拿一次。 

ip nat inside source list 1 pool test1 overload
 //加overload可以反复拿。即当地址用完后,地址会返回到地址池可被再次使用


no ip nat inside source list 1 pool test1 overload   //取消,删除
no access-list 1  //取消,删除
no ip nat pool test1  //取消,删除


就一个公网地址:
ip nat pool test1 10.0.0.3 10.0.0.3 netmask 255.255.255.0

access-list 1 permit 192.168.10.0 0.0.0.255   //建立ACL列表

ip nat inside source list 1 pool test1 

扫描二维码关注公众号,回复: 2673262 查看本文章

动态PAT:基于端口的地址转换

ip nat inside source list 1 interface f0/1 overload

静态PAT:静态端口映射
ip nat inside source static tcp 192.168.10.100 23 interface f0/1 23
//将192.168.10.100的tcp的23端口映射到f0/1接口的23端口,即有人访问f0/1的ip地址的时候,那么访问到的就是192.168.10.100的23 端口
 

猜你喜欢

转载自blog.csdn.net/Evan_Sone/article/details/81334878