CISCO的nat转换配置

拓扑图

 

静态nat转换

 

Router(config-if)#ip address 192.168.100.254 255.255.255.0
Router(config-if)#no shutdown 
Router(config-if)#exit

Router(config-if)#ip address 61.159.62.1 255.255.255.0
Router(config-if)#no shutdown 
Router(config-if)#exit

Router(config)#ip nat inside source static 192.168.100.1 61.159.62.130
Router(config)#ip nat inside source static 192.168.100.2 61.159.62.131
 
Router(config)#int e0/0
Router(config-if)#ip nat inside 

Router(config)#int e0/1
Router(config-if)#ip nat outside 
Router(config-if)#do show ip nat tran
Pro Inside global      Inside local       Outside local      Outside global
--- 61.159.62.130      192.168.100.1      ---                ---
--- 61.159.62.131      192.168.100.2      ---                --

 

 

动态NAT转换

Router(config)#int e0/0
Router(config-if)#ip address 192.168.100.254 255.255.255.0
Router(config-if)#no shutdown 

Router(config-if)#int e0/1
Router(config-if)#ip address 61.159.62.1 255.255.255.0
Router(config-if)#no shutdown 
Router(config-if)#exit 

Router(config)#access-list 1 permit 192.168.100.0 0.0.0.255 
Router(config)#ip nat pool test 61.159.62.130 61.159.62.190 netmask 255.255.255.0
Router(config)#ip nat inside source list 1 pool test
 
Router(config)#int e0/0
Router(config-if)#ip nat inside 
Router(config-if)#exi
Router(config)#int e0/1
Router(config-if)#ip nat outside

 

PAT转换

Router(config)#access-list 1 permit 192.168.100.0 0.0.0.255 
[
Router(config)#ip nat pool test
61.159.62.130 61.159.62.130 netmask 255.255.255.0 Router(config)#ip nat inside source list 1 pool test overload
] 或 [
Router(config)#ip nat inside source list
1 interface ethernet 0/1 overload
] Router(config)#
int e0/0 Router(config-if)#ip nat inside Router(config-if)#exi Router(config)#int e0/1 Router(config-if)#ip nat outside

 

最终三种配置可以让内网访问外网,现在常用的配置为PAT配置

 

posted @ 2021-09-09 10:42  f1veseven  阅读(772)  评论(0编辑  收藏  举报