Static NAT
==============================================
Router(config-if)#ip address 10.1.1.1 255.255.255.0
Router(config-if)#interface fa 0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#exit
Router(config)#ip nat inside source static 192.168.1.2 10.1.1.1
Router(config)#interface fa 0/0
Router(config-if)#ip nat inside
Router(config-if)#interface fa 0/1
Router(config-if)#ip nat outside
Router#show ip nat translations
Pro Inside global Inside local Outside local Outside global
--- 10.1.1.1 192.168.1.2 --- ---
tcp 10.1.1.1:1026 192.168.1.2:1026 10.1.1.2:80 10.1.1.2:80
Dynamic Address Translation
=============================================
Router(config)#interface fa 0/0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
ip add
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#ip nat inside
Router(config-if)#exit
Router(config)#interface fa 0/1
Router(config-if)#ip address 10.1.1.1 255.255.255.0
Router(config-if)#ip nat outside
Router(config-if)#exit
Router(config)#access-list 1 permit 192.168.1.0 0.0.0.255
Router(config)#ip nat pool test 10.1.1.2 10.1.1.7 netmask 255.255.255.248
Router(config)#ip nat inside source list 1 pool test
Overloading an inside global address
=============================================
Router(Config)#interface fa 0/1
Router(config-if)#ip address 10.1.1.1 255.255.255.0
Router(config-if)#ip nat outside
Router(config)#interface fa 0/0
Router(config-if)#ip address 192.168.1.1 255.255.255.0
Router(config-if)#ip nat inside
Router(config)#access-list 1 permit 192.168.1.0 0.0.0.255
Router(config)#ip nat inside source list 1 interface fa 0/1 overload
**上面也可以先宣告Pool,也就是類似Dynamic Address Translation**
Router(Config)#ip nat pool test 10.1.1.1 10.1.1.1 netmask 255.255.255.0
Router(Config)#ip nat inside source list 1 pool test overload
Router#show ip nat translations
Pro Inside global Inside local Outside local Outside global
icmp 10.1.1.1:21 192.168.1.2:21 10.1.1.2:21 10.1.1.2:21
icmp 10.1.1.1:22 192.168.1.2:22 10.1.1.2:22 10.1.1.2:22
icmp 10.1.1.1:23 192.168.1.2:23 10.1.1.2:23 10.1.1.2:23
icmp 10.1.1.1:24 192.168.1.2:24 10.1.1.2:24 10.1.1.2:24
icmp 10.1.1.1:25 192.168.1.2:25 10.1.1.2:25 10.1.1.2:25
留言
張貼留言