阳泉网站建设网站,互联网产品运营,免费咨询会计问题,wordpress慢网络地址转换NAT-动态NAT的使用范围和配置 什么是动态NAT#xff1f; 使用公有地址池#xff0c;并以先到先得的原则分配这些地址。当具有私有 IP 地址的主机请求访问 Internet 时#xff0c;动态 NAT 从地址池中选择一个未被其它主机占用的 IP 地址一对一的转化。当数据会话…网络地址转换NAT-动态NAT的使用范围和配置 什么是动态NAT 使用公有地址池并以先到先得的原则分配这些地址。当具有私有 IP 地址的主机请求访问 Internet 时动态 NAT 从地址池中选择一个未被其它主机占用的 IP 地址一对一的转化。当数据会话结束后路由器会释放掉公有IP地址回到地址池以提供其他内部私有IP地址的转换。当同一时刻地址池中地址被NAT转换完毕则其他私有地址不能够被NAT转换。
使用范围
一般是我们公司内网中有设备需要去访问我们公网我们就必须要做一个NAT地址转换把我们私网的IP地址转换成我们公网的IP地址这时就需要使用动态NAT了使用地址池中的公网地址进行IP地址转换去访问我们的公网下文是一个例子。 描述实验的要求
使用网络拓扑图给的地址网段配置各路由器PC机的IP地址和接口地址使用ospf路由协议使得全网互通除公网ISP使用PAT端口复用使得内网可以同时访问公网服务器
拓扑 分析难点以及完成的思路
优先配置各PC机和路由器的地址其次在路由器配置路由协议使得内网全网互通最后在边界路由器做动态NAT并且在边界路由器配置默认路由并下发给内网各路由器全部指向边界路由器注意动态NAT和PAT端口复用的区别端口复用配置命令的关键词overload还有进出口的选择我们做动态NAT不需要加overload。 配置命令
配置ISP、PC机和路由器的IP地址接口地址和网关地址。如果使用路由器代替PC或者server需要加上“no ip routing”在全局配置模式下。
PC1
PC1(config)#no ip routing
PC1(config-if)#interface Ethernet0/0
PC1(config-if)#ip address 192.168.1.1 255.255.255.0 PC1(config)#ip default-gateway 192.168.1.254 PC2
PC2(config)#no ip routing
PC2(config-if)#interface Ethernet0/0
PC2(config-if)#ip address 192.168.1.2 255.255.255.0 PC2(config)#ip default-gateway 192.168.1.254 PC3
PC3(config)#no ip routing
PC3(config-if)#interface Ethernet0/0
PC3(config-if)#ip address 192.168.3.1 255.255.255.0 PC3(config)#ip default-gateway 192.168.3.254 Sever
server(config)#no ip routing
server(config-if)#interface Ethernet0/0
server(config-if)#ip address 192.168.2.1 255.255.255.0 server(config)#ip default-gateway 192.168.2.254 ISP
ISP(config)#interface Serial2/0
ISP(config-if)#ip address 200.1.1.100 255.255.255.0 R1配置接口IP地址使用OSPF路由协议通告直连网段
R1(config-if)#interface Ethernet0/0
R1(config-if)#ip address 192.168.1.254 255.255.255.0 R1(config-if)#interface Ethernet0/1
R1(config-if)#ip address 10.1.1.1 255.255.255.0 R1(config)#router ospf 1
R1(config-router)#router-id 1.1.1.1
R1(config-router)#network 10.1.1.0 0.0.0.255 area 0
R1(config-router)#network 192.168.1.0 0.0.0.255 area 0 R2配置接口IP地址使用OSPF路由协议通告直连网段
R2(config-if)#interface Ethernet0/1
R2(config-if)#ip address 192.168.2.254 255.255.255.0 R2(config-if)#interface Ethernet0/0
R2(config-if)#ip address 10.1.1.2 255.255.255.0 R2(config-if)#interface Ethernet0/2
R2(config-if)#ip address 10.1.2.1 255.255.255.0 R2(config)#router ospf 1
R2(config-router)#router-id 2.2.2.2
R2(config-router)#network 10.1.1.0 0.0.0.255 area 0
R2(config-router)#network 10.1.2.0 0.0.0.255 area 0
R2(config-router)#network 192.168.2.0 0.0.0.255 area 0 R3配置接口IP地址使用OSPF路由协议通告直连网段
R3(config-if)#interface Ethernet0/1
R3(config-if)#ip address 192.168.3.254 255.255.255.0 R3(config-if)#interface Ethernet0/0
R3(config-if)#ip address 10.1.3.1 255.255.255.0 R3(config)#router ospf 1
R3(config-router)#router-id 3.3.3.3
R3(config-router)#network 10.1.3.0 0.0.0.255 area 0
R3(config-router)#network 192.168.3.0 0.0.0.255 area 0 R4配置接口IP地址使用OSPF路由协议通告直连网段
R4(config-if)#interface Ethernet0/0
R4(config-if)#ip address 10.1.2.2 255.255.255.0 R4(config-if)#interface Ethernet0/1
R4(config-if)#ip address 10.1.3.2 255.255.255.0 R4(config-if)#interface Serial2/0
R4(config-if)#ip address 200.1.1.2 255.255.255.0 R4(config)#router ospf 1
R4(config-router)#router-id 4.4.4.4
R4(config-router)#network 10.1.2.0 0.0.0.255 area 0
R4(config-router)#network 10.1.3.0 0.0.0.255 area 0
R4(config-router)#default-information originate ----------公网IP地址无法在内网中出现故下发一条默认路由为内网设
备提供到达公网IP地址的路径 使用拓扑给的唯一地址在边界路由器R4配置动态NAT划出一段地址池根据拓扑中给出的信息是从200.1.1.1到200.1.1.100是可以使用的地址作为我们的地址池进行绑定并给出可以上网的网段信息可以使用访问控制列表进行过滤。
R4(config)#ip nat pool zsl 200.1.1.10 200.1.1.12 netmask 255.255.255.0
R4(config)#ip nat inside source list 1 pool zsl
R4(config)#ip route 0.0.0.0 0.0.0.0 200.1.1.100
R4(config)#access-list 1 permit 192.168.0.0 0.0.255.255
我们在地址池中选取了三个有效地址但我们内网中有四台设备需要上网这时我们可以看一下动态NAT的缺点采取先到先得的方式进行地址分配所以我们这个实验可以看到至少有一台设备是无法ping通的。如果需要ping通那么必须要等待有一台设备将他的公网地址释放才可以让另一台设备使用所以动态NAT是非常浪费我们公网地址的接下来我们来测试一下这个实验。 PC1#ping 200.1.1.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.1.1.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max 4/210/1016 ms PC2#ping 200.1.1.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.1.1.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max 10/211/1016 ms Server#ping 200.1.1.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.1.1.100, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max 9/210/1014 ms PC3#ping 200.1.1.100
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 200.1.1.100, timeout is 2 seconds:
UUUUU
Success rate is 0 percent (0/5) 总结
不要把inside和outside应用的接口弄错。动态NAT映射表条目存在一定生存时间时间超过时转换条目将会被自动删除。一对一的动态NAT超时时间为10分钟600秒只有等待将使用后的地址释放之后才可以给别的设备进行使用这是动态NAT的一个机制。