网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

NAT动态网络地址转换(实践)

拓扑结构图

NAT动态网络地址转换(实践)

创新互联主营无棣网站建设的网络公司,主营网站建设方案,重庆APP软件开发,无棣h5微信小程序定制开发搭建,无棣网站营销推广欢迎无棣等地区企业咨询



第一步:配置交换机SW

sw#conf t 
sw(config)#no ip routing        //关闭路由功能
sw(config)#int f1/0
sw(config-if)#speed 100         //配置速率  
sw(config-if)#dup full          //配置全双工模式

第二步:配置路由器R1,并设定NAT

1.配置路由器双臂路由

R1#conf t
R1(config)#int f0/0
R1(config-if)#ip add 192.168.100.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int f0/1 
R1(config-if)#ip add 12.0.0.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#ex

2.设定NAT地址转换

R1(config)#access-list 1 permit 192.168.100.0 0.0.0.255         //设定内部地址转化范围
R1(config)#ip nat pool test 12.0.0.10 12.0.0.100 netmask 255.255.255.0          ////设定外部地址转化范围
R1(config)#ip nat inside source list 1 pool test            //调用ip地址池
R1(config)#int f0/0
R1(config-if)#ip nat inside                 //将NAT应用于内部端口
R1(config-if)#int f0/1
R1(config-if)#ip nat outside                //将NAT应用于外部端口
R1(config-if)#end 

第三步:配置客户机ip地址

PC1> ip 192.168.100.10 192.168.100.1
Checking for duplicate address...
PC1 : 192.168.100.10 255.255.255.0 gateway 192.168.100.1

PC2> ip 192.168.100.20 192.168.100.1 
Checking for duplicate address...
PC1 : 192.168.100.20 255.255.255.0 gateway 192.168.100.1

PC3> ip 12.0.0.12 12.0.0.1
Checking for duplicate address...
PC1 : 12.0.0.12 255.255.255.0 gateway 12.0.0.1

第四步:测试全网互通性,并使用debug功能

1.测试互通性

PC1> ping 12.0.0.12
84 bytes from 12.0.0.12 icmp_seq=1 ttl=63 time=31.244 ms
84 bytes from 12.0.0.12 icmp_seq=2 ttl=63 time=31.282 ms
84 bytes from 12.0.0.12 icmp_seq=3 ttl=63 time=46.897 ms
84 bytes from 12.0.0.12 icmp_seq=4 ttl=63 time=46.834 ms
84 bytes from 12.0.0.12 icmp_seq=5 ttl=63 time=31.210 ms

PC2> ping 12.0.0.12
84 bytes from 12.0.0.12 icmp_seq=1 ttl=63 time=46.864 ms
84 bytes from 12.0.0.12 icmp_seq=2 ttl=63 time=46.864 ms
84 bytes from 12.0.0.12 icmp_seq=3 ttl=63 time=31.242 ms
84 bytes from 12.0.0.12 icmp_seq=4 ttl=63 time=31.273 ms
84 bytes from 12.0.0.12 icmp_seq=5 ttl=63 time=31.208 ms

2.debug功能查看地址转换过程

R1#debug ip nat
IP NAT debugging is on
R1#
*Mar  1 00:15:21.287: NAT*: s=192.168.100.10->12.0.0.10, d=12.0.0.12 [55463]
*Mar  1 00:15:21.295: NAT*: s=12.0.0.12, d=12.0.0.10->192.168.100.10 [55463]

//PC1 地址转换成功

R1#
*Mar  1 00:19:12.139: NAT*: s=192.168.100.20->12.0.0.11, d=12.0.0.12 [55693]
*Mar  1 00:19:12.159: NAT*: s=12.0.0.12, d=12.0.0.11->192.168.100.20 [55693]

//PC2 地址转换成功

网站标题:NAT动态网络地址转换(实践)
标题链接:http://bjjierui.cn/article/jcjhpi.html

其他资讯