NAT转换配置实例
2010-12-25 15:35
148 查看
网络地址转换:NAT
随着全球IPV4地址的日益减少,中小型企业,甚至是拥有几百台电脑的企业,也很难申请到几个公网IP,因此,所分配的地址数量远远满足不了网络用户的需求。为了解决这个问题,就产生了网络地址转换NAT技术。
今天,我就给大家以实例的方式,来演示通过命令将内部网络私有IP地址转换成全球唯一的公网IP地址,来达到内部用户访问Internet网的目的。这也是在实际网络环境中应用最多的实例。
一,静态NAT配置:
例:将内部地址192.168.100.2~192.168.100.6转换为外部地址61.159.62.130~61.159.12.134。
1,设置外部端口IP
#int s0/0
#ip add 61.159.62.129 255.255.255.248
2,设置内部端口IP
#int f0/0
#ip add 192.168.100.1 255.255.255.0
3,在内部本地和内部合法地址之间建立地址转换。
#ip nat inside source static 192.168.100.2 61.159.62.130
#ip nat inside source static 192.168.100.3 61.159.62.131
#ip nat inside source static 192.168.100.4 61.159.62.132
#ip nat inside source static 192.168.100.5 61.159.62.133
#ip nat inside source static 192.168.100.6 61.159.62.134
4,在内部和外部端口上启用NAT。
#int s0/0
#ip nat outside
#int f0/0
#ip nat inside
二,动态NAT配置
例:将内部网络地址172.16.100.1~172.16.100.254转换为61.159.62.130~61.159.62.190
1,设置外部端口IP
#int s0/0
#ip add 61.159.62.129 255.255.255.192
2,设置内部端口IP
#int f0/0
#ip add 172.16.100.1 255.255.255.0
3,定义内部网络中允许访问外部的ACL
#access-list 1 permit 172.168.100.0 0.0.0.255
4,定义合法IP地址池
#ip nat pool text1 61.159.62.130 61.159.62.190 netmask 255.255.255.192
5,指定网络地址转换映射
#ip nat inside source list 1 pool test1
6,在内部和外部端口上启用NAT
#int s0/0
#ip nat outside
#int f0/0
#ip nat inside
三,PAT配置(复用内部LAN地址)
例1:将内部网络地址10.1.1.1~10.1.1.254转换为合法的外部地址61.159.62.130。
1,设置外部端口IP
#int s0/0
#ip add 61.159.62.129 255.255.255.192
2,设置内部IP
#int f0/0
#ip add 10.1.1.1 255.255.255.0
3,定义内部网络中允许访问外部的ACL
#access-list 1 permit 10.1.1.0 0.0.0.255
4,定义合法IP地址池
#ip nat pool test2 61.159.62.130 netmask 255.255.255.248
5,指定网络地址转换映射
#ip nat inside source list 1 pool test2 overload
6,在内部和外部端口上启用NAT
#int s0/0
#ip nat outside
#int f0/0
#in nat inside
例2:将内部网络地址10.1.1.1~10.1.1.254转换为路由器的接口地址61.159.62.129。
1,设置外部端口IP
#int s0/0
#ip add 61.159.62.129 255.255.255.252
2,设置内部端口IP
#int f0/0
#ip add 10.1.1.1 255.255.255.0
3,定义内部网络中允许访问外部的ACL
#access-list 1 permit 10.1.1.1 0.0.0.255
4,定义合法IP地址池
这里注意,直接使用路由器的接口地址,不用定义地址池。
5,指定网络地址转换映射
#ip nat inside source text3 int s0/0 overload
6,在内部和外部端口上启用NAT
#int s0/0
#ip nat outside
#int f0/0
#ip nat inside
最后,另附上:
清除NAT转换表中所有条目的命令:
#clear ip nat translation *
测试网络连通性命令:
#show ip nat translations
#show ip nat statistics
希望以上实例配置,对大家实际工作中在路由器上的应用配置有所帮助。
随着全球IPV4地址的日益减少,中小型企业,甚至是拥有几百台电脑的企业,也很难申请到几个公网IP,因此,所分配的地址数量远远满足不了网络用户的需求。为了解决这个问题,就产生了网络地址转换NAT技术。
今天,我就给大家以实例的方式,来演示通过命令将内部网络私有IP地址转换成全球唯一的公网IP地址,来达到内部用户访问Internet网的目的。这也是在实际网络环境中应用最多的实例。
一,静态NAT配置:
例:将内部地址192.168.100.2~192.168.100.6转换为外部地址61.159.62.130~61.159.12.134。
1,设置外部端口IP
#int s0/0
#ip add 61.159.62.129 255.255.255.248
2,设置内部端口IP
#int f0/0
#ip add 192.168.100.1 255.255.255.0
3,在内部本地和内部合法地址之间建立地址转换。
#ip nat inside source static 192.168.100.2 61.159.62.130
#ip nat inside source static 192.168.100.3 61.159.62.131
#ip nat inside source static 192.168.100.4 61.159.62.132
#ip nat inside source static 192.168.100.5 61.159.62.133
#ip nat inside source static 192.168.100.6 61.159.62.134
4,在内部和外部端口上启用NAT。
#int s0/0
#ip nat outside
#int f0/0
#ip nat inside
二,动态NAT配置
例:将内部网络地址172.16.100.1~172.16.100.254转换为61.159.62.130~61.159.62.190
1,设置外部端口IP
#int s0/0
#ip add 61.159.62.129 255.255.255.192
2,设置内部端口IP
#int f0/0
#ip add 172.16.100.1 255.255.255.0
3,定义内部网络中允许访问外部的ACL
#access-list 1 permit 172.168.100.0 0.0.0.255
4,定义合法IP地址池
#ip nat pool text1 61.159.62.130 61.159.62.190 netmask 255.255.255.192
5,指定网络地址转换映射
#ip nat inside source list 1 pool test1
6,在内部和外部端口上启用NAT
#int s0/0
#ip nat outside
#int f0/0
#ip nat inside
三,PAT配置(复用内部LAN地址)
例1:将内部网络地址10.1.1.1~10.1.1.254转换为合法的外部地址61.159.62.130。
1,设置外部端口IP
#int s0/0
#ip add 61.159.62.129 255.255.255.192
2,设置内部IP
#int f0/0
#ip add 10.1.1.1 255.255.255.0
3,定义内部网络中允许访问外部的ACL
#access-list 1 permit 10.1.1.0 0.0.0.255
4,定义合法IP地址池
#ip nat pool test2 61.159.62.130 netmask 255.255.255.248
5,指定网络地址转换映射
#ip nat inside source list 1 pool test2 overload
6,在内部和外部端口上启用NAT
#int s0/0
#ip nat outside
#int f0/0
#in nat inside
例2:将内部网络地址10.1.1.1~10.1.1.254转换为路由器的接口地址61.159.62.129。
1,设置外部端口IP
#int s0/0
#ip add 61.159.62.129 255.255.255.252
2,设置内部端口IP
#int f0/0
#ip add 10.1.1.1 255.255.255.0
3,定义内部网络中允许访问外部的ACL
#access-list 1 permit 10.1.1.1 0.0.0.255
4,定义合法IP地址池
这里注意,直接使用路由器的接口地址,不用定义地址池。
5,指定网络地址转换映射
#ip nat inside source text3 int s0/0 overload
6,在内部和外部端口上启用NAT
#int s0/0
#ip nat outside
#int f0/0
#ip nat inside
最后,另附上:
清除NAT转换表中所有条目的命令:
#clear ip nat translation *
测试网络连通性命令:
#show ip nat translations
#show ip nat statistics
希望以上实例配置,对大家实际工作中在路由器上的应用配置有所帮助。
相关文章推荐
- NAT路由转换配置实例
- 网络地址转换(NAT)配置实例
- C#实现多级子目录Zip压缩解压实例 NET4.6下的UTC时间转换 [译]ASP.NET Core Web API 中使用Oracle数据库和Dapper看这篇就够了 asp.Net Core免费开源分布式异常日志收集框架Exceptionless安装配置以及简单使用图文教程 asp.net core异步进行新增操作并且需要判断某些字段是否重复的三种解决方案 .NET Core开发日志
- NAT地址转换配置示例!~
- NAT配置实例
- 实验三十五、NAT 地址转换的配置
- 网络地址转换(NAT)的原理与配置
- Linux双网卡(外网与局域网)的配置 使用iptables配置NAT的实例
- NAT配置实例
- CISCO+IPSEC+NAT配置实例
- 静态NAT配置实例
- NAT简单实例,教会你如何配置访问内部开发环境
- 思科路由器NAT地址映射配置实例
- ASA配置实例之NAT和PAT的地址转换(二)
- 网络设备配置与管理----使用NAT转换实现Internet接入
- Cisco Packet Tracer 配置网络实例---包括单臂路由-3层交换机-NAT的配置
- 路由器NAT功能配置简介与实例
- NAT转换配置
- 配置对位于网络地址转换(NAT)后方的服务的访问
- NAT配置实例