1 / 23

第十五章 网络地址转换

第十五章 网络地址转换. 本章目标. 通过本章学习,您应该掌握以下内容: 掌握网络地址转换( NAT )和端口地址转换( PAT )的相关概念。 掌握静态 NAT 、动态 NAT 、 PAT 的配置。. 网络地址转换的应用背景. 随着因特网的飞速发展,上网主机的数量日益膨胀, IPv4 地址空间即将被耗尽。 一种长期的解决方案: IPv6 ,具有 128 比特的寻址空间。目前,尚未得到大规模应用。 两种短期方案的成功,缓解了 IPv4 地址即将耗尽的压力。 - RFC1918 (私有 IP 寻址) - RFC1631 (网络地址转换). 私有地址寻址.

minnie
Télécharger la présentation

第十五章 网络地址转换

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第十五章网络地址转换

  2. 本章目标 • 通过本章学习,您应该掌握以下内容: • 掌握网络地址转换(NAT)和端口地址转换(PAT)的相关概念。 • 掌握静态NAT、动态NAT、PAT的配置。

  3. 网络地址转换的应用背景 • 随着因特网的飞速发展,上网主机的数量日益膨胀,IPv4地址空间即将被耗尽。 • 一种长期的解决方案:IPv6,具有128 比特的寻址空间。目前,尚未得到大规模应用。 • 两种短期方案的成功,缓解了IPv4地址即将耗尽的压力。 • -RFC1918(私有IP寻址) • -RFC1631(网络地址转换)

  4. 私有地址寻址 • RFC1918私有地址 • A类:10.0.0.0~10.255.255.255 • B类:17.16.0.0~172.31.255.255 • C类:192.168.0.0~192.168.255.255 • 通常用于内网设备的私有IP(内部本地IP地址),不能直接用于与公共网络通信,如因特网。

  5. 网络地址转换 • 网络地址转换(NAT)能够解决内部本地IP地址不能与公共网络通信的问题。 • 其具体的做法是把IP包中内部本地IP地址用互联网上公开注册的IP地址(内部全局IP地址)来替换。 NAT 内部全局IP地址 内部本地IP地址

  6. NAT术语 • 内部本地IP地址:分配给内部网络设备的IP地址,通常是一个由RFC1918定义的私有IP地址。 • 内部全局IP地址:在互联网上公开注册的合法IP地址,用以代替内部本地IP地址。 • 静态:在两个地址之间手工执行地址转换,可能包括端口号。如静态PAT。 • 动态:一个地址转换设备在两个地址之间自动执行地址转换,可能包括端口号。

  7. 地址转换类型 • 网络地址转换(NAT):只转换IP(不包含端口号),“一对一”映射。 • -静态NAT:转换表手工建立 • -动态NAT:转换表动态生成 • 端口地址转换(PAT):把多个内部本地IP转换为单个或少量几个全局IP,这种“多对一”的映射,端口号来确定转换的唯一性。

  8. 网络地址转换 静态NAT:手工进行“一对一”转换。 动态NAT:将内部IP地址和预先设定的全局IP地址池中未使用的一个地址进行“一对一”转换。

  9. 网络地址转换过程

  10. 端口地址转换

  11. 端口地址转换过程

  12. 静态NAT配置命令 Router(config)#ip nat inside source static local-ipglobal-ip • Establishes static translation between an inside local address and an inside global address Router(config-if)#ip nat inside • Marks the interface as connected to the inside Router(config-if)#ip nat outside • Marks the interface as connected to the outside

  13. 静态NAT配置实例

  14. 动态NAT配置命令 Router(config)#ip nat pool namestart-ip end-ip{netmask netmask | prefix-length prefix-length} • Defines a pool of global addresses to be allocated as needed Router(config)#access-list access-list-number permit source [source-wildcard] • Defines a standard IP access list permitting those inside local addresses that are to be translated Router(config)#ip nat inside source list access-list-number pool name • Establishes dynamic source translation, specifying the access list defined in the prior step

  15. 动态NAT配置实例

  16. PAT配置命令 Router(config)#access-list access-list-number permit sourcesource-wildcard • Defines a standard IP access list permitting those inside local addresses that are to be translated Router(config)#ip nat inside source list access-list-number interface interface overload • Establishes dynamic source translation, specifying the access list defined in the prior step

  17. PAT配置实例

  18. 清除NAT转换表 Router#clear ip nat translation * • Clears all dynamic address translation entries Router#clear ip nat translation inside global-ip local-ip • Clears a simple dynamic translation entry containing an inside translation Router#clear ip nat translation outside local-ip global-ip • Clears a simple dynamic translation entry containing an outside translation Router#clear ip nat translation protocol inside global-ip global-port local-ip local-port • Clears an extended dynamic translation entry

  19. 查看NAT相关信息 Router#show ip nat translations • Displays active translations Router#show ip nat translation Pro Inside global Inside local Outside local Outside global --- 172.16.131.1 10.10.10.1 --- --- Router#show ip nat statistics • Displays translation statistics Router#show ip nat statistics Total active translations: 1 (1 static, 0 dynamic; 0 extended) Outside interfaces: Ethernet0, Serial2.7 Inside interfaces: Ethernet1Hits: 5 Misses: 0 …

  20. 不能ping通远程主机

  21. 重新配置

  22. 使用debug ip nat命令 Router#debug ip nat NAT: s=192.168.1.95->172.31.233.209, d=172.31.2.132 [6825] NAT: s=172.31.2.132, d=172.31.233.209->192.168.1.95 [21852] NAT: s=192.168.1.95->172.31.233.209, d=172.31.1.161 [6826] NAT*: s=172.31.1.161, d=172.31.233.209->192.168.1.95 [23311] NAT*: s=192.168.1.95->172.31.233.209, d=172.31.1.161 [6827] NAT*: s=192.168.1.95->172.31.233.209, d=172.31.1.161 [6828] NAT*: s=172.31.1.161, d=172.31.233.209->192.168.1.95 [23313] NAT*: s=172.31.1.161, d=172.31.233.209->192.168.1.95 [23325] debug ip nat用于实时显示路由器执行地址转换的情况。

  23. 地址转换的应用 • 1、内部私有IP主机访问Internet,PAT方式。 • 2、外部访问内网服务器,静态NAT或静态PAT。 静态NAT inside_local_ip inside_global_ip ip nat inside source static <local_ip> <global_ip> 静态PAT inside_local_ip +port_number inside_global_ip +port_number ip nat inside source static { tcp|udp } <local_ip> <local_port> <global_ip> <global_port>

More Related