Packet Tracer 5.2实验(十五) 网络端口地址转换NAPT配置

一、实验目标

  • 理解NAT网络地址转换的原理及功能;

  • 掌握NAPT的配置,实现局域网访问互联网;

二、实验背景

公司办公网需要接入互联网,公司只向ISP申请了一条专线,该专线分配了一个公网IP地址,配置实现全公司的主机都能访问外网。

三、技术原理

  • NAT将网络划分为内部网络和外部网络两部分,局域网主机利用NAT访问网络时,是将局域网内部的本地地址转换为全局地址(互联网合法的IP地址)后转发数据包;

  • NAT分为两种类型:NAT(网络地址转换)和NAPT(网络端口地址转换IP地址对应一个全局地址)。

  • NAPT:使用不同的端口来映射多个内网IP地址到一个指定的外网IP地址,多对一。

  • NAPT采用端口多路复用方式。内部网络的所有主机均可共享一个合法外部IP地址实现对Internet的访问,从而可以最大限度节约IP地址资 源。同时,又可隐藏网络内部的所有主机,有效避免来自Internet的***。因此,目前网络中应用最多的就是端口多路复用方式。

四、实验步骤

实验拓扑

1、R1为公司出口路由器,其与ISP路由器之间通过V.35电缆串口连接,DCE端连接在R1上,配置其时钟频率为64000;

2、配置PC机、服务器及路由器接口IP地址;

3、在各路由器上配置静态路由协议,让PC间能相互ping通;

4、在R1上配置NAPT;

5、在R1上定义内外部网络接口;

6、验证主机之间的互通性。

R1:

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R1
R1(config)#int fa0/0
R1(config-if)#ip add 192.168.1.1 255.255.255.0
R1(config-if)#no shut%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#exit
R1(config)#int s2/0
R1(config-if)#ip add 200.1.1.1 255.255.255.0
R1(config-if)#no shut%LINK-5-CHANGED: Interface Serial2/0, changed state to down
R1(config-if)#clock rate 64000
R1(config-if)#exit
R1(config)#
R1(config)#
R1(config)#
R1(config)#
%LINK-5-CHANGED: Interface Serial2/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
R1(config)#
R1(config)#ip route 200.1.2.0 255.255.255.0 200.1.1.2                           //配置静态路由
R1(config)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console
R1#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area* - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not setC    192.168.1.0/24 is directly connected, FastEthernet0/0
C    200.1.1.0/24 is directly connected, Serial2/0
S    200.1.2.0/24 [1/0] via 200.1.1.2
R1#
R1#
R1#
R1#
R1#
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int fa0/0
R1(config-if)#ip nat inside
R1(config-if)#exit
R1(config)#int s2/0
R1(config-if)#ip nat outside
R1(config-if)#exit
R1(config)#access-list ?  <1-99>     IP standard access list  <100-199>  IP extended access list
R1(config)#access-list 1 ?deny    Specify packets to rejectpermit  Specify packets to forwardremark  Access list entry comment
R1(config)#access-list 1 permit ?A.B.C.D  Address to matchany      Any source hosthost     A single host address
R1(config)#access-list 1 permit 192.168.1.0 ?A.B.C.D  Wildcard bits  <cr>R1(config)#access-list 1 permit 192.168.1.0 0.0.0.255 ?  <cr>R1(config)#access-list 1 permit 192.168.1.0 0.0.0.255                       //定义访问控制列表
R1(config)#ip nat ?inside   Inside address translationoutside  Outside address translationpool     Define pool of addresses
R1(config)#ip nat pool ?WORD  Pool name
R1(config)#ip nat pool david ?A.B.C.D  Start IP address
R1(config)#ip nat pool david 200.1.1.3 ?A.B.C.D  End IP address
R1(config)#ip nat pool david 200.1.1.3 200.1.1.3 ?netmask  Specify the network mask
R1(config)#ip nat pool david 200.1.1.3 200.1.1.3 netmask ?A.B.C.D  Network mask
R1(config)#ip nat pool david 200.1.1.3 200.1.1.3 netmask 255.255.255.0 ?  <cr>R1(config)#ip nat pool david 200.1.1.3 200.1.1.3 netmask 255.255.255.0
R1(config)#ip nat inside ?source  Source address translation
R1(config)#ip nat inside source ?list    Specify access list describing local addressesstatic  Specify static local->global mapping
R1(config)#ip nat inside source list 1 ?interface  Specify interface for global addresspool       Name pool of global addresses
R1(config)#ip nat inside source list 1 pool ?WORD  Name pool of global addresses
R1(config)#ip nat inside source list 1 pool david ?overload  Overload an address translation  <cr>R1(config)#ip nat inside source list 1 pool david overload ?  <cr>R1(config)#ip nat inside source list 1 pool david overload
R1(config)#end
R1#
%SYS-5-CONFIG_I: Configured from console by console
R1#show ip nat ?statistics    Translation statisticstranslations  Translation entries
R1#show ip nat translations                                                      //没有主机访问Web Server的时候,没有记录R1#
R1#show ip nat translations                                                      //有主机访问Web Server,产生记录Pro  Inside global     Inside local       Outside local      Outside global
tcp 200.1.1.3:1026     192.168.1.2:1026   200.1.2.2:80       200.1.2.2:80R1#show ip nat translations                                                      //来自1.2和1.3的主机访问
Pro  Inside global     Inside local       Outside local      Outside global
tcp 200.1.1.3:1026     192.168.1.2:1026   200.1.2.2:80       200.1.2.2:80
tcp 200.1.1.3:1025     192.168.1.3:1025   200.1.2.2:80       200.1.2.2:80R1#show ip nat translations
Pro  Inside global     Inside local       Outside local      Outside global
tcp 200.1.1.3:1026     192.168.1.2:1026   200.1.2.2:80       200.1.2.2:80
tcp 200.1.1.3:1027     192.168.1.2:1027   200.1.2.2:80       200.1.2.2:80
tcp 200.1.1.3:1025     192.168.1.3:1025   200.1.2.2:80       200.1.2.2:80
tcp 200.1.1.3:1024     192.168.1.3:1026   200.1.2.2:80       200.1.2.2:80R1#

R2:

Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#hostname R2
R2(config)#int fa0/0
R2(config-if)#ip add 200.1.2.1 255.255.255.0
R2(config-if)#no shut%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R2(config-if)#exit
R2(config)#int s2/0
R2(config-if)#ip add 200.1.1.2 255.255.255.0
R2(config-if)#no shut%LINK-5-CHANGED: Interface Serial2/0, changed state to up
R2(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial2/0, changed state to up
R2(config-if)#
R2(config-if)#
R2(config-if)#exit
R2(config)#ip route 192.168.1.0 255.255.255.0 200.1.1.1
R2(config)#end
R2#
%SYS-5-CONFIG_I: Configured from console by console
R2#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGPD - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter areaN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGPi - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area* - candidate default, U - per-user static route, o - ODRP - periodic downloaded static routeGateway of last resort is not setS    192.168.1.0/24 [1/0] via 200.1.1.1
C    200.1.1.0/24 is directly connected, Serial2/0
C    200.1.2.0/24 is directly connected, FastEthernet0/0
R2#
R2#
R2#
R2#

PC1:

Packet Tracer PC Command Line 1.0
PC>ipconfigIP Address......................: 192.168.1.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.1PC>ping 200.1.2.2Pinging 200.1.2.2 with 32 bytes of data:Reply from 200.1.2.2: bytes=32 time=15ms TTL=126
Reply from 200.1.2.2: bytes=32 time=16ms TTL=126
Reply from 200.1.2.2: bytes=32 time=16ms TTL=126
Reply from 200.1.2.2: bytes=32 time=15ms TTL=126Ping statistics for 200.1.2.2:Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:Minimum = 15ms, Maximum = 16ms, Average = 15msPC>

PC-WEB:

转载于:https://blog.51cto.com/374721/1616021

转载一篇NAT实验,备忘相关推荐

  1. [转载]unix环境高级编程备忘:理解保存的设置用户ID,设置用户ID位,有效用户ID,实际用户ID...

    转载自http://www.cnblogs.com/stemon/p/5287631.html 一.基本概念 实际用户ID(RUID):用于标识一个系统中用户是谁,一般是在登录之后,就被唯一的确定,就 ...

  2. java 数据库连接池的maxIdle该如何配置(转载非我原创)备忘

    java连接池的maxIdle该如何配置 摘要:最近针对某系统做了次压力测试,在并发较高的时候暴露了一个maxIdle设置不合理的问题,特总结一下这次问题,并分析一下这个问题背后的原因. 问题现象 用 ...

  3. HTML5隐藏图片代码,HTML5终极备忘大全(图片版+文字版)

    一.前言兼图片备忘 下图是我从testking网站上的Ultimate HTML5 Cheatsheat这篇文章中备忘图片(已大小优化,因为图片较高,故滚动显示). 但是,上面毕竟是图片格式(原图上兆 ...

  4. HTML5终极备忘大全(图片版+文字版)

    评论:不久的将来html5必将统一前端标记性网页编程语言,这些新标签和新属性以后还要多记多用!仅在此处收藏之! 一.前言兼图片备忘 下图是我从testking网站上的Ultimate HTML5 Ch ...

  5. uniApp介绍篇-1.基础框架搭建与排坑备忘

    基础框架搭建与排坑备忘 一.uniApp介绍与注意点 1.目录结构 2.跳转页面 3.条件编译 4.生命周期 5.样式布局 6.图片引用 7.html标签 8.JsApi 9.小程序组件支持 10.事 ...

  6. Android实验之实现一个生日备忘簿

    一.实验内容 实现一个生日备忘簿 二.实验目的 1. 学习 SQLite 数据库的使用; 2. 学习ContentProvider的使用; 3. 复习Android界面编程. 三.实验要求 1. 使用 ...

  7. 操作篇 了解学习NAT实验(关于静态NAT、动态NAT、EasyIP、端口映射的配置方法))

    文章目录 前言 NAT工作原理 NAT分类 一:实验环境 1.1:实验原理 1.2实验目的 1.3华为NAT实验拓扑图 二:实验过程 配置SW1 配置AR1: 配置AR2: 前言 随着Internet ...

  8. 机器学习性能改善备忘单

    原文地址:Machine Learning Performance Improvement Cheat Sheet  原文翻译与校对:@姜范波 && 寒小阳  时间:2016年12月. ...

  9. jQuery学习笔记--JqGrid相关操作 方法列表 备忘 重点讲解(超重要) from:jpr1990

    JqGrid相关操作备忘 方法列表 1.获得当前列表行数:$("#gridid").getGridParam("reccount"); 2.获取选中行数据(js ...

最新文章

  1. 继承和多态 2.0 -- 继承的六个默认成员函数
  2. oracle用户登录的认证方式
  3. $sanitize和$sce服务的使用方法
  4. 自定义列表字段类型(3)
  5. windows os x_如何立即在OS X上获取Windows样式的窗口捕捉
  6. oracle修改redo路径,oracle修改redo log files路径
  7. flask-alchemy-pagination
  8. ASP.NET 4.0 来了
  9. Python之路-4
  10. CF1399D Binary String To Subsequences
  11. php网站简繁切换,一个独立可用的中文简体繁体转换PHP程序
  12. IDEA主题SublimeTest3修改
  13. 使用el-tree-transfer不显示label的坑
  14. could not extract ResultSet
  15. 投资体系-01-房产投资-普通购房者和投资者 分水岭
  16. Brainfuck与Ook!编程语言解析与解密
  17. 安卓逆向学习 之 KGB Messenger的writeup(1)
  18. 博途v15模拟量转换_浅谈西门子S7-1200PLC的模拟量转换,附实例演示
  19. 软件工程作业-方舟学习笔记08-部分原理(续
  20. 手脱FSG压缩壳及问题处理

热门文章

  1. 【TensorFlow】笔记2:深层神经网络
  2. 【NLP实战】Task2:特征处理
  3. Java实现1到n的倒数的累加和
  4. 6、Dcoker 容器数据卷用DockerFile添加
  5. engineering equation solver_欧洲留学|爱尔兰圣三一大学不可错过的高薪专业工程学Msc.Engineering|爱尔兰最佳工程课程!...
  6. 视频回顾 | 微信生态数字化运营进阶课大全!
  7. 助理来也胡一川:用数据驱动打造智能行业助理(技术+业务)
  8. Android-静态代理模式
  9. jenkins+testlink+python搭建自动化测试环境
  10. 解决Linux下MySQL启动错误Starting MySQL.Manager of pid-file quit without updating file.[FAILED]...