打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
神州数码路由器 网络地址翻译 NAT 配置

配置可以进行地址转换的地址范围
Router_config#ip access stand natacl
Router_config_std_nacl#per 1.1.1.0 255.255.255.0
Router_config_std_nacl#per 2.1.1.0 255.255.255.0
Router_config_std_nacl#exit
Router_config#

配置 NAT 地址池(可选)
Router_config#ip nat pool natpooltest 218.1.1.1 218.1.1.14 255.255.255.240

配置接口 NAT参数
Router_config#int f0/0
Router_config_f0/0#ip nat ins
Router_config_f0/0#int e1/0
Router_config_e1/0#ip nat ou
Router_config_e1/0#exit
Router_config#
 
配置静态 TCP/UDP 端口地址翻译(可选)
Router_config#ip nat ins sou sta tcp 192.168.1.1 80 218.1.1.250 80

配置单个静态地址翻译(可选)
Router_config#ip nat ins sou sta 192.168.1.2   218.1.1.251

配置动态地址池映射规则(可选)
Router_config#ip nat ins sou list natacl pool natpooltest overload

配置 PAT 端口地址映射(可选)
Router_config#ip nat ins sou list natacl int e1/0

 

NAT 配置示例

                       Internet
                           |   10.1.157.77/24
                           |
                           |
                           |   F1/0:10.1.157.250/24
                         router
                           |   E1/0:172.16.1.1
                           |
-----------------------------------------------------------------
      |                    |                    |
172.16.1.2          172.16.1.3 Port:80       172.16.1.4
      ^                    ^
10.1.157.78         10.1.157.250 Port:80

上图中,路由器 F0/0 连接外部网络,E1/0 连接内部网络,内部 IP 172.16.1.2 与外网 IP 10.1.157.78为静态映射,内网 172.16.1.3  的 TCP 80 端口与外网接口 F0/0 IP的 TCP 80端口为静态端口地址映射。

Router#conf t
Router_config#int f0/0    //进入连接 Internet 网络的接口-外网口
Router_config_f0/0#ip add 10.1.157.250 255.255.255.0 //配置外网口的 IP 地址
Router_config_f0/0#ip nat out   //定义此端口为外网口
Router_config_f0/0#int e1/0     //进入连接内部局域网的接口-内网口
Router_config_e1/0#ip add 172.16.1.1 255.255.255.0 //定义内网口 IP 地址
Router_config_e1/0#ip nat in     //定义此端口为内网口
Router_config_e1/0#exi
Router_config#ip acc ex natacl //创建一个判断是否符合 NAT处理的控制列表
Router_config_ext_nacl#per ip 172.16.1.0 255.255.255.0 any //运行 172.16.1.0/24 网段可以访问出去。
Router_config_ext_nacl#exi
Router_config#ip nat in sou sta tcp 172.16.1.3 80 10.1.157.250 80 //定义内网 172.16.1.3 的80 端口与外网地址 10.1.157.250 的 80 端口为静态端口映射。外网用户通过 IE 中键入“Http://10.1.157.250”即可访问到内部主机 172.16.1.3 上的 WEB 页面。除了 WEB 访问外,外网主机不能访问10.1.157.250 的其它任何端口。根据需要请修改端口类型,例如 Telnet 为23,FTP 为 21,等等。
Router_config#ip nat in sou sta 172.16.1.2 10.1.157.78  //定义内网 172.16.1.2 与外网10.1.157.78 地址为静态地址映射。外网用户可以通过访问 10.1.157.78 来访问内部主机172.16.1.2 上开启的所有服务。
Router_config# ip nat service privateservice //启用 NAT对内网提供私有服务
Router_config# ip nat outside destination static tcp 10.1.157.250 80   172.16.1.3 80 //配置对内提供服务的映射
Router_config#ip nat in sou list natacl inter f1/0 //定义符合 natacl的数据流的源地址在访问外网时翻译成外网口 f1/0 的 IP 地址。
Router_config#ip route default 10.1.157.77  //添加至 Internet 的默认路由
Router_config#exi
Router#wr //保存当前配置
Saving current configuration...
OK!

此时,外部任何主机可通过访问 10.1.157.78 来访问主机 172.16.1.2,可通过访问10.1.157.250 的 80 端口(即 HTTP)来访问主机 172.16.1.3 的 WEB 页面。通过启用对内提供私有服务,内部主机可以直接以公网地址访问 WEB 服务器(应用该功能请使用 1.3.2x 版本)。

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
CISCO路由命令大全
NAT网络地址转换的3种实现方式
网络地址转换(NAT)的原理与配置
《网络搭建实训教程》第6章 访问控制列表
思科模拟器配置-NET 概念与实训
IP 网络实验(模拟+设备)(IP网络)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服