IANA
(The Internet Assigned Numbers Authority
,互联网数字分配机构)向超大型企业/组织分配A
类网络地址,一次一段。向中型企业或教育机构分配B
类网络地址,一次一段。这样一种分配策略使得IP
地址浪费很严重,不少被分配出去的地址没有真实被利用,地址消耗很快。以致于二十世纪90
年代初,网络专家们意识到,这样大手大脚下去,IPv4
地址很快就要耗光了。因而,人们开始考虑IPv4
的替代方案,同时采起一系列的措施来减缓IPv4
地址的消耗。正是在这样一个背景之下,本期的主角闪亮登场,它就是网络地址转换——NAT
。安全
NAT
(Network Address Translation
,网络地址转换),就是替换IP
报文头部的地址信息。NAT
一般部署在一个组织的网络出口位置,经过将内部网络IP地址替换为出口的IP
地址提供公网可达性和上层协议的链接能力。网络
Static Translation
)Dynamic Translation
)Port Address Translation, PAT
)Router(config)#ip nat pool pool-name star-ip end-ip {netmask netmask | prefix-length prefix-length} [type rotary]
Router(config)#ip nat inside source static local-ip [extendable] Router(config)#ip nat inside source list access-list-number pool pool-name [overload]
Router(config)#interface FastEthernet 0/0 Router(config-if)#ip address 61.159.62.130 255.255.255.248 Router(config-if)#no shut
Router(config)#interface FastEthernet 1/0 Router(config-if)#ip address 192.168.100.1 255.255.255.0 Router(config-if)#no shut
Router(config)#ip nat inside source static 192.168.100.2 61.159.62.130 Router(config)#ip nat inside source static 192.168.100.3 61.159.62.131
Router(config )#interface FastEthernet 0/0 Router(config-if)#ip nat outside Router(config)#interface FastEthernet 1/0 Router(config-if)#ip nat inside
Router(config)#ip route 0.0.0.0 0.0.0.0 61.159.62.129
Router(config)#ip nat inside source static protocol local-ip UDP/TCP-port global-ip UDP/TCP-port [extendable]
Router(config)#ip nat inside source static tcp 192.168.100.2 80 61.159.62.131 8080 extendable
Router(config)#interface FastEthernet 0/0 Router(config-if)#ip address 61.159.62.130 255.255.255.192 Router(config-if)#no shut
Router(config)#interface FastEthernet 1/0 Router(config-if)#ip address 192.168.100.1 255.255.255.0 Router(config-if)#no shut
Router(config)#access-list 1 permit 192.168.100.0 0.0.0.255 //此处子网掩码反写
Router(config)#ip nat poo[test061.159.62.131 61.159.62.190 netmask 255.255.255.192 //正常书写掩码
Router(config)#ip nat inside source list 1 pool test0
Router(config)#interface FastEthernet 0/0 Router(config-if)#ip address 61.159.62.130 255.255.255.192 Router(config-if)#no shu
Router(config)#interface FastEthernet 1/0 Router(config-if)#ip address 10.1.1.1 255.255.255.0 Router(config-if)#no shu
Router(config)#access-list 1 permit 10.1.1.0 0.0.0.255
Router(config)#ip nat pool onlyone 61.159.62.131 61.159.62.131 netmask 255.255.255.248
Router(config )#ip nat inside source list 1 pool onlyone overload //进行端口复用
Router(config)#access-list 1 permit 10.1.1.0 0.0.0.255
定义合法的IP地址池tcp
Router(config)#ip nat inside source list 1 interface FastEthernet 0/0 overload