静态NAT
静态 NAT ( Static NAT )( 一对一 )。将内部网络的私有IP地址转换为公有IP地址,IP地址对是一对一的,是一直不变的。
实验拓扑:
PC配置
AR1
sys Entersystemview,returnuserviewwithCtrl+Z. [Huawei] [Huawei]uninen Info:Informationcenterisdisabled. [Huawei] [Huawei]sysAR1 [AR1] [AR1]intg0/0/0 [AR1-GigabitEthernet0/0/0] [AR1-GigabitEthernet0/0/0]ipadd192.168.1.224 [AR1-GigabitEthernet0/0/0] [AR1-GigabitEthernet0/0/0]q [AR1] [AR1]intg0/0/1 [AR1-GigabitEthernet0/0/1] [AR1-GigabitEthernet0/0/1]ipadd192.168.2.224 [AR1-GigabitEthernet0/0/1] [AR1-GigabitEthernet0/0/1]q [AR1] [AR1]intg0/0/2 [AR1-GigabitEthernet0/0/2] [AR1-GigabitEthernet0/0/2]ipadd192.168.3.224 [AR1-GigabitEthernet0/0/2] [AR1-GigabitEthernet0/0/2]q [AR1] [AR1]intg4/0/0 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]ipadd100.100.100.124 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]q [AR1] [AR1]intg4/0/0 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]natstaticglobal100.100.100.3inside192.168.1.1net mask255.255.255.255 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]natstaticglobal100.100.100.4inside192.168.2.1net mask255.255.255.255 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]natstaticglobal100.100.100.5inside192.168.3.1net mask255.255.255.255 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]q [AR1]iproute-s [AR1]iproute-static0.0.0.00100.100.100.2 [AR1]
AR2
sys Entersystemview,returnuserviewwithCtrl+Z. [Huawei] [Huawei]uninen Info:Informationcenterisdisabled. [Huawei] [Huawei]sysAR2 [AR2] [AR2]intg0/0/0 [AR2-GigabitEthernet0/0/0] [AR2-GigabitEthernet0/0/0]ipadd100.100.100.224 [AR2-GigabitEthernet0/0/0] [AR2-GigabitEthernet0/0/0]q [AR2] [AR2]intg0/0/1 [AR2-GigabitEthernet0/0/1] [AR2-GigabitEthernet0/0/1]ipadd200.200.200.230 [AR2-GigabitEthernet0/0/1] [AR2-GigabitEthernet0/0/1]q [AR2]
实验结果:
动态NAT
动态地址 NAT ( Pooled NAT )(多对多)。将内部网络的私有 IP 地址转换为公用 IP 地址时,IP 地址是不确定,随机的。所有被授权访问 Internet 的私有 IP 地址可随机转换为任何指定合法的 IP 地址。也就是说,只要指定哪些内部地址可以进行转换,以及用哪些合法地址作为外部地址时,就可以进行动态 NAT 转换。动态 NAT 是在路由器上配置一个外网 IP 地址池,当内部有计算机需要和外部通信时,就从地址池里动态的取出一个外网 IP,并将他们的对应关系绑定到 NAT 表中,通信结束后,这个外网 IP 才被释放,可供其他内部 IP 地址转换使用,这个 DHCP 租约 IP 有相似之处。当 ISP 提供的合法 IP 地址略少于网络内部的计算机数量时。可以采用动态转换的方式。
PC配置同静态相同
ISP也无变化
AR1
sys Entersystemview,returnuserviewwithCtrl+Z. [Huawei] [Huawei]uninen Info:Informationcenterisdisabled. [Huawei] [Huawei]sysAR1 [AR1] [AR1]intg0/0/0 [AR1-GigabitEthernet0/0/0] [AR1-GigabitEthernet0/0/0]ipadd192.168.1.224 [AR1-GigabitEthernet0/0/0] [AR1-GigabitEthernet0/0/0]q [AR1] [AR1]intg0/0/1 [AR1-GigabitEthernet0/0/1] [AR1-GigabitEthernet0/0/1]ipadd192.168.2.224 [AR1-GigabitEthernet0/0/1] [AR1-GigabitEthernet0/0/1]q [AR1] [AR1]intg0/0/2 [AR1-GigabitEthernet0/0/2] [AR1-GigabitEthernet0/0/2]ipadd192.168.3.224 [AR1-GigabitEthernet0/0/2] [AR1-GigabitEthernet0/0/2]q [AR1] [AR1]intg4/0/0 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]ipadd100.100.100.124 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]q [AR1] [AR1]nataddress-group1100.100.100.3100.100.100.254 [AR1] [AR1]acl2000 [AR1-acl-basic-2000] [AR1-acl-basic-2000]rule5permitsource192.168.0.00.0.255.255 [AR1-acl-basic-2000] [AR1-acl-basic-2000]q [AR1] [AR1]intg4/0/0 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]natoutbound2000address-group1no-pat [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]q [AR1] [AR1]iproute-static0.0.0.00100.100.100.2 [AR1]
实验结果:
NAPT
由于 NAT 实现是私有 IP 和 NAT 的公共 IP 之间的转换,那么,私有网中同时与公共网进行通信的主机数量就受到 NAT 的公共 IP 地址数量的限制。为了克服这种限制,NAT 被进一步扩展到在进行 IP 地址转换的同时进行 Port 的转换,这就是网络地址端口转换 NAPT(Network Address Port Translation)技术。
NAPT 与 NAT 的区别在于,NAPT 不仅转换 IP 包中的 IP 地址,还对 IP 包中 TCP 和 UDP 的 Port 进行转换。这使得多台私有网主机利用 1 个 NAT 公共 IP 就可以同时和公共网进行通信。
实验拓扑:
PC,ISP,SEVER 1 配置依旧同上
只改变出口设备配置
AR1(出口设备)
[Huawei]sysAR1 [AR1] [AR1]intg0/0/0 [AR1-GigabitEthernet0/0/0] [AR1-GigabitEthernet0/0/0]ipadd192.168.1.224 [AR1-GigabitEthernet0/0/0] [AR1-GigabitEthernet0/0/0]q [AR1] [AR1]intg0/0/1 [AR1-GigabitEthernet0/0/1] [AR1-GigabitEthernet0/0/1]ipadd192.168.2.224 [AR1-GigabitEthernet0/0/1] [AR1-GigabitEthernet0/0/1]q [AR1] [AR1]intg0/0/2 [AR1-GigabitEthernet0/0/2] [AR1-GigabitEthernet0/0/2]ipadd192.168.3.224 [AR1-GigabitEthernet0/0/2] [AR1-GigabitEthernet0/0/2]q [AR1] [AR1]intg4/0/0 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]ipadd100.100.100.124 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]q [AR1] [AR1]nataddress-group1100.100.100.3100.100.100.3 [AR1] [AR1]acl2000 [AR1-acl-basic-2000] [AR1-acl-basic-2000]rule5permitsource192.168.0.00.0.255.255 [AR1-acl-basic-2000] [AR1-acl-basic-2000]q [AR1] [AR1]intg4/0/0 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]natoutbound2000address-group1 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]q [AR1] [AR1]iproute-static0.0.0.00100.100.100.2 [AR1] [AR1]q
Easy ip:
Easy-ip是NAPT的一种特例是单向转换的,配置时候不需要创建公网地址池。NAPT是实现私有IP和NAT的公共IP之间的动态转换。Easy-ip是实现公网IP 地址实现与私网IP 地址之间的映射。适合小型局域网接入Internet的情况,比如小型网吧,中小型企业。出接口通过拨号方式获得临时(或固定)公网IP 地址以供内部主机访问Internet。
拓扑图
其他配置依旧同上,只更改出口设备命令:
AR1(出口设备)
sys Entersystemview,returnuserviewwithCtrl+Z. [Huawei] [Huawei]uninen Info:Informationcenterisdisabled. [Huawei] [Huawei]sysAR1 [AR1] [AR1]intg0/0/0 [AR1-GigabitEthernet0/0/0] [AR1-GigabitEthernet0/0/0]ipadd192.168.1.224 [AR1-GigabitEthernet0/0/0] [AR1-GigabitEthernet0/0/0]q [AR1] [AR1]intg0/0/1 [AR1-GigabitEthernet0/0/1] [AR1-GigabitEthernet0/0/1]ipadd192.168.2.224 [AR1-GigabitEthernet0/0/1] [AR1-GigabitEthernet0/0/1]q [AR1] [AR1]intg0/0/2 [AR1-GigabitEthernet0/0/2] [AR1-GigabitEthernet0/0/2]ipadd192.168.3.224 [AR1-GigabitEthernet0/0/2] [AR1-GigabitEthernet0/0/2]q [AR1] [AR1]intg4/0/0 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]ipadd100.100.100.124 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]q [AR1] [AR1]iproute-static0.0.0.00100.100.100.2 [AR1] [AR1]acl2000 [AR1-acl-basic-2000] [AR1-acl-basic-2000]rule5permitsource192.168.0.00.0.255.255 [AR1-acl-basic-2000] [AR1-acl-basic-2000]q [AR1] [AR1]intg4/0/0 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]natoutbound2000 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]q [AR1]
NAT server配置实验:
功能是使用一个公网地址来代表内部服务器对外地址。
拓扑图
外网用户配置:
server 2内网web配置:
路由器配置:
AR1(出口设备)
sys Entersystemview,returnuserviewwithCtrl+Z. [Huawei] [Huawei]uninen Info:Informationcenterisdisabled. [Huawei] [Huawei]sysAR1 [AR1] [AR1]intg0/0/0 [AR1-GigabitEthernet0/0/0] [AR1-GigabitEthernet0/0/0]ipadd192.168.1.224 [AR1-GigabitEthernet0/0/0] [AR1-GigabitEthernet0/0/0]q [AR1] [AR1]intg4/0/0 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]ipadd100.100.100.124 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]q [AR1] [AR1]iproute-static0.0.0.00100.100.100.2 [AR1] [AR1]acl2000 [AR1-acl-basic-2000] [AR1-acl-basic-2000]rule5permitsource192.168.1.00.0.0.255 [AR1-acl-basic-2000] [AR1-acl-basic-2000]intg4/0/0 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]natoutbound2000 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]q [AR1] [AR1]intg4/0/0 [AR1-GigabitEthernet4/0/0] [AR1-GigabitEthernet4/0/0]natserverprotocoltcpglobal100.100.100.380inside 192.168.1.180 [AR1-GigabitEthernet4/0/0]
AR2(ISP)
sys Entersystemview,returnuserviewwithCtrl+Z. [Huawei] [Huawei]uninen Info:Informationcenterisdisabled. [Huawei] [Huawei]sysAR2 [AR2] [AR2]intg0/0/0 [AR2-GigabitEthernet0/0/0] [AR2-GigabitEthernet0/0/0]ipadd100.100.100.224 [AR2-GigabitEthernet0/0/0] [AR2-GigabitEthernet0/0/0]q [AR2] [AR2]intg0/0/1 [AR2-GigabitEthernet0/0/1] [AR2-GigabitEthernet0/0/1]ipadd200.200.200.224 [AR2-GigabitEthernet0/0/1] [AR2-GigabitEthernet0/0/1]q [AR2]
实验结果:
审核编辑:黄飞
-
DHCP
+关注
关注
0文章
103浏览量
19669 -
NAT
+关注
关注
0文章
141浏览量
16220 -
ip地址
+关注
关注
0文章
294浏览量
17003 -
NAPT
+关注
关注
0文章
2浏览量
5275
原文标题:NAT--静态、动态、NAPT、Easy-ip、NAT server
文章出处:【微信号:网络技术干货圈,微信公众号:网络技术干货圈】欢迎添加关注!文章转载请注明出处。
发布评论请先 登录
相关推荐
评论