当前位置:网站首页>HCIA-R&S自用笔记(25)NAT技术背景、NAT类型及配置
HCIA-R&S自用笔记(25)NAT技术背景、NAT类型及配置
2022-07-29 05:11:00 【筐瓢大师小吕】
NAT技术背景(7/27,29min)


运营商路由器中不会有私网路由(提到MPLS VPN)

宽带/无线路由器与运营商路由器的区别
一台终端会使得路由器产生大量的NAT转换信息
NAT类型和配置(7/27,86min)
静态NAT

若运营商分配给我五个公网地址?我能否在一个接口上配置五个地址?(用地址池即可)
静态NAT配置:
| 命令 | 备注 |
| nat static enable | 开启静态NAT功能 |
| nat static global x.x.x.x(公)inside 192.168.1.1 | 创建静态NAT |
| display nat static | 查看静态NAT配置 |
注意,静态NAT为一对一,一个私网地址对应一个公网地址,多用于服务器的映射。
动态NAT

特点是需要等
动态NAT与PAT配置:
| 命令 | 备注 |
| nat address-group 1 x.x.x.x x.x.x.x.y | 配置NAT地址池, 可设置范围(0-7) |
| nat outbound acl 2000 address group 1 | 关联一条ACL与一个ACL地址池; ACL用于匹配需要转换的源地址 (此时为PAT模式) |
| nat outbound acl 2000 address group 1 no-pat | 同上,此时为普通的动态NAT模式 |
| display nat address-group | 查看NAT地址池配置信息 |
| display nat outbound | 查看动态NAT配置信息 |
| display nat session all | 查看路由器NAT映射表 |
动态NAT情况下,即便是一个终端的一次ping都用掉一个公网地址
PAT/NAT-PT/NAPT

通常适用于大型企业网络(申请了多个固定的公网IP)
不同终端的每一次ping时ID(New IcmpID)不一样,且其他含TCP/UDP的报文端口号也不一样
Easy IP/SNAT(源NAT)

不建立地址池(PAT需要建立地址池),直接关联接口即可
Easy IP配置:
| 命令 | 备注 |
| int GigabitEthernet 0/0/1 | |
| nat outbound acl 2000 | 关联出站接口与ACL |
NAT服务器/DANT

当外网用户访问内网服务器时,NAT Server通过事先配置好的“公网IP地址+端口号”与“私网IP地址+端口号”间的映射关系,将服务器的“公网IP地址+端口号”根据映射关系替换成对应得到“私网IP地址+端口号”
NAT服务器配置:
| 命令 | 备注 |
(接口视图下) nat server protocol tcp/udp global x.x.x.x/Gigabitethernet 0/0/x 3333 inside 192.168.1.1 80 | 配置NAT服务器 (外网用户访问x.x.x.x:3333时,实际上访问192.168.1.1:80) |
| display nat server | 验证NAT服务器 |
外网访问内网的两种方式:
端口映射/NAT服务器(发布服务到外网)、VPN(更加安全)

R1的接口配置:
#
interface GigabitEthernet0/0/0
ip address 192.168.0.254 255.255.255.0
dhcp select interface
#
interface GigabitEthernet0/0/1
ip address 12.0.0.1 255.255.255.0
traffic-filter outbound acl 2000
nat server protocol tcp global 12.0.0.10 8888 inside 192.168.0.100 www
//注意,此处并非接口地址
nat outbound 2000
#其他地址配置如上,此时HTTP客户端(2.0.0.20)可以访问到内网中的Server1

边栏推荐
- 省市区三级联动(简单又完美)
- 阿里云架构师细说游戏行业九大趋势
- Occt learning 001 - Introduction
- [C language series] - three methods to simulate the implementation of strlen library functions
- 刷题狂魔—LeetCode之剑指offer58 - II. 左旋转字符串 详解
- Cryengine5 shader debugging
- ClickHouse学习(五)集群操作
- Cryengine3 debugging shader method
- 移动端-flex项目属性
- Integer overflow and printing
猜你喜欢

ClickHouse学习(五)集群操作

uniapp组件之tab选项卡滑动切换
![[event preview] cloud digital factory and digital transformation and innovation forum for small and medium-sized enterprises](/img/6f/f7c5d605ea9b7b9e7c49ac716492ef.jpg)
[event preview] cloud digital factory and digital transformation and innovation forum for small and medium-sized enterprises

Three handshakes and four waves for the interview summary

Occt learning 003 - MFC single document project

Together with digital people, digital space and XR platform, Alibaba cloud and its partners jointly build a "new vision"

Question swiping Madness - leetcode's sword finger offer58 - ii Detailed explanation of left rotation string

Day 2

实现简单的数据库查询(不完整)

【剑指offer】— 详解库函数atoi以及模拟实现atoi函数
随机推荐
游戏行业弹性计算最佳实践
End of document
【无标题】
ANSI C type qualifier
抽象类与接口
H5语义化标签
第一周总结
ClickHouse学习(六)语法优化
Clickhouse learning (V) cluster operation
关于局部变量
[event preview] cloud digital factory and digital transformation and innovation forum for small and medium-sized enterprises
【C语言系列】— 不创造第三个变量,实现两个数的交换
redis的基本使用
【TypeScript】深入学习TypeScript对象类型
Alibaba cloud and Dingjie software released the cloud digital factory solution to realize the localized deployment of cloud MES system
link与@import的关系
阿里云联合鼎捷软件发布云上数字工厂解决方案,实现云MES系统本地化部署
【C语言系列】—深度解剖数据在内存中的存储(一) 暑假开篇
【TypeScript】TypeScript中类型缩小(含类型保护)与类型谓词
微信小程序-屏幕高度