rfc5780.NAT Behavior Discovery Using Session Traversal Utilities for NAT (STUN)

合集下载

2023 华为 Datacom-HCIE 真题题库

2023 华为 Datacom-HCIE 真题题库

2023 华为Datacom-HCIE 真题题库单项选择题1.[试题编号:190585] (单选题)华为SD-WAN解决方案中,当CPE位于NAT设备后的私网时,特别是两个站点的CPE同时位于NAT设备后的私网时,CPE之间需要使用NAT穿越技术。

华为SD-WAN解决方案中使用以下哪一项技术帮助CPE之间实现NAT穿越?A、NAT ALGB、NAT serverC、IPsec VPND、STUN答案:D解析:华为SD-WAN解决方案是一种通过网络控制器集中管理CPE设备、零配置开局的解决方案,可以帮助企业应对云服务带来的挑战,做到业务随需而变。

当CPE 位于NAT设备后的私网时,特别是两个站点的CPE同时位于NAT设备后的私网时,CPE之间需要使用NAT穿越技术,才能实现业务流量的互通。

华为SD-WAN 解决方案中使用STUN技术帮助CPE之间实现NAT穿越。

下面我来分析一下各个选项:A项:NAT ALG。

这个描述是错误的,因为NAT ALG是一种应用层网关技术,用于修改应用层报文中的IP地址和端口信息,以适应NAT转换后的地址变化,而不是用于实现NAT穿越。

B项:NAT server。

这个描述也是错误的,因为NAT server是一种NAT设备上的功能,用于将公网IP地址和端口映射到私网IP地址和端口,以提供对外服务,而不是用于实现NAT穿越。

C项:IPsec VPN。

这个描述同样是错误的,因为IPsec VPN是一种安全隧道技术,用于在不安全的网络中建立加密和认证的通道,以保护数据传输的安全性,而不是用于实现NAT穿越。

D项:STUN。

这个描述是正确的,因为STUN是一种NAT会话穿越应用程序,用于检测网络中是否存在NAT设备,并获取两个通信端点经NAT设备分配的IP 地址和端口号,在两个通信端点之间建立一条可穿越NAT的P2P链接2。

2.[试题编号:190584] (单选题)如图所示,在虚拟化园区网络中部署业务随行,其中PC1属于Sales安全组,PC2属于R&D安全组,PC3属于Market安全组。

1单选题一个公司有50个私有IP地址

1单选题一个公司有50个私有IP地址

1单选题一个公司有50个私有IP地址,管理员使用NAT技术将公司网络接入公网,但是该公司仅有一个公网地址,则下列哪种NAT转换方式符合需求?A、动态转换B、easy-ipC、静态转换D、NAPT正确答案:B2单选题华为BBU5900的UMPT单板的端口中,哪个是用于BBU互联的?A、XGE3B、CIC、E1/T1D、FE/GE0正确答案:B3单选题根据流程先后顺序,5G下行波束赋形为如下哪四步?()A、权值计算、加权、通道校正、赋形B、权值计算、通道校正、加权、赋形C、通道校正、权值计算、加权、赋形D、通道校正、加权、权值计算、赋形正确答案:C4单选题华为系统中,NR小区的PoNominalPusch设置过大,将会导致()A、PUSCH的SINR低,对邻区干扰大B、PUSCH的SINR高,对邻区干扰大C、PUSCH的SINR高,对邻区干扰小D、PUSCH的SINR低,对邻区干扰小正确答案:B以下哪些因素会对下行峰值速率有影响PDSCH IBLERBWP为网络侧配置给UE的一段连续带宽资源,应用场景包括MIMO传输的三种基本方法是当前语音承载类型包括IMS语音OTT语音CSFB语音CS语音关于5G中SSB说法正确的是:SSB由PSS\SSS\PBCH构成SSB中SSS占用127个子载波SSB中PSS占用127个子载波43. ?PUSCH支持的波形包括(AB)A)? DFT-S-OFDM?B)? CP-OFDM?C)?DFT-OFDM?D)? D.S-OFDM[单选]以下哪条命令能够显示ASA防火墙上的CSC、SSM模块的状态()。

A . show interfaceB . show hw 1 detailsC . show module 1 detailsD . show module 1 csc detail26.在NR系统中,主同步信号(PSS)、辅同步信号(SSS)和PBCH共同构成一个SSB,每个SSB由240个连续的子载波组成。

ipsec 穿越NAT RFC文档

ipsec 穿越NAT RFC文档

HASH值的计算方法如下,具体HASH是根据协商来确定的:
HASH = HASH(CKY-I | CKY-R | IP | Port)
CKY-I和CKY-R是协商发起方和响应方的cookie。
协商中双方各自至少要发送两个NAT-D载荷,第一个载荷是对方的地址和端口的HASH,后面的载荷是自己的地址和端口,如果本地有多个地址,则要发送多个载荷,包括所有地址和端口的HASH,对方接收到载荷后重新根据收到的包的实际地址端口来计算HASH值后进行比较,就可以知道是否有NAT设备以及哪一方在NAT设备之后了。
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
+---------------+---------------+---------------+---------------+
| IPv4 (4 octets) or IPv6 address (16 octets) |
+---------------+---------------+---------------+---------------+

rfc5930.Using Advanced Encryption Standard Counter Mode (AES-CTR)

rfc5930.Using Advanced Encryption Standard Counter Mode (AES-CTR)

Internet Engineering Task Force (IETF) S. Shen Request for Comments: 5930 Huawei Category: Informational Y. Mao ISSN: 2070-1721 Hangzhou H3C Tech. Co., Ltd. NSS. Murthy Freescale Semiconductor July 2010 Using Advanced Encryption Standard Counter Mode (AES-CTR)with the Internet Key Exchange version 02 (IKEv2) Protocol AbstractThis document describes the usage of Advanced Encryption StandardCounter Mode (AES-CTR), with an explicit Initialization Vector, bythe Internet Key Exchange version 2 (IKEv2) protocol, for encrypting the IKEv2 exchanges that follow the IKE_SA_INIT exchange.Status of This MemoThis document is not an Internet Standards Track specification; it is published for informational purposes.This document is a product of the Internet Engineering Task Force(IETF). It represents the consensus of the IETF community. It hasreceived public review and has been approved for publication by theInternet Engineering Steering Group (IESG). Not all documentsapproved by the IESG are a candidate for any level of InternetStandard; see Section 2 of RFC 5741.Information about the current status of this document, any errata,and how to provide feedback on it may be obtained at/info/rfc5930.Shen, et al. Informational [Page 1]Copyright NoticeCopyright (c) 2010 IETF Trust and the persons identified as thedocument authors. All rights reserved.This document is subject to BCP 78 and the IETF Trust’s LegalProvisions Relating to IETF Documents(/license-info) in effect on the date ofpublication of this document. Please review these documentscarefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e ofthe Trust Legal Provisions and are provided without warranty asdescribed in the Simplified BSD License.Table of Contents1. Introduction (2)1.1. Conventions Used in This Document (3)2. IKEv2 Encrypted Payload (3)3. IKEv2 Conventions (4)4. Security Considerations (4)5. IANA Considerations (4)6. Acknowledgments (4)7. References (5)7.1. Normative References (5)7.2. Informative References (5)1. IntroductionThe Internet Key Exchange version 2 (IKEv2) protocol [RFC4306] is acomponent of IPsec used for performing mutual authentication andestablishing and maintaining security associations (SAs). [RFC4307] defines the set of algorithms that are mandatory to implement as part of IKEv2, as well as algorithms that should be implemented becausethey may be promoted to mandatory at some future time. [RFC4307]requires that an implementation "SHOULD" support Advanced Encryption Standard [AES] Counter Mode [MODES] (AES-CTR) as a Transform Type 1algorithm (encryption).Although [RFC4307] specifies that the AES-CTR encryption algorithmfeature SHOULD be supported by IKEv2, no existing document specifies how IKEv2 can support the feature. This document provides thespecification and usage of AES-CTR Counter Mode by IKEv2.Implementers need to carefully consider the use of AES-CTR over themandatory-to-implement algorithms in [RFC4307], because theperformance improvements of AES-CTR are minimal in the context of Shen, et al. Informational [Page 2]IKEv2. Furthermore, these performance improvements may be offset by the Counter Mode specific risk of a minor, hard-to-detectimplementation issue resulting in total security failure.1.1. Conventions Used in This DocumentThe key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT","SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC2119].2. IKEv2 Encrypted PayloadSection 3.14 of IKEv2 [RFC4306] explains the IKEv2 Encrypted Payload. The Encrypted Payload, denoted SK{...}, contains other IKEv2 payloads in encrypted form.The payload includes an Initialization Vector (IV) whose length isdefined by the encryption algorithm negotiated. It also includesIntegrity Checksum data. These two fields are not encrypted.The IV field MUST be 8 octets when the AES-CTR algorithm is used for IKEv2 encryption. The requirements for this IV are the same as what is specified for the Encapsulating Security Payload (ESP) inSection 3.1 of [RFC3686].IKEv2 requires Integrity Check Data for the Encrypted Payload asdescribed in Section 3.14 of [RFC4306]. The choice of integrityalgorithms in IKEv2 is defined in [RFC4307] or documents that update it in the future.When AES-CTR is used in IKEv2, no padding is required. The Paddingfield of the Encrypted Payload SHOULD be empty, and the Pad Lengthfield SHOULD be zero. However, according to [RFC4306], the recipient MUST accept any length that results in proper alignment. It shouldbe noted that the ESP [RFC4303] Encrypted Payload requires alignment on a 4-byte boundary while the IKEv2 [RFC4306] Encrypted Payload does not have such a requirement.The Encrypted Payload is the XOR of the plaintext and key stream.The key stream is generated by inputting counter blocks into the AES algorithm. The AES counter block is 128 bits, including a 4-octetNonce, 8-octet Initialization Vector, and 4-octet Block Counter, inthat order. The Block Counter begins with the value of one andincrements by one to generate the next portion of the key stream.The detailed requirements for the counter block are the same as those specified in Section 4 of [RFC3686].Shen, et al. Informational [Page 3]3. IKEv2 ConventionsThe use of AES-CTR for the IKE SA is negotiated in the same way asAES-CTR for ESP. The Transform ID (ENCR_AES_CTR) is the same; thekey length transform attribute is used in the same way; and thekeying material (consisting of the actual key and the nonce) isderived in the same way. See Section 5 of [RFC3686] for detaileddescriptions.4. Security ConsiderationsSecurity considerations explained in Section 7 of [RFC3686] areentirely relevant to this document as well. The securityconsiderations on fresh keys and integrity protection in Section 7 of [RFC3686] are totally applicable to using AES-CTR in IKEv2; see[RFC3686] for details. As static keys are never used in IKEv2 forIKE_SA and integrity protection is mandatory for IKE_SA, these issues are not applicable for AES-CTR in IKEv2 when protecting IKE_SA.Additionally, since AES has a 128-bit block size, regardless of themode employed, the ciphertext generated by AES encryption becomesdistinguishable from random values after 2^64 blocks are encryptedwith a single key. Since IKEv2 SA cannot carry that much data(because of the size limit of the message ID of the IKEv2 message and the requirements for the message ID in Section 4 of [RFC4306]), this issue is not a concern here.For generic attacks on AES, such as brute force or precalculations,the key-size requirements provide reasonable security[Recommendations].5. IANA ConsiderationsIANA [IANA-Para] has assigned an Encryption Algorithm Transform IDfor AES-CTR encryption with an explicit IV for IKEv2: 13 as thenumber, and ENCR_AES_CTR as the name. IANA has added a reference to this RFC in that entry.6. AcknowledgmentsThe authors thank Yaron Sheffer, Paul Hoffman, Tero Kivinen, andAlfred Hoenes for their direction and comments on this document.This document specifies usage of AES-CTR with IKEv2, similar to usage of AES-CTR with ESP as specified in [RFC3686]. The reader isreferred to [RFC3686] for the same descriptions and definitions. The authors thank Russ Housley for providing the document.Shen, et al. Informational [Page 4]During the production and modification of this document, both Huawei and CNNIC supported one of the authors, Sean Shen. Both areappreciated as affiliations of the author.7. References7.1. Normative References[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. [RFC3686] Housley, R., "Using Advanced Encryption Standard(AES) Counter Mode With IPsec EncapsulatingSecurity Payload (ESP)", RFC 3686, January 2004.[RFC4306] Kaufman, C., "Internet Key Exchange (IKEv2)Protocol", RFC 4306, December 2005.[RFC4307] Schiller, J., "Cryptographic Algorithms for Use in the Internet Key Exchange Version 2 (IKEv2)",RFC 4307, December 2005.[AES] National Institute of Standards and Technology,"Advanced Encryption Standard (AES)", FIPS PUB 197, November 2001, </publications/fips/fips197/fips-197.pdf>.[IANA-Para] Internet Assigned Numbers Authority, "Internet Key Exchange Version 2 (IKEv2) Parameters",<>.[MODES] Dworkin, M., "Recommendation for Block Cipher Modes of Operation -- Methods and Techniques", NISTSpecial Publication 800-38A, December 2001,</publications/nistpubs/800-38a/sp800-38a.pdf>.7.2. Informative References[RFC4303] Kent, S., "IP Encapsulating Security Payload(ESP)", RFC 4303, December 2005.[Recommendations] Barker, E., Barker, W., Burr, W., Polk, W., and M. Smid, "Recommendation for Key Management - Part 1: General (Revised)", NIST SpecialPublication 800-57, March 2007, <http:///publications/nistpubs/800-57/sp800-57-Part1-revised2_Mar08-2007.pdf>.Shen, et al. Informational [Page 5]Authors’ AddressesSean ShenHuawei4, South 4th Street, ZhongguancunBeijing 100190ChinaEMail: shenshuo@Yu MaoHangzhou H3C Tech. Co., Ltd.Oriental Electronic Bld., No. 2Chuangye RoadShang-Di Information IndustryHai-Dian DistrictBeijing 100085ChinaEMail: yumao9@N S Srinivasa MurthyFreescale SemiconductorUMA PLAZA, NAGARJUNA CIRCLE, PUNJAGUTTAHYDERABAD 500082INDIAEMail: ssmurthy.nittala@Shen, et al. Informational [Page 6]。

rfc5780中9种nat类型

rfc5780中9种nat类型

rfc5780中9种nat类型RFC5780中介绍了九种NAT类型,它们分别是Full Cone NAT、Restricted Cone NAT、Port Restricted Cone NAT、Symmetric NAT、Endpoint-Independent Mapping NAT、Endpoint-Independent Filtering NAT、Address-Dependent Mapping NAT、Address-Dependent Filtering NAT和Address and Port-Dependent Filtering NAT。

下面将逐一介绍这九种NAT类型的特点和应用场景。

1. Full Cone NAT (全锥形NAT)Full Cone NAT是最简单的NAT类型,它会为每个内部主机分配一个唯一的外部IP地址和端口号。

当内部主机发送数据包时,外部主机可以通过该地址和端口号直接回复。

Full Cone NAT适用于需要从外部网络直接访问内部主机的情况,但它会暴露内部网络的IP地址和端口号,存在安全隐患。

2. Restricted Cone NAT (限制锥形NAT)Restricted Cone NAT在Full Cone NAT的基础上增加了一定的限制,只有在内部主机发送数据包给外部主机后,外部主机才能向内部主机发送数据包。

这种类型的NAT适用于需要限制外部主机访问内部主机的情况,可以提高网络的安全性。

3. Port Restricted Cone NAT (端口限制锥形NAT)Port Restricted Cone NAT在Restricted Cone NAT的基础上增加了对端口的限制。

只有在内部主机发送数据包给外部主机的特定端口后,外部主机才能向内部主机的该端口发送数据包。

这种类型的NAT进一步限制了外部主机对内部主机的访问,增强了网络的安全性。

4. Symmetric NAT (对称NAT)Symmetric NAT会为每个内部主机和外部主机的数据包分配唯一的IP地址和端口号,并且每次通信都会分配不同的地址和端口号。

对称型nat

对称型nat

对称型nat:
4种NAT打洞:完全锥体、IP受限型、(IP和)端口受限型、对称型。

其三种都很好理解,唯独对称型比较不好理解,这里做些自己的理解。

对称型:是指UDP打洞时,一个请求对应一个映射关系。

clientA (x,y) -----------> 网关(A,b)------------>S(m, n)
clinetB(p,q) -----------> 网关(C,d)------------>S(m, n)
clientA向server S发起连接时,告诉S其公网地址和端口为 A,b
clientB向server S发起连接时,告诉S其公网地址和端口为C,d
假设server S分别告知clientA、clientB对方地址,并且clientA、clientB分别发起一条向对方的请求(该请求一定无法到达),按照对称型NAT规则,此时会有这样一个情况:对于A的网关,将会新增一条如下的映射:
clientA (x,y)-----------> 网关(A,t)----------------->clientB (C, d)
对于B的网关,将会新增一条如下的映射:
clientA (p,q)-----------> 网关(C,r)----------------->clientA (A,b)
请注意:clientA (x,y)-----------> 网关(A,t)和clientA (p,q)-----------> 网关(C,r)。

华为DatacomHCIA811试卷四

华为DatacomHCIA811试卷四

华为DatacomHCIA811试卷四华为DatacomHCIA811试卷四1.【单选题】1分| 以下哪个层次不属于中型园区网络架构中常见的网络层次?A网络层B核心层C汇聚层D接入层2.【多选题】1分| 在OSPF 广播网络中,一台DRother 路由器会与哪些路由器交换链路状态信息?ABDRB所有OSPF 邻居CDR OtherDDR3.【判断题】1分| 192.168.1.0/25 网段的广播地址为192.168.1.128 。

A对B错4.【多选题】1分| IPv4 首部中的哪些字段和分片相关?AFlagsBTTLCIdentificationDFragment Offset5.【多选题】1分| 下列关于缺省路由的说法正确的有?A如果报文的目的地址不能与路由表的其他任何路由条目匹配,那么路由器将会根据缺省路由转发该报文B在路由表中,缺省路由以到网络0.0.0.0 (掩码也为0.0.0.0 )的路由形式出现C如何一台路由器的路由表中必须存在缺省路由D缺省路由只能有管理员手工配置6.【判断题】1分| 以太网帧在交换机内部都是以带VLAN TAG 的形式来被处理和转发的。

A对B错7.【多选题】1分| 设备链路聚合支持哪些模式?A手工负载分担模式B手工主备模式C混合模式DLACP 模式8.【多选题】1分| 关于IPv6 地址2031:0000:720C:0000:0000:09E0:839A:130B,下面哪些缩写是正确的?A2031:0:720C:0:0:9E0:839A:130BB2031:0:720C::9E0:839A:130BC2031:0:720C:0:0:9E:839A:1308D2031::720C::9E0:839A:130B9.【判断题】1分| FIT AP 上线的过程中一定会从AC 下载软件版本。

A对B错10.【多选题】1分| 如下图所示,所有交换机开启STP 协议,保持其他配置保持默认状态,当网络稳定后,下列说法正确的有?ASWC 的两个端口都处于Forwarding 状态BSWB 的两个端口都处于Forwarding 状态CSWA 是这个网络中的根桥DSWB 是这个网络中的根桥11.【判断题】1分| 缺省情况下,STP 协议中的端口状态由Disable 转化为Forwarding 状态至少需要30s 的时间。

云计算HCIP模拟试题含答案

云计算HCIP模拟试题含答案

云计算HCIP模拟试题含答案一、单选题(共52题,每题1分,共52分)1.关于 FusionCompute 的功能描述错误的是?A、FusionCompute 支持虚拟机资源动态调整,用户可以根据业务负载动态调整资源的使用情况。

B、Fusiancompute 可以将服务器物理资源抽象成逻辑资源,让一台物理服务器变成几台甚至上百台相互隔离的虚拟服务器。

C、Fusioncompute 支持虚拟网络访问控制,可以通过设置安全组,实现虚拟网卡 VLANID 的修改。

D、FusionCompute 支持存储热迁移,可在同一个存储设备内、不同存储设备之间进行迁移。

正确答案:C2.当用户连接华为桌面云虚拟机时,会到 License 服务器上检查License,判断用户是否可以连接到虚拟机。

A、TRUEB、FALSE正确答案:A3.资源调度的分时阈值的设置建议在业务压力较大时设置为保守策略,在业务压力较小时设置为中等或激进策略。

A、资源调度的分时阈值的设置建议在业务压力较大时设置为保守策略,在业务压力较小时设置为中等或激进策略。

B、为使资源调度效果最好,建议同-集群下主机的 CPU、内存、网络、存储配置尽量相同,使虚拟机可以迁移到集群内的任一主机上。

C、资源调度的高级规则可以用来满足一些特殊需求。

例如两台虚拟机是主备关系时,可以将其配置为聚策略,提升虚拟机之间的数据性能。

D、资源调度可以配置不同的衡量因素,如果使用内存复用,建议配置为根据 CPU 调度。

正确答案:A4.一般部署几对 vLB 就能满足一个桌面云局点的性能要求?A、1B、2C、3D、4正确答案:A5.对于分配类型为单用户的完整复制虚拟机解分配后,下面描述正确的是?A、不能再恢复分配B、能恢复分配,但只能分配给原用户。

C、能恢复分配,分配后用户组权限发生更改。

D、能恢复分配,可以分配给新的用户。

正确答案:B6.在华为桌面云登录流程中,消耗 Liccense 发生在哪个步骤之后?A、由 TC 侧发起连接请求之后B、由 HDC 返 LoginTicket 之后C、预连接成功之后D、由 DB 返回虚拟机 IP 状态等信息后正确答案:B7.下列哪项不是 FusionCompute 日常的维护项目?A、虚拟机批量重启B、检查设备运行环境C、检查设备运行状态D、查看系统告警正确答案:A8.在 Fusi onCompute 中,VLAN 池为以下哪个对象提供 VLAN资源?A、虚拟网卡B、端口组C、上行链路D、虚拟机正确答案:B9.FusionCompute 开启电源管理自动化时,无须同时开启计算资源调度自动化即可实现电源自动化管理。

RFC3489 -- STUN - Simple Traversal of User Datagram Protocol (UDP) Through Network Address Translato

RFC3489 -- STUN - Simple Traversal of User Datagram Protocol (UDP) Through Network Address Translato

Network Working Group J. Rosenberg Request for Comments: 3489 J. Weinberger Category: Standards Track dynamicsoft C. Huitema Microsoft R. Mahy Cisco March 2003 STUN - Simple Traversal of User Datagram Protocol (UDP)Through Network Address Translators (NATs)Status of this MemoThis document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions forimprovements. Please refer to the current edition of the "InternetOfficial Protocol Standards" (STD 1) for the standardization stateand status of this protocol. Distribution of this memo is unlimited. Copyright NoticeCopyright (C) The Internet Society (2003). All Rights Reserved. AbstractSimple Traversal of User Datagram Protocol (UDP) Through NetworkAddress Translators (NATs) (STUN) is a lightweight protocol thatallows applications to discover the presence and types of NATs andfirewalls between them and the public Internet. It also provides the ability for applications to determine the public Internet Protocol(IP) addresses allocated to them by the NAT. STUN works with manyexisting NATs, and does not require any special behavior from them.As a result, it allows a wide variety of applications to work through existing NAT infrastructure.Table of Contents1. Applicability Statement (3)2. Introduction (3)3. Terminology (4)4. Definitions (5)5. NAT Variations (5)6. Overview of Operation (6)7. Message Overview (8)8. Server Behavior (10)8.1 Binding Requests (10)RFC 3489 STUN March 20038.2 Shared Secret Requests (13)9. Client Behavior (14)9.1 Discovery (15)9.2 Obtaining a Shared Secret (15)9.3 Formulating the Binding Request (17)9.4 Processing Binding Responses (17)10. Use Cases (19)10.1 Discovery Process (19)10.2 Binding Lifetime Discovery (21)10.3 Binding Acquisition (23)11. Protocol Details (24)11.1 Message Header (25)11.2 Message Attributes (26)11.2.1 MAPPED-ADDRESS (27)11.2.2 RESPONSE-ADDRESS (27)11.2.3 CHANGED-ADDRESS (28)11.2.4 CHANGE-REQUEST (28)11.2.5 SOURCE-ADDRESS (28)11.2.6 USERNAME (28)11.2.7 PASSWORD (29)11.2.8 MESSAGE-INTEGRITY (29)11.2.9 ERROR-CODE (29)11.2.10 UNKNOWN-ATTRIBUTES (31)11.2.11 REFLECTED-FROM (31)12. Security Considerations (31)12.1 Attacks on STUN (31)12.1.1 Attack I: DDOS Against a Target (32)12.1.2 Attack II: Silencing a Client (32)12.1.3 Attack III: Assuming the Identity of a Client 32 12.1.4 Attack IV: Eavesdropping (33)12.2 Launching the Attacks (33)12.2.1 Approach I: Compromise a LegitimateSTUN Server (33)12.2.2 Approach II: DNS Attacks (34)12.2.3 Approach III: Rogue Router or NAT (34)12.2.4 Approach IV: MITM (35)12.2.5 Approach V: Response Injection Plus DoS (35)12.2.6 Approach VI: Duplication (35)12.3 Countermeasures (36)12.4 Residual Threats (37)13. IANA Considerations (38)14. IAB Considerations (38)14.1 Problem Definition (38)14.2 Exit Strategy (39)14.3 Brittleness Introduced by STUN (40)14.4 Requirements for a Long Term Solution (42)14.5 Issues with Existing NAPT Boxes (43)14.6 In Closing (43)RFC 3489 STUN March 200315. Acknowledgments (44)16. Normative References (44)17. Informative References (44)18. Authors' Addresses (46)19. Full Copyright Statement (47)1. Applicability StatementThis protocol is not a cure-all for the problems associated with NAT. It does not enable incoming TCP connections through NAT. It allowsincoming UDP packets through NAT, but only through a subset ofexisting NAT types. In particular, STUN does not enable incoming UDP packets through symmetric NATs (defined below), which are common inlarge enterprises. STUN's discovery procedures are based onassumptions on NAT treatment of UDP; such assumptions may proveinvalid down the road as new NAT devices are deployed. STUN does not work when it is used to obtain an address to communicate with a peer which happens to be behind the same NAT. STUN does not work when the STUN server is not in a common shared address realm. For a morecomplete discussion of the limitations of STUN, see Section 14.2. IntroductionNetwork Address Translators (NATs), while providing many benefits,also come with many drawbacks. The most troublesome of thosedrawbacks is the fact that they break many existing IP applications, and make it difficult to deploy new ones. Guidelines have beendeveloped [8] that describe how to build "NAT friendly" protocols,but many protocols simply cannot be constructed according to thoseguidelines. Examples of such protocols include almost all peer-to-peer protocols, such as multimedia communications, file sharing andgames.To combat this problem, Application Layer Gateways (ALGs) have beenembedded in NATs. ALGs perform the application layer functionsrequired for a particular protocol to traverse a NAT. Typically,this involves rewriting application layer messages to containtranslated addresses, rather than the ones inserted by the sender of the message. ALGs have serious limitations, including scalability,reliability, and speed of deploying new applications. To resolvethese problems, the Middlebox Communications (MIDCOM) protocol isbeing developed [9]. MIDCOM allows an application entity, such as an end client or network server of some sort (like a Session Initiation Protocol (SIP) proxy [10]) to control a NAT (or firewall), in orderto obtain NAT bindings and open or close pinholes. In this way, NATs and applications can be separated once more, eliminating the need for embedding ALGs in NATs, and resolving the limitations imposed bycurrent architectures.RFC 3489 STUN March 2003 Unfortunately, MIDCOM requires upgrades to existing NAT andfirewalls, in addition to application components. Complete upgrades of these NAT and firewall products will take a long time, potentially years. This is due, in part, to the fact that the deployers of NATand firewalls are not the same people who are deploying and usingapplications. As a result, the incentive to upgrade these deviceswill be low in many cases. Consider, for example, an airportInternet lounge that provides access with a NAT. A user connectingto the NATed network may wish to use a peer-to-peer service, butcannot, because the NAT doesn't support it. Since the administrators of the lounge are not the ones providing the service, they are notmotivated to upgrade their NAT equipment to support it, using either an ALG, or MIDCOM.Another problem is that the MIDCOM protocol requires that the agentcontrolling the middleboxes know the identity of those middleboxes,and have a relationship with them which permits control. In manyconfigurations, this will not be possible. For example, many cableaccess providers use NAT in front of their entire access network.This NAT could be in addition to a residential NAT purchased andoperated by the end user. The end user will probably not have acontrol relationship with the NAT in the cable access network, andmay not even know of its existence.Many existing proprietary protocols, such as those for online games(such as the games described in RFC 3027 [11]) and Voice over IP,have developed tricks that allow them to operate through NATs without changing those NATs. This document is an attempt to take some ofthose ideas, and codify them into an interoperable protocol that can meet the needs of many applications.The protocol described here, Simple Traversal of UDP Through NAT(STUN), allows entities behind a NAT to first discover the presenceof a NAT and the type of NAT, and then to learn the addressesbindings allocated by the NAT. STUN requires no changes to NATs, and works with an arbitrary number of NATs in tandem between theapplication entity and the public Internet.3. TerminologyIn this document, the key words "MUST", "MUST NOT", "REQUIRED","SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY",and "OPTIONAL" are to be interpreted as described in BCP 14, RFC 2119 [1] and indicate requirement levels for compliant STUNimplementations.RFC 3489 STUN March 2003 4. DefinitionsSTUN Client: A STUN client (also just referred to as a client)is an entity that generates STUN requests. A STUN client canexecute on an end system, such as a user's PC, or can run in anetwork element, such as a conferencing server.STUN Server: A STUN Server (also just referred to as a server)is an entity that receives STUN requests, and sends STUNresponses. STUN servers are generally attached to the publicInternet.5. NAT VariationsIt is assumed that the reader is familiar with NATs. It has beenobserved that NAT treatment of UDP varies among implementations. The four treatments observed in implementations are:Full Cone: A full cone NAT is one where all requests from thesame internal IP address and port are mapped to the same external IP address and port. Furthermore, any external host can send apacket to the internal host, by sending a packet to the mappedexternal address.Restricted Cone: A restricted cone NAT is one where all requestsfrom the same internal IP address and port are mapped to the same external IP address and port. Unlike a full cone NAT, an external host (with IP address X) can send a packet to the internal hostonly if the internal host had previously sent a packet to IPaddress X.Port Restricted Cone: A port restricted cone NAT is like arestricted cone NAT, but the restriction includes port numbers.Specifically, an external host can send a packet, with source IPaddress X and source port P, to the internal host only if theinternal host had previously sent a packet to IP address X andport P.Symmetric: A symmetric NAT is one where all requests from thesame internal IP address and port, to a specific destination IPaddress and port, are mapped to the same external IP address andport. If the same host sends a packet with the same sourceaddress and port, but to a different destination, a differentmapping is used. Furthermore, only the external host thatreceives a packet can send a UDP packet back to the internal host.RFC 3489 STUN March 2003 Determining the type of NAT is important in many cases. Depending on what the application wants to do, it may need to take the particular behavior into account.6. Overview of OperationThis section is descriptive only. Normative behavior is described in Sections 8 and 9./-----\// STUN \\| Server |\\ //\-----/+--------------+ Public Internet................| NAT 2 |.......................+--------------++--------------+ Private NET 2................| NAT 1 |.......................+--------------+/-----\// STUN \\| Client |\\ // Private NET 1\-----/Figure 1: STUN ConfigurationThe typical STUN configuration is shown in Figure 1. A STUN clientis connected to private network 1. This network connects to private network 2 through NAT 1. Private network 2 connects to the publicInternet through NAT 2. The STUN server resides on the publicInternet.STUN is a simple client-server protocol. A client sends a request to a server, and the server returns a response. There are two types of requests - Binding Requests, sent over UDP, and Shared SecretRequests, sent over TLS [2] over TCP. Shared Secret Requests ask the server to return a temporary username and password. This usernameand password are used in a subsequent Binding Request and BindingResponse, for the purposes of authentication and message integrity.RFC 3489 STUN March 2003 Binding requests are used to determine the bindings allocated byNATs. The client sends a Binding Request to the server, over UDP.The server examines the source IP address and port of the request,and copies them into a response that is sent back to the client.There are some parameters in the request that allow the client to ask that the response be sent elsewhere, or that the server send theresponse from a different address and port. There are attributes for providing message integrity and authentication.The trick is using STUN to discover the presence of NAT, and to learn and use the bindings they allocate.The STUN client is typically embedded in an application which needsto obtain a public IP address and port that can be used to receivedata. For example, it might need to obtain an IP address and port to receive Real Time Transport Protocol (RTP) [12] traffic. When theapplication starts, the STUN client within the application sends aSTUN Shared Secret Request to its server, obtains a username andpassword, and then sends it a Binding Request. STUN servers can bediscovered through DNS SRV records [3], and it is generally assumedthat the client is configured with the domain to use to find the STUN server. Generally, this will be the domain of the provider of theservice the application is using (such a provider is incented todeploy STUN servers in order to allow its customers to use itsapplication through NAT). Of course, a client can determine theaddress or domain name of a STUN server through other means. A STUN server can even be embedded within an end system.The STUN Binding Request is used to discover the presence of a NAT,and to discover the public IP address and port mappings generated by the NAT. Binding Requests are sent to the STUN server using UDP.When a Binding Request arrives at the STUN server, it may have passed through one or more NATs between the STUN client and the STUN server. As a result, the source address of the request received by the server will be the mapped address created by the NAT closest to the server. The STUN server copies that source IP address and port into a STUNBinding Response, and sends it back to the source IP address and port of the STUN request. For all of the NAT types above, this responsewill arrive at the STUN client.When the STUN client receives the STUN Binding Response, it compares the IP address and port in the packet with the local IP address andport it bound to when the request was sent. If these do not match,the STUN client is behind one or more NATs. In the case of a full-cone NAT, the IP address and port in the body of the STUN responseare public, and can be used by any host on the public Internet tosend packets to the application that sent the STUN request. Anapplication need only listen on the IP address and port from whichRFC 3489 STUN March 2003 the STUN request was sent. Any packets sent by a host on the publicInternet to the public address and port learned by STUN will bereceived by the application.Of course, the host may not be behind a full-cone NAT. Indeed, itdoesn't yet know what type of NAT it is behind. To determine that,the client uses additional STUN Binding Requests. The exactprocedure is flexible, but would generally work as follows. Theclient would send a second STUN Binding Request, this time to adifferent IP address, but from the same source IP address and port.If the IP address and port in the response are different from thosein the first response, the client knows it is behind a symmetric NAT. To determine if it's behind a full-cone NAT, the client can send aSTUN Binding Request with flags that tell the STUN server to send aresponse from a different IP address and port than the request wasreceived on. In other words, if the client sent a Binding Request to IP address/port A/B using a source IP address/port of X/Y, the STUNserver would send the Binding Response to X/Y using source IPaddress/port C/D. If the client receives this response, it knows it is behind a full cone NAT.STUN also allows the client to ask the server to send the BindingResponse from the same IP address the request was received on, butwith a different port. This can be used to detect whether the client is behind a port restricted cone NAT or just a restricted cone NAT.It should be noted that the configuration in Figure 1 is not the only permissible configuration. The STUN server can be located anywhere, including within another client. The only requirement is that theSTUN server is reachable by the client, and if the client is tryingto obtain a publicly routable address, that the server reside on the public Internet.7. Message OverviewSTUN messages are TLV (type-length-value) encoded using big endian(network ordered) binary. All STUN messages start with a STUNheader, followed by a STUN payload. The payload is a series of STUN attributes, the set of which depends on the message type. The STUNheader contains a STUN message type, transaction ID, and length. The message type can be Binding Request, Binding Response, Binding Error Response, Shared Secret Request, Shared Secret Response, or SharedSecret Error Response. The transaction ID is used to correlaterequests and responses. The length indicates the total length of the STUN payload, not including the header. This allows STUN to run over TCP. Shared Secret Requests are always sent over TCP (indeed, using TLS over TCP).RFC 3489 STUN March 2003 Several STUN attributes are defined. The first is a MAPPED-ADDRESSattribute, which is an IP address and port. It is always placed inthe Binding Response, and it indicates the source IP address and port the server saw in the Binding Request. There is also a RESPONSE-ADDRESS attribute, which contains an IP address and port. TheRESPONSE-ADDRESS attribute can be present in the Binding Request, and indicates where the Binding Response is to be sent. It's optional,and when not present, the Binding Response is sent to the source IPaddress and port of the Binding Request.The third attribute is the CHANGE-REQUEST attribute, and it contains two flags to control the IP address and port used to send theresponse. These flags are called "change IP" and "change port"flags. The CHANGE-REQUEST attribute is allowed only in the BindingRequest. The "change IP" and "change port" flags are useful fordetermining whether the client is behind a restricted cone NAT orrestricted port cone NAT. They instruct the server to send theBinding Responses from a different source IP address and port. TheCHANGE-REQUEST attribute is optional in the Binding Request.The fourth attribute is the CHANGED-ADDRESS attribute. It is present in Binding Responses. It informs the client of the source IP address and port that would be used if the client requested the "change IP"and "change port" behavior.The fifth attribute is the SOURCE-ADDRESS attribute. It is onlypresent in Binding Responses. It indicates the source IP address and port where the response was sent from. It is useful for detectingtwice NAT configurations.The sixth attribute is the USERNAME attribute. It is present in aShared Secret Response, which provides the client with a temporaryusername and password (encoded in the PASSWORD attribute). TheUSERNAME is also present in Binding Requests, serving as an index to the shared secret used for the integrity protection of the BindingRequest. The seventh attribute, PASSWORD, is only found in SharedSecret Response messages. The eight attribute is the MESSAGE-INTEGRITY attribute, which contains a message integrity check overthe Binding Request or Binding Response.The ninth attribute is the ERROR-CODE attribute. This is present in the Binding Error Response and Shared Secret Error Response. Itindicates the error that has occurred. The tenth attribute is theUNKNOWN-ATTRIBUTES attribute, which is present in either the Binding Error Response or Shared Secret Error Response. It indicates themandatory attributes from the request which were unknown. Theeleventh attribute is the REFLECTED-FROM attribute, which is present in Binding Responses. It indicates the IP address and port of theRFC 3489 STUN March 2003 sender of a Binding Request, used for traceability purposes toprevent certain denial-of-service attacks.8. Server BehaviorThe server behavior depends on whether the request is a BindingRequest or a Shared Secret Request.8.1 Binding RequestsA STUN server MUST be prepared to receive Binding Requests on fouraddress/port combinations - (A1, P1), (A2, P1), (A1, P2), and (A2,P2). (A1, P1) represent the primary address and port, and these are the ones obtained through the client discovery procedures below.Typically, P1 will be port 3478, the default STUN port. A2 and P2are arbitrary. A2 and P2 are advertised by the server through theCHANGED-ADDRESS attribute, as described below.It is RECOMMENDED that the server check the Binding Request for aMESSAGE-INTEGRITY attribute. If not present, and the server requires integrity checks on the request, it generates a Binding ErrorResponse with an ERROR-CODE attribute with response code 401. If the MESSAGE-INTEGRITY attribute was present, the server computes the HMAC over the request as described in Section 11.2.8. The key to usedepends on the shared secret mechanism. If the STUN Shared SecretRequest was used, the key MUST be the one associated with theUSERNAME attribute present in the request. If the USERNAME attribute was not present, the server MUST generate a Binding Error Response.The Binding Error Response MUST include an ERROR-CODE attribute with response code 432. If the USERNAME is present, but the serverdoesn't remember the shared secret for that USERNAME (because ittimed out, for example), the server MUST generate a Binding ErrorResponse. The Binding Error Response MUST include an ERROR-CODEattribute with response code 430. If the server does know the shared secret, but the computed HMAC differs from the one in the request,the server MUST generate a Binding Error Response with an ERROR-CODE attribute with response code 431. The Binding Error Response is sent to the IP address and port the Binding Request came from, and sentfrom the IP address and port the Binding Request was sent to.Assuming the message integrity check passed, processing continues.The server MUST check for any attributes in the request with valuesless than or equal to 0x7fff which it does not understand. If itencounters any, the server MUST generate a Binding Error Response,and it MUST include an ERROR-CODE attribute with a 420 response code.RFC 3489 STUN March 2003 That response MUST contain an UNKNOWN-ATTRIBUTES attribute listingthe attributes with values less than or equal to 0x7fff which werenot understood. The Binding Error Response is sent to the IP address and port the Binding Request came from, and sent from the IP address and port the Binding Request was sent to.Assuming the request was correctly formed, the server MUST generate a single Binding Response. The Binding Response MUST contain the same transaction ID contained in the Binding Request. The length in themessage header MUST contain the total length of the message in bytes, excluding the header. The Binding Response MUST have a message type of "Binding Response".The server MUST add a MAPPED-ADDRESS attribute to the BindingResponse. The IP address component of this attribute MUST be set to the source IP address observed in the Binding Request. The portcomponent of this attribute MUST be set to the source port observedin the Binding Request.If the RESPONSE-ADDRESS attribute was absent from the BindingRequest, the destination address and port of the Binding ResponseMUST be the same as the source address and port of the BindingRequest. Otherwise, the destination address and port of the Binding Response MUST be the value of the IP address and port in theRESPONSE-ADDRESS attribute.The source address and port of the Binding Response depend on thevalue of the CHANGE-REQUEST attribute and on the address and port the Binding Request was received on, and are summarized in Table 1.Let Da represent the destination IP address of the Binding Request(which will be either A1 or A2), and Dp represent the destinationport of the Binding Request (which will be either P1 or P2). Let Ca represent the other address, so that if Da is A1, Ca is A2. If Da is A2, Ca is A1. Similarly, let Cp represent the other port, so that if Dp is P1, Cp is P2. If Dp is P2, Cp is P1. If the "change port"flag was set in CHANGE-REQUEST attribute of the Binding Request, and the "change IP" flag was not set, the source IP address of theBinding Response MUST be Da and the source port of the BindingResponse MUST be Cp. If the "change IP" flag was set in the Binding Request, and the "change port" flag was not set, the source IPaddress of the Binding Response MUST be Ca and the source port of the Binding Response MUST be Dp. When both flags are set, the source IP address of the Binding Response MUST be Ca and the source port of the Binding Response MUST be Cp. If neither flag is set, or if theCHANGE-REQUEST attribute is absent entirely, the source IP address of the Binding Response MUST be Da and the source port of the BindingResponse MUST be Dp.RFC 3489 STUN March 2003 Flags Source Address Source Port CHANGED-ADDRESSnone Da Dp Ca:CpChange IP Ca Dp Ca:CpChange port Da Cp Ca:CpChange IP andChange port Ca Cp Ca:CpTable 1: Impact of Flags on Packet Source and CHANGED-ADDRESSThe server MUST add a SOURCE-ADDRESS attribute to the BindingResponse, containing the source address and port used to send theBinding Response.The server MUST add a CHANGED-ADDRESS attribute to the BindingResponse. This contains the source IP address and port that would be used if the client had set the "change IP" and "change port" flags in the Binding Request. As summarized in Table 1, these are Ca and Cp, respectively, regardless of the value of the CHANGE-REQUEST flags.If the Binding Request contained both the USERNAME and MESSAGE-INTEGRITY attributes, the server MUST add a MESSAGE-INTEGRITYattribute to the Binding Response. The attribute contains an HMAC[13] over the response, as described in Section 11.2.8. The key touse depends on the shared secret mechanism. If the STUN SharedSecret Request was used, the key MUST be the one associated with the USERNAME attribute present in the Binding Request.If the Binding Request contained a RESPONSE-ADDRESS attribute, theserver MUST add a REFLECTED-FROM attribute to the response. If theBinding Request was authenticated using a username obtained from aShared Secret Request, the REFLECTED-FROM attribute MUST contain the source IP address and port where that Shared Secret Request camefrom. If the username present in the request was not allocated using a Shared Secret Request, the REFLECTED-FROM attribute MUST containthe source address and port of the entity which obtained theusername, as best can be verified with the mechanism used to allocate the username. If the username was not present in the request, andthe server was willing to process the request, the REFLECTED-FROMattribute SHOULD contain the source IP address and port where therequest came from.The server SHOULD NOT retransmit the response. Reliability isachieved by having the client periodically resend the request, eachof which triggers a response from the server.。

nats高可用原理

nats高可用原理

nats高可用原理NATS(全称为“Nano Messaging System”)是一种高性能、可扩展性和高可用性的消息传递系统。

它提供了一种简单而有效的机制来在不同的应用程序之间传递信息。

NATS的高可用性主要依赖于以下几个原理:1.集群化:NATS通过在不同的服务器上构建集群来实现高可用性。

每个NATS服务器都是一个相互连接的节点,其中的消息复制和路由算法确保了系统的可用性。

当一个节点发生故障时,集群中的其他节点可以继续运行,确保消息的可靠性。

2.主从架构:NATS集群中的服务器被配置为主节点和从节点。

主节点负责接收和处理消息,而从节点则负责对主节点进行备份,并在主节点失效时接管工作。

这种主从架构确保了服务的高可靠性和高可用性。

3. 容错机制:NATS使用基于Raft算法的选主机制来实现容错。

Raft算法确保了即使在主节点故障的情况下,集群中的其他节点可以选择一个新的主节点,并继续提供服务。

这种容错机制可以有效地防止单点故障,并确保系统的高可用性。

4.消息复制:NATS使用消息复制来确保消息的可靠性和一致性。

当一个消息发送给NATS集群时,它会被复制到集群中的多个节点,以防止消息丢失。

一旦消息被复制到集群中的多个节点,它可以被任何一个节点接收和处理,从而确保了消息的可靠性。

5.动态路由:NATS通过动态路由机制来保证消息的可靠传递。

当一个消息通过NATS集群传递时,它会根据路由表找到最佳的节点进行传递。

如果一个节点发生故障,集群中的其他节点会自动调整路由表,以保证消息的顺利传递。

6.心跳检测:NATS使用心跳检测来监测节点的健康状况。

每个节点都会定期发送心跳信号,以通知其他节点它的状态。

如果一个节点停止发送心跳信号,其他节点会立即将其标记为故障,并执行相应的恢复策略,以保证系统的高可用性。

7.异步通信:NATS采用异步通信模式,可以并发处理大量的消息。

这种异步通信模式不仅提高了系统的性能,还提高了系统的可扩展性和可用性。

nats 集群原理

nats 集群原理

nats 集群原理NATS(Nano Messaging System)是一种基于消息传递的开源消息队列系统,由Derek Collison开发。

它使用Go语言编写,是一个轻量级、高性能、可靠的消息传递系统,用于构建分布式系统中的可扩展和弹性的消息传递基础架构。

NATS集群是NATS系统的一种部署方式,它通过将多个NATS服务器组成一个集群来提高系统的可靠性和可扩展性。

NATS集群采用了一种主从模式,其中一个节点作为主节点(也称为路由节点),负责接收和路由消息,而其他节点则作为从节点,负责处理订阅和发布消息。

所有的节点通过互相通信来实现消息的传递和同步。

NATS集群的工作原理如下:1. 路由节点选举:当一个新的节点加入集群时,集群会自动进行路由节点的选举。

选举过程中,每个节点都会向集群发送选举请求,集群会根据节点的优先级和可用性来选择一个节点作为主节点。

选举完成后,集群会将选举结果通知给所有的节点。

2. 消息路由:当一个发布者发送消息时,消息会首先发送给主节点。

主节点会根据消息的主题(topic)来确定消息应该发送给哪些订阅者。

主节点会将消息复制到其他从节点,并将其路由给对应的订阅者。

3. 消息同步:当一个从节点加入或离开集群时,集群会自动进行消息同步。

同步过程中,主节点会将缺失的消息发送给从节点,以保证所有的节点都拥有相同的消息副本。

同步完成后,从节点可以继续处理订阅和发布消息。

4. 故障恢复:当主节点发生故障时,集群会自动进行故障恢复。

集群会选举一个新的主节点来接替故障的节点,并将消息路由和同步功能转移到新的主节点上。

故障恢复过程中,集群会保证消息的可靠性和一致性。

NATS集群具有以下特点:1. 高性能:NATS集群采用了高效的消息传递机制,能够在低延迟和高吞吐量的情况下处理大量的消息。

它使用了轻量级的协议和高效的编码方式,以提高系统的性能和效率。

2. 可靠性:NATS集群通过复制和同步机制来保证消息的可靠性和一致性。

nats 高可用原理

nats 高可用原理

nats 高可用原理Nats(NATS Streaming)是一种轻量级、可靠的消息传递系统,它基于发布/订阅模式,通过高效的消息传递机制,实现了高可用性。

本文将介绍 Nats 高可用原理,探讨其核心技术和应用场景。

一、Nats 简介Nats 是由 Cloud Native Computing Foundation(CNCF)孵化的一个开源项目,它作为一种高性能、安全可靠的消息系统,被广泛应用于云原生开发和微服务架构中。

Nats 的设计理念是简单、轻量级,以及快速可靠的消息传递。

Nats 具有以下特点:1. 高性能:Nats 通过减少消息传递的开销,实现了非常快速的消息传递。

其轻量级的设计和优秀的性能表现使其在大规模应用中表现突出。

2. 可靠性:Nats 引入了持久化消息存储机制,确保消息不会丢失。

它使用日志持久化存储方案,保证了数据的持久性和数据的可靠性。

3. 可伸缩性:Nats 支持横向扩展和集群模式,可以通过增加节点来支持更多的消息并发量和更高的可用性。

4. 安全性:Nats 支持TLS/SSL传输协议、认证和授权机制,保障消息传递的安全性。

二、Nats 高可用原理Nats 实现高可用的关键在于其集群模式和冗余机制。

1. 集群模式:Nats 支持构建具有多个集群节点的集群,每个节点都具有相同的权限和功能。

在集群中,节点之间通过互联网互相通信,实现消息的传递和同步。

当集群中的某个节点接收到消息后,它会将该消息广播给集群中的其他节点,从而实现消息的多播传递。

这种多播传递方式保证了消息在整个集群中的可靠性和一致性。

2. 冗余机制:为了提高系统的可用性,Nats 集群中的每个节点都具有相同的数据副本。

当某个节点发生故障或者失效时,系统会自动将其它节点上的消息副本提升为主节点,保证消息服务的连续性。

这种冗余机制使得 Nats 能够容忍节点故障,并且无需人工干预即可实现自动故障转移。

三、应用场景Nats 作为一种高性能、可靠的消息传递系统,被广泛应用于以下场景:1. 微服务架构:Nats 可以作为微服务架构中各个服务之间的消息中间件,实现服务之间的有效通信和协作。

nats 集群原理

nats 集群原理

nats 集群原理NATS集群原理NATS(全称为"Lightweight and High Performance Messaging System")是一种轻量级、高性能的消息传递系统,广泛应用于云原生、微服务、物联网等领域。

NATS具有简单、可靠、高效的特点,通过集群模式可以实现消息的可扩展性和高可用性。

一、NATS集群概述NATS集群是由多个NATS服务器组成的分布式系统,用于处理大规模消息传递。

在NATS集群中,每个服务器都是对等的,它们共享相同的主题(subject)和队列组(queue group)信息。

当一个客户端发布消息时,NATS集群会将消息广播到所有订阅了相应主题的客户端。

二、NATS集群协议NATS集群采用了一种称为"route"的协议,用于实现不同服务器之间的消息路由。

每个NATS服务器都会建立与其他服务器的连接,通过这些连接来交换消息和集群信息。

通过路由协议,NATS集群中的每个服务器都能了解到其他服务器的存在,并能够自动发现新的服务器。

三、NATS集群中的消息路由在NATS集群中,消息的路由是通过主题(subject)来实现的。

当一个客户端发布一条消息到某个主题时,NATS集群会将该消息广播到所有订阅了该主题的客户端。

这种发布-订阅模式保证了消息的可扩展性和高可用性。

四、NATS集群中的队列组除了主题订阅,NATS还支持队列组(queue group)的概念。

一个队列组包含多个客户端,它们共享同一个订阅主题。

当一个消息被发送到队列组时,只有其中一个客户端会接收到该消息,这样可以实现消息的负载均衡。

五、NATS集群中的消息可靠性NATS集群通过持久化存储来保证消息的可靠性。

当一个消息被发送到NATS集群时,它会被持久化存储,即使在服务器故障后,消息也不会丢失。

一旦服务器恢复正常,它会重新连接到集群,并从持久化存储中恢复未传递的消息。

RCNA考证题库5

RCNA考证题库5

RCNA考证题库5=====================================================================================项⽬五⽹络安全配置任务20 标准ACL访问控制列表实验⼀(编号⽅式)=====================================================================================⼀、单项选择题:1.下列所述的配置中,哪⼀个是允许来⾃⽹段172.16.0.0/16的数据包进⼊路由器的serial1/0()?CA.Router(config)#access-list 10 permit 172.16.0.0 0.0.255.255Router (config)#interface s1/0 Router (config-if)#ip access-group 10 outB.Router(config)##access-group 10 permit 172.16.0.0 255.255.0.0Router(config)#interface s1/0 Router(config-if)##ip access-list 10 outC.Router(config)#access-list 10 permit 172.16.0.0 0.0.255.255Router(config)#interface s1/0 Router(config-if)#ip access-group 10 inD.Router(config)##access-list 10 permit 172.16.0.0 .255.255.0.0Router(config)#interface s1/0 Router(config-if)#ip access-group 10 in2.你决定⽤⼀个标准ip访问列表来做安全控制,以下为标准访问列表的例⼦是:CA.access-list standart 192.168.10.23B.access-list 10 denyC.access-list 10 deny 192.168.10.23 0.0.0.0D.access-list 101 deny 192.168.10.23 0.0.0.0E.access-list 101 deny 192.168.10.23 255.255.255.2553.标准ACL以什么作为判别条件?CA.数据包⼤⼩B.数据包的端⼝号C.数据包的源地址D.数据包的⽬的地址⼆、多项选择题:1.RGOS⽀持以下哪⼏种ACL?ABCDA.标准IP ACLB.扩展IP ACLC.MAC ACLD.专家ACL===================================================================================== 任务21 标准ACL访问控制列表实验⼆(命名⽅式)=====================================================================================⼀、单项选择题:1.IP访问控制列表分为()两类 CA.标准访问控制列表和⾼级访问控制列表B.初级访问控制列表和扩展访问控制列表C.标准访问控制列表和扩展访问控制列表D.初级访问控制列表和⾼级访问控制列表2.你的电脑中毒了,通过抓包软件,你发现本机的⽹卡在不断向外发⽬的端⼝为8080的数据包,这时如果在接⼊交换机上做阻⽌病毒的配置,则应采取什么技术?BA.标准ACLB.扩展ACLC.端⼝安全D.NAT⼆、多项选择题:1.在⼀台出⼝路由器上⽤命名⽅式定义了如下规则:Router(config)# ip access-list standard aaaRouter(config-std-nacl)#deny 172.16.1.0 0.0.0.255Router(config-std-nacl)#deny host 172.16.2.5Router(config-std-nacl)#permit 172.16.2.0 0.0.0.255Router(config-std-nacl)#permit any请问在出⼝应⽤后,下⾯说法正确的是?ACA.所有172.16.1.0⼦⽹都不能上外⽹B.所有172.16.2.0⼦⽹都能上外⽹C.所有172.16.2.0⼦⽹都能上外⽹,除了172.16.2.5主机D.所有172.16.1.0⼦⽹都不能上外⽹,除了172.16.1.5主机=====================================================================================任务22 扩展ACL访问控制列表实验⼀(编号⽅式)=====================================================================================⼀、单项选择题:1.下⾯能够表⽰“禁⽌从129.9.0.0⽹段中的主机建⽴与202.38.16.0⽹段内的主机的WWW端⼝的连接”的访问控制列表是?AA.access-list 101 deny tcp 129.9.0.0 0.0.255.255 202.38.16.0 0.0.0.255 eq wwwB.access-list 100 deny tcp 129.9.0.0 0.0.255.255 202.38.16.0 0.0.0.255 eq 53C.access-list 100 deny udp 129.9.0.0 0.0.255.255 202.38.16.0 0.0.0.255 eq wwwD.access-list 99 deny ucp 129.9.0.0 0.0.255.255 202.38.16.0 0.0.0.255 eq 802.在访问控制列表中,有⼀条规则如下:Caccess-list 131 permit ip any 192.168.10.0 0.0.0.255 eq ftp在该规则中,any的意思是表⽰()?A.检查源地址的所有bit位B.检查⽬的地址的所有bit位C.允许所有的源地址D.允许255.255.255.255 0.0.0.03.下列哪个访问列表范围符合IP扩展访问控制列表?BA.1-99B.100-199C.800-899D.900-9994.在下图所⽰的⽹络中,使⽤OSPF作为路由协议,并且始终运⾏良好。

Hillstone认证安全工程师HCSA认证培训hcsa题库

Hillstone认证安全工程师HCSA认证培训hcsa题库

1.HiI1Stone安全网络设备具备的功能:A数据转发BNATCVPNDQOSF访问控制与攻击防护2.StoneOS系统架构由(接口)、(安全域)、(VSwitch)和(VRoUter)组成,他们之间的关系:A接口绑定到安全域。

B安全域绑定到VSwitch或者VROUtero二层安全域绑定到VSwitch,三层安全域绑定到VRouter o3.介绍StoneOS处理包的F1OWS过程。

目的NAT操作一•路由查询一源NAT操作一策略查询路由查询(策略路由PBR-源接口路由SIBR一源路由SBR…目的路由DBR-ISP路由)策略查询(系统根据数据包的源安全域、目的安全域、源IP地址和端口号、目的IP地址和端口号以及协议,查找策略规则)数据包的处理动作:允许、拒绝、隧道、来自隧道WEB认证4.如何通过ConSoIe口对安全网关进行设备管理?超级终端:波特率960ObPS数据位8bit停止位1no流量控制通过网络线缆管理(Te1net、SSH›HTTP、HTTPS ip:192.168.1.1)5.命令行下,如何配置接口IP地址?进入接口模式、绑定接口到安全域、配置接口IP地址Zoneuntrust6.山石防火墙的配置模式A执行模式#B全局配置模式config#C子模块配置模式config-if-ethO^))7.如何开启从外网接口登录安全网关?8.安全网关恢复出厂配置的方法?C1i命令unseta11WEBU1i系统管理一配置文件管理——备份还原导向一恢复出厂配置硬件C1RSta灯和a1m灯为红色9、安全网关保存文件的命令SAVE10、查看安全网关当前配置文件内容的方法showconfiguration11、如何回退到以前保存的配置ro11backconfigurationbackup(配置文件号0-8)12、升级系统Image(StoneOS)的方法系统管理一一版本升级安全网关可以保存10个配置文件(0-8)2个系统固件13、安全网关产品中1iCenSe的作用:许可证分为:平台1iCenSe、服务1iCenSe、#141icenseStoneOS支持的许可证类型包含:试用许可证、正式许可证、扩展许可证许可证用来管理和控制H11IStone安全网关的部分功能以及服务的使用、特性和容量的扩展平台许可证分试用许可(15天)和标准许可14、安全网关启动系统分为3个部分BoOt1oader(力口电)、Sys1oader>Stoneos15、安全网关支持一下几种工作模式1、路由应用模式2、透明应用模式3、混合应用模式16Hi1IStone产品采用什么样的硬件架构:多核17、StoneOS操作系统:64位18、新设备性能参数X6150吞吐量IoogbPSTCP新建连接IOO万最大并发5000万VPN吞吐量42bpsX6180吞吐量IOogbPSTCP新建连接180万最大并发6000万VPN吞吐量72bpsM8260吞吐量32gbpsTCP新建连接25万最大并发800万VPN吞吐量IObpsM8860吞吐量40gbpsTCP新建连接40万最大并发1000万VPN吞吐量18bps19安全网关支持什么类型的VPNIPSeeVPN z SS1Vpn,12TPvpn(不支持MP1SVPN Z)20安全网关的逻辑借口:子接口、VSWitCh接口V1an接口、回环接口、隧道接口、集聚接口、冗余接口21、Hi11StOne产品同步时间的意义:VPN协商,时间表22、如何通WEB导入导出设置:系统管理——配置文件管理22、HiIIStone安全网关支持哪些类型的路由:静态路由(目的路由)源路由(SBR z SIBR)策略路由(Po1iCy-Basedrounting)23、Hi1IStOne安全网关支持哪些动态路由协议RIP,OSPF,BGP25、安全网关默认启用逆向路由没有逆向路由的时候就丢弃26、安全策略由那几个部分组成:过滤条件和行为27、安全策略执行的顺序:由上到下,找到的第一条与过滤条件匹配28状态检测与包过滤的不同29、内网用户上网采用那种方式的NAT:SNAT30、何种环境需要使用基于端口的DNAT而非基于IPDNAT:公网地址不够用时31:对外发布服务器是访问策略的IP如何配置:公网iP32、unknow策略作用:登录认证,防止重复认证33、ARP攻击防护的方法:arp认证、检查,绑定,DHCP监控、主机防御34、防御ICMP,UDP,SYN,ARPF1OOD¾⅛35日志输出方式:Cors1e,终端、缓存、文件、日志服务器、emai1、本地数据库36、Qos嵌套的作用:细粒度控制37:弹性QOS作用:网络空闲时充分分配38、基于IP的QoS支持带宽:预留,最大39指定宽带借口原因:得到实际带宽利用率40:QOS分为基于IP的基于角色基于应用的41:配置SITE2SITE步骤:42、1、邮件过滤功能对何种协议进行过滤?答、SMTP2、如果阻断到某类网站的访问,而对该类别某一个网站允许访问,是否可以实现?答:是3、Hi11stone安全网关可以支持对哪些协议进行病毒过滤?答:POP3、HTTP、SMTP、IMAP4以及FTP.4、Hi1IStOne安全网关采用何种病毒库?答:卡巴斯基5、描述QoS嵌套的作用?6、描述弹性QoS作用?。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Internet Engineering Task Force (IETF) D. MacDonald Request for Comments: 5780 B. Lowekamp Category: Experimental Skype ISSN: 2070-1721 May 2010 NAT Behavior Discovery Using Session Traversal Utilities for NAT (STUN) AbstractThis specification defines an experimental usage of the SessionTraversal Utilities for NAT (STUN) Protocol that discovers thepresence and current behavior of NATs and firewalls between the STUN client and the STUN server.Status of This MemoThis document is not an Internet Standards Track specification; it is published for examination, experimental implementation, andevaluation.This document defines an Experimental Protocol for the Internetcommunity. This document is a product of the Internet EngineeringTask Force (IETF). It represents the consensus of the IETFcommunity. It has received public review and has been approved forpublication by the Internet Engineering Steering Group (IESG). Notall documents approved by the IESG are a candidate for any level ofInternet Standard; see Section 2 of RFC 5741.Information about the current status of this document, any errata,and how to provide feedback on it may be obtained at/info/rfc5780.MacDonald & Lowekamp Experimental [Page 1]Copyright NoticeCopyright (c) 2010 IETF Trust and the persons identified as thedocument authors. All rights reserved.This document is subject to BCP 78 and the IETF Trust’s LegalProvisions Relating to IETF Documents(/license-info) in effect on the date ofpublication of this document. Please review these documentscarefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e ofthe Trust Legal Provisions and are provided without warranty asdescribed in the Simplified BSD License.This document may contain material from IETF Documents or IETFContributions published or made publicly available before November10, 2008. The person(s) controlling the copyright in some of thismaterial may not have granted the IETF Trust the right to allowmodifications of such material outside the IETF Standards Process.Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modifiedoutside the IETF Standards Process, and derivative works of it maynot be created outside the IETF Standards Process, except to formatit for publication as an RFC or to translate it into languages other than English.MacDonald & Lowekamp Experimental [Page 2]Table of Contents1. Applicability . . . . . . . . . . . . . . . . . . . . . . . . 41.1. Requirements Language . . . . . . . . . . . . . . . . . . 52. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . 6 2.1. Example Diagnostic Use . . . . . . . . . . . . . . . . . . 6 2.2. Example Use with P2P Overlays . . . . . . . . . . . . . . 72.3. Experimental Goals . . . . . . . . . . . . . . . . . . . . 83. Overview of Operations . . . . . . . . . . . . . . . . . . . . 9 3.1. Determining NAT Mapping . . . . . . . . . . . . . . . . . 10 3.2. Determining NAT Filtering . . . . . . . . . . . . . . . . 10 3.3. Binding Lifetime Discovery . . . . . . . . . . . . . . . . 10 3.4. Diagnosing NAT Hairpinning . . . . . . . . . . . . . . . . 11 3.5. Determining Fragment Handling . . . . . . . . . . . . . . 113.6. Detecting a Generic Application Level Gateway (ALG) . . . 114. Discovery Process . . . . . . . . . . . . . . . . . . . . . . 11 4.1. Source Port Selection . . . . . . . . . . . . . . . . . . 12 4.2. Checking for UDP Connectivity with the STUN Server . . . . 13 4.3. Determining NAT Mapping Behavior . . . . . . . . . . . . . 14 4.4. Determining NAT Filtering Behavior . . . . . . . . . . . . 14 4.5. Combining and Ordering Tests . . . . . . . . . . . . . . . 154.6. Binding Lifetime Discovery . . . . . . . . . . . . . . . . 155. Client Behavior . . . . . . . . . . . . . . . . . . . . . . . 17 5.1. Discovery . . . . . . . . . . . . . . . . . . . . . . . . 175.2. Security . . . . . . . . . . . . . . . . . . . . . . . . . 186. Server Behavior . . . . . . . . . . . . . . . . . . . . . . . 186.1. Preparing the Response . . . . . . . . . . . . . . . . . . 187. New Attributes . . . . . . . . . . . . . . . . . . . . . . . . 20 7.1. Representing Transport Addresses . . . . . . . . . . . . . 21 7.2. CHANGE-REQUEST . . . . . . . . . . . . . . . . . . . . . . 21 7.3. RESPONSE-ORIGIN . . . . . . . . . . . . . . . . . . . . . 21 7.4. OTHER-ADDRESS . . . . . . . . . . . . . . . . . . . . . . 22 7.5. RESPONSE-PORT . . . . . . . . . . . . . . . . . . . . . . 227.6. PADDING . . . . . . . . . . . . . . . . . . . . . . . . . 228. IAB Considerations . . . . . . . . . . . . . . . . . . . . . . 23 8.1. Problem Definition . . . . . . . . . . . . . . . . . . . . 23 8.2. Exit Strategy . . . . . . . . . . . . . . . . . . . . . . 23 8.3. Brittleness Introduced by STUN NAT Behavior Discovery . . 24 8.4. Requirements for a Long-Term Solution . . . . . . . . . . 248.5. Issues with Existing NAPT Boxes . . . . . . . . . . . . . 249. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 25 9.1. STUN Attribute Registry . . . . . . . . . . . . . . . . . 259.2. Port Numbers and SRV Registry . . . . . . . . . . . . . . 2510. Security Considerations . . . . . . . . . . . . . . . . . . . 2511. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . 2612. References . . . . . . . . . . . . . . . . . . . . . . . . . . 26 12.1. Normative References . . . . . . . . . . . . . . . . . . . 26 12.2. Informative References . . . . . . . . . . . . . . . . . . 27 MacDonald & Lowekamp Experimental [Page 3]1. ApplicabilityThis experimental NAT Behavior Discovery STUN usage providesinformation about a NAT device’s observable transient behavior; itdetermines a NAT’s behavior with regard to the STUN server used andthe particular client ports used at the instant the test is run.This STUN usage does not allow an application behind a NAT to make an absolute determination of the NAT’s characteristics. NAT devices do not behave consistently enough to predict future behavior with anyguarantee. Applications requiring reliable reach between twoparticular endpoints must establish a communication channel throughNAT using another technique. IETF has proposed standards including[RFC5245] and [RFC5626] for establishing communication channels when a publicly accessible rendezvous service is available.The uses envisioned for the STUN attributes included in this document are diagnostics and real-time tuning of applications. For example,determining what may work and should be tried first compared to more expensive methods. The attributes can also be used to observebehaviors that causes an application’s communication to fail, thusenabling better selection of methods of recovery. The STUNattributes could also be a basis for a network technician’sdiagnostics tool to observe NAT behavior.This document proposes experimental usage of these attributes forreal-time optimization of parameters for protocols in situationswhere a publicly accessible rendezvous service is not available.Such a use of these techniques is only possible when the results are applied as an optimization and a reliable fallback is available incase the NAT’s behavior becomes more restrictive than determined bythe Behavior Discovery tests. One possible application is roleselection in peer-to-peer (P2P) networks based on statisticalexperience with establishing direct connections and diagnosing NATbehavior with a variety of peers. The experimental question iswhether such a test is useful. Consider a node that tries to join an overlay as a full peer when its NAT prevents sufficient connectivity; joining and withdrawing from the overlay might be expensive and/orlead to unreliable or poorly performing operations. Even if thebehavior discovery check is only "correct" 75% of the time, itsrelative cheapness may make it very useful for optimizing thebehavior of the overlay network. Section 2.2 describes thisexperimental application in more detail and discusses how to evaluate its success or failure.The applications of this STUN usage differ from the original use ofSTUN (originally RFC 3489 [RFC3489], now RFC 5389 [RFC5389]). Thisspecification acknowledges that the information gathered in this MacDonald & Lowekamp Experimental [Page 4]usage is not, and cannot be, correct 100% of the time, whereas STUNfocused only on getting information that could be known to be correct and static.This specification can also be compared to ICE. ICE requires afallback to TURN be available whereas RFC 3489 based applicationstried to determine in advance whether they would need a relay andwhat their peer reflexive address will be, which is not generallyachievable.This STUN usage requires an application using it to have a fallback. However, unlike ICE’s focus on the problems inherent in VoIPsessions, this STUN usage doesn’t assume that it will be used toestablish a connection between a single pair of machines, soalternative fallback mechanisms may be available.For example, in a P2P application it may be possible to simply switch out of the role where such connections need to be established or toselect an alternative indirect route if the peer discovers that, inpractice, 10% of its connection attempts fail.It is submitted to the Internet community as an experimental protocol that, when applied with appropriate statistical underpinnings andapplication behavior that is ultimately based on experiencedconnectivity patterns, can lead to more stability and increasedperformance than is available without the knowledge it provides.If a Standards Track document specifies the use of any portion ofthis STUN usage, that document MUST describe how incorrectinformation derived using these methods will be managed, eitherthrough identifying when a NAT’s behavior changed or because theprotocol uses such knowledge as an optimization but remainsfunctional when the NAT’s behavior changes. The referencing document MUST also define when the fallback mechanism will be invoked.Applications in different domains may vary greatly in howaggressively the fallback mechanism is utilized, so there must be aclear definition of when the fallback mechanism is invoked.1.1. Requirements LanguageThe key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT","SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119]. MacDonald & Lowekamp Experimental [Page 5]2. Introduction"Session Traversal Utilities for NAT (STUN)" [RFC5389] provides amechanism to discover the reflexive transport address toward the STUN server, using the Binding Request. This specification defines theNAT Behavior Discovery STUN usage, which allows a STUN client toprobe the current behavior of the NAT/firewall (NAT/FW) devicesbetween the client and the STUN server. This usage defines new STUN attributes for the Binding Request and Binding Response.Many NAT/FW devices do not behave consistently and will change their behavior under load and over time. Applications requiring highreliability must be prepared for the NAT’s behavior to become morerestrictive. Specifically, it has been found that under load NATsmay transition to the most restrictive filtering and mapping behavior and shorten the lifetime of new and existing bindings. In short,applications can discover how bad things currently are, but not howbad things will get.Despite this limitation, instantaneous observations are often quiteuseful in troubleshooting network problems, and repeated tests overtime, or in known load situations, may be used to characterize aNAT’s behavior. In particular, in the hands of a personknowledgeable about the needs of an application and the nodes anapplication needs to communicate with, it can be a powerful tool.2.1. Example Diagnostic UseApplications that work well in the lab, but fail in a deployment, are notoriously common within distributed systems. There are few systems developers who have not had the experience of searching to determine the difference in the environments for insight as to what real-network behavior was missed in the testing lab. The BehaviorDiscovery usage offers a powerful tool that can be used to check NAT and firewall behavior as the application is running. For example, an application could be designed to perform Behavior Discovery testswhenever it experiences significant communications problems whenrunning. Such analysis might be included as part of the diagnosticinformation logged by the application.As they are being used to detect instantaneous behavior for analysis by an experienced developer or administrator, there are relativelyfew concerns about this application of the NAT Behavior DiscoverySTUN usage. However, the user should be aware thato adding new traffic to new destinations (STUN servers) has thepotential to itself change the behavior of a NAT andMacDonald & Lowekamp Experimental [Page 6]o the user must be careful to select a STUN server that isappropriately located, ideally collocated (or even integrated)with the communication partners of the application in question,for the results to be applicable to the network conditionsexperienced by the application.2.2. Example Use with P2P OverlaysAn application could use Behavior Discovery in a P2P protocol todetermine if a particular endpoint is a reasonable candidate toparticipate as a peer or supernode (defined here as a peer in theoverlay that offers services, including message routing, to othermembers or clients of the overlay network). This P2P networkapplication is willing to select supernodes that might be locatedbehind NATs to avoid the cost of dedicated servers. A supernodecandidate requires that its NAT or NATs offer Endpoint-IndependentFiltering. It might periodically re-run tests and would removeitself as a supernode if its NAT/FW chain lost this characteristic.These tests could be run with other supernodes acting as STUN servers as well as with dedicated STUN servers. As many P2P algorithmstolerate non-transitive connectivity between a portion of theirpeers, guaranteed pair-wise reliable reach might be sacrificed inorder to distribute the P2P overlay’s load across peers that can bedirectly contacted by the majority of users.Consider an example from a hypothetical P2P protocol in more detail: when P2P node A starts up, it tests its NAT(s) relative to otherpeers already in the overlay. If the results of its testing indicate A is behind a "good" NAT (with Endpoint-Independent Mapping andFiltering), A will join the overlay and establish connections withappropriate peers in the overlay to join the overlay’s topology.Although A is reachable by routing messages across the overlaytopology, A will also include in its communication with other nodesthat they may reach it directly using its reflexive IP address (oraddresses) that A discovered in its initial testing. Suppose thatlater, node B wants to send a message to A, and B is not a neighborof A in the overlay topology. B may send the message directly to A’s IP address and start a timer. If B doesn’t receive a response within a certain amount of time, then it routes the message to A across the overlay instead and includes a flag that indicates a directconnection was attempted but failed. (Alternatively, B couldsimultaneously send the message to A’s IP address across the overlay, which guarantees minimum response latency, but can waste bandwidth.) Over time, A observes the percentage of successful direct messages it receives out of those attempted. If the percentage of successfuldirect connections is below some threshold (perhaps 75%), then A may stop advertising for direct connections because it has determined in practice that its NATs are not providing sufficiently reliable MacDonald & Lowekamp Experimental [Page 7]connectivity to justify the cost of attempting the direct message.But if the percentage is high enough, A continues to advertisebecause the successful direct connections are improving the overlay’s performance by reducing the routing load imposed on the overlay. If at some point, A’s NAT or NATs change behavior, A will notice achange in its percentage of successful direct connections and may re- evaluate its decision to advertise a public address. In thishypothetical example, behavior discovery is used for A’s initialoperating mode selection, but the actual decision for whether tocontinue advertising that public IP/port pair is made based on actual operating data. The results of the Behavior Discovery usage are also used as a performance optimization, as A is at all times able toestablish connectivity through the overlay if the attempted directconnection fails.Use of behavior discovery for such an application requires:o Use of a protocol capable of offering reliable end-userperformance while using unreliable links between pairs of nodes.o A protocol offering a reliable fallback to connections attemptedbased on the results of Behavior Discovery probing.o The application is deployed behind NATs that provide Endpoint-Independent Filtering and that remain in this mode for an amountof time sufficient for the application to identify their behavior, distribute this information to the rest of the overlay, andprovide useful work for the application.This document is experimental as applications implementing openprotocols have yet to be deployed in such environments to demonstrate that these three requirements have been met. However, anecdotalevidence suggests that NATs targeted at households and smallbusinesses have stable behavior, especially when there are fewclients behind them. Numerous P2P applications have been deployedthat appear to have these properties, although their protocols havenot yet been subjected to rigorous evaluation by standards bodies.2.3. Experimental GoalsThe criteria for an application to successfully demonstrate use ofthe NAT Behavior Discovery STUN usage would include:o An implementation that relies on this usage to determine its run- time behavior, most likely using it to determine an initial choice of options that are then adjusted based on experience with itsnetwork connections.MacDonald & Lowekamp Experimental [Page 8]o The implementation must either demonstrate its applicability inenvironments where it is realistic to expect a provider to deploy dedicated STUN servers with multiple IP addresses, or it mustdemonstrate duplicating the behavior of such a dedicated STUNserver with two nodes that share the role of providing theaddress-changing operations required by this usage.o Experimental evidence that the application of this usage resultsin improved behavior of the application in real-world conditions. The exact metrics for this improvement may vary, somepossibilities include: faster convergence to the properparameters, less work to set up initial connections, fewerreconfigurations required after startup, etc.o A protocol specification that defines how the implementationapplies this usage.The P2P scenario described above is a likely experimental test casefor this usage, but others applications are possible as well.3. Overview of OperationsIn a typical configuration, a STUN client is connected to a privatenetwork and through one or more NATs to the public Internet. Theclient is configured with the address of a STUN server on the public Internet. The Behavior Discovery usage makes use of SRV records sothat a server may use a different transport address for this usagethan for other usages. This usage does not provide backwardcompatibility with RFC 3489 [RFC3489] for either clients or servers. Implementors of clients that wish to be compliant with RFC 3489servers should see that specification. Implementors of serversSHOULD NOT include support for RFC 3489 clients, as the original uses of that protocol have been deprecated.Because STUN forbids a server from creating a new TCP or TCP/TLSconnection to the client, many tests apply only to UDP. Theapplicability of the various tests is indicated below.The STUN NAT Behavior Discovery usage defines new attributes on theSTUN Binding Request and STUN Binding Response that allow thesemessages to be used to diagnose the current behavior of the NAT(s)between the client and server.This section provides a descriptive overview of the typical use ofthese attributes. Normative behavior is described in Sections 5, 6, and 7.MacDonald & Lowekamp Experimental [Page 9]3.1. Determining NAT MappingA client behind a NAT wishes to determine if that NAT is currentlyusing Endpoint-Independent, Address-Dependent, or Address and Port-Dependent Mapping [RFC4787]. The client performs a series of teststhat make use of the OTHER-ADDRESS attribute; these tests aredescribed in detail in Section 4. These tests send binding requests to the alternate address and port of the STUN server to determinemapping behavior. These tests can be used for UDP, TCP, or TCP/TLSconnections.3.2. Determining NAT FilteringA client behind a NAT wishes to determine if that NAT is currentlyusing Endpoint-Independent, Address-Dependent, or Address and Port-Dependent Filtering [RFC4787]. The client performs a series of tests that make use of the OTHER-ADDRESS and CHANGE-REQUEST attributes;these tests are described in Section 4. These tests requestresponses from the alternate address and port of the STUN server; aprecondition to these tests is that no binding be established to the alternate address and port. See below for more information. Because the NAT does not know that the alternate address and port belong tothe same server as the primary address and port, it treats theseresponses the same as it would those from any other host on theInternet. Therefore, the success of the binding responses sent from the alternate address and port indicate whether the NAT is currently performing Endpoint-Independent Filtering, Address-DependentFiltering, or Address and Port-Dependent Filtering. This testapplies only to UDP datagrams.3.3. Binding Lifetime DiscoveryMany systems, such as VoIP, rely on being able to keep a connectionopen between a client and server or between peers of a P2P system.Because NAT bindings expire over time, keepalive messages must besent across the connection to preserve it. Because keepalives impose some overhead on the network and servers, reducing the frequency ofkeepalives can be useful.A normal request-response protocol cannot be used to test bindinglifetime because the initial request resets the binding timer.Behavior discovery defines the RESPONSE-PORT attribute to allow theclient and server to set up a "control channel" using one port on the client that is used to test the binding lifetime of a different port allocated on the client. More generally, RESPONSE-PORT allows theclient to allocate two ports and request that responses to queriessent from one port be delivered to the other. The client uses itssecond port and the STUN server’s alternate address to check if an MacDonald & Lowekamp Experimental [Page 10]existing binding that hasn’t had traffic sent on it is still openafter time T. This approach is described in detail in Section 4.6.This test applies only to UDP datagrams.3.4. Diagnosing NAT HairpinningSTUN Binding Requests allow a client to determine whether it isbehind a NAT that supports hairpinning of connections. To performthis test, the client first sends a Binding Request to its STUNserver to determine its mapped address. The client then sends a STUN Binding Request to this mapped address from a different port. If the client receives its own request, the NAT hairpins connections. This test applies to UDP, TCP, or TCP/TLS connections.3.5. Determining Fragment HandlingSome NATs exhibit different behavior when forwarding fragments thanwhen forwarding a single-frame datagram. In particular, some NATs do not hairpin fragments at all and some platforms discard fragmentsunder load. To diagnose this behavior, STUN messages may be sentwith the PADDING attribute, which simply inserts additional spaceinto the message. By forcing the STUN message to be divided intomultiple fragments, the NAT’s behavior can be observed.All of the previous tests can be performed with PADDING if a NAT’sfragment behavior is important for an application, or only thosetests that are most interesting to the application can be retested.PADDING only applies to UDP datagrams. PADDING can not be used with RESPONSE-PORT.3.6. Detecting a Generic Application Level Gateway (ALG)A number of NAT boxes are now being deployed into the market that try to provide "generic" ALG functionality. These generic ALGs hunt for IP addresses, either in text or binary form within a packet, andrewrite them if they match a binding. This behavior can be detected because the STUN server returns both the MAPPED-ADDRESS and XOR-MAPPED-ADDRESS in the same response. If the result in the two doesnot match, there is a NAT with a generic ALG in the path. This test apples to UDP and TCP, but not TLS over TCP connections.4. Discovery ProcessThis section provides a descriptive overview of how the NAT Behavior Discovery usage primitives allow checks to be made to discover thecurrent behavior of the NAT or NATs an application is behind. These tests can only give the instantaneous behavior of a NAT; it has been found that NATs can change behavior under load and over time. The MacDonald & Lowekamp Experimental [Page 11]results of these tests therefore can be regarded as upper bounds --an application must assume that NAT behavior can become morerestrictive at any time. Results from tests performed using aparticular port on the client may also not indicate the behaviorexperienced by a different port, as described in Section 4.1.Definitions for NAT filtering and mapping behavior are from[RFC4787]. The tests described here are for UDP connectivity, NATmapping behavior, NAT filtering behavior, and NAT binding lifetimediscovery; additional tests could be designed using this usage’smechanisms. The tests described below include only tests that can be performed using a client with a single IP address. A client withmultiple IP addresses (or multiple clients collaborating) behind the same NAT can combine their probes to test additional aspects of NATbehavior, such as port overloading. This section provides adescriptive overview of how the primitives provided by the STUNattributes in this specification may be used to perform behaviortests.Normative specifications for the attributes are defined in latersections.4.1. Source Port SelectionProper source port selection is important to ensuring the usefulness and accuracy of the Behavior Discovery tests. There are twopreconditions for tests:o Because mapping behavior can vary on a port-by-port basis, anapplication should perform its tests using the source portintended for use by the application whenever possible. If itintends to use multiple source ports, it should repeat these tests for each source port. Such tests should be performed sequentially to reduce load on the NAT.o Because the results of some diagnostic checks depend on previousstate in the NAT created by prior traffic, the tests should beperformed using a source port that has not generated recenttraffic. Therefore, the application should use a random sourceport or ensure that no traffic has previously occurred on theselected port prior to performing tests, generally by allocating a port and holding it unused for at least 15 minutes prior to thetests.Ensuring both of these preconditions can be challenging, particularly for a device or application wishing to perform Behavior Discoverytests at startup. The following guidelines are suggested forreducing the likelihood of problems:MacDonald & Lowekamp Experimental [Page 12]。

相关文档
最新文档