设为首页 收藏本站
查看: 1386|回复: 0

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

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-3-31 09:28:56 | 显示全部楼层 |阅读模式
一、实验目标
  • 理解NAT网络地址转换的原理及功能;
  • 掌握NAPT的配置,实现局域网访问互联网;
二、实验背景
公司办公网需要接入互联网,公司只向ISP申请了一条专线,该专线分配了一个公网IP地址,配置实现全公司的主机都能访问外网。
三、技术原理
  • NAT将网络划分为内部网络和外部网络两部分,局域网主机利用NAT访问网络时,是将局域网内部的本地地址转换为全局地址(互联网合法的IP地址)后转发数据包;
  • NAT分为两种类型:NAT(网络地址转换)和NAPT(网络端口地址转换IP地址对应一个全局地址)。
  • NAPT:使用不同的端口来映射多个内网IP地址到一个指定的外网IP地址,多对一。
  • NAPT采用端口多路复用方式。内部网络的所有主机均可共享一个合法外部IP地址实现对Internet的访问,从而可以最大限度节约IP地址资源。同时,又可隐藏网络内部的所有主机,有效避免来自Internet的攻击。因此,目前网络中应用最多的就是端口多路复用方式。
四、实验步骤
实验拓扑
2012072422424012.jpg
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 - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - 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 - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

C    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 reject
  permit  Specify packets to forward
  remark  Access list entry comment
R1(config)#access-list 1 permit ?
  A.B.C.D  Address to match
  any      Any source host
  host     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 translation
  outside  Outside address translation
  pool     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 addresses
  static  Specify static local->global mapping
R1(config)#ip nat inside source list 1 ?
  interface  Specify interface for global address
  pool       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 statistics
  translations  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:80

R1#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:80

R1#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:80

R1#



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 - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - 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 - ODR
       P - periodic downloaded static route

Gateway of last resort is not set

S    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>ipconfig

IP Address......................: 192.168.1.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.1

PC>ping 200.1.2.2

Pinging 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=126

Ping 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 = 15ms

PC>



PC-WEB:
2012072422485080.jpg


运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-197994-1-1.html 上篇帖子: Packet Tracer 5.2实验(十四) 网络地址转换NAT配置 下篇帖子: Packet Tracer 5.3实验(十六) 网络设备系统升级
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表