原理

1、NAT穿越技术,为了解决NAT设备对P2P网络的通信限制
 
2、作用:检测网络中是否存在NAT设备,并获取两个通信端点经NAT设备分配的IP地址和端口号,然后建立一条可穿越NAT的P2P链接,实现P2P通信
 
3、cwmp:依据TR111实现STUN Server功能,CPE作为STUN Client,向STUN Server发送BINDING-REQUEST,CPE 通过BINDING-RESPONSE响应消息获取设备是否在NAT之后,以及NAT类型
 
4、原理:ACS是如何主动发起连接?
ACS能够自动检测到位于NAT设备或者gateway后面的设备(与STUN bind成功),然后发送UDP connection Request到STUN server,通过STUN server进行转发到与STUN server关联的内部CPE设备,进而CPE发起tr069规范中定义的6 connection request事件(TCP连接成功),在tcp连接超时时间范围内可进行设备管理操作。如果超时,ACS再次主动发送UDP connection Request,然后对设备进行管理操作
 

CPE侧实现

流程图:

 

TR111扩展的STUN数据模型

UDPConnectionRequestAddress
string(:256)
R
Address and port to which an ACS MAY send a UDP Connection Request to the CPE (see [Annex G/TR-069a2]). This parameter is represented in the form of an Authority element as defined in [RFC3986]. The value MUST be in one of the following two forms:
  • host:port
  • host When STUNEnable is true, the host and port portions of this parameter MUST represent the public address and port corresponding to the NAT binding through which the ACS can send UDP Connection Request messages (once this information is learned by the CPE through the use of STUN). When STUNEnable is false, the host and port portions of the URL MUST represent the local IP address and port on which the CPE is listening for UDP Connection Request messages. The second form of this parameter MAY be used only if the port value is equal to “80”.
-
1.0
UDPConnectionRequestAddressNotificationLimit
unsignedInt
W
The minimum time, in seconds, between Active Notifications resulting from changes to the UDPConnectionRequestAddress (if Active Notification is enabled).
-
1.0
STUNEnable
boolean
W
Enables or disables the use of STUN by the CPE. This applies only to the use of STUN in association with the ACS to allow UDP Connection Requests.
-
1.0
STUNServerAddress
string(:256)
W
Host name or IP address of the STUN server for the CPE to send Binding Requests if STUN is enabled via STUNEnable. If an empty string and STUNEnable is true, the CPE MUST use the address of the ACS extracted from the host portion of the ACS URL.
-
1.0
STUNServerPort
unsignedInt(0:65535)
W
Port number of the STUN server for the CPE to send Binding Requests if STUN is enabled via STUNEnable. By default, this SHOULD be the equal to the default STUN port, 3478.
-
1.0
STUNUsername
string(:256)
W
If not an empty string, the value of the STUN USERNAME attribute to be used in Binding Requests (only if message integrity has been requested by the STUN server). If an empty string, the CPE MUST NOT send STUN Binding Requests with message integrity.
-
1.0
STUNPassword
string(:256)
W

The value of the STUN Password to be used in computing the MESSAGE-INTEGRITY attribute to be used in Binding Requests (only if message integrity has been requested by the STUN server).

When read, this parameter returns an empty string, regardless of the actual value.

-
1.0
STUNMaximumKeepAlivePeriod
int(-1:)
W
If STUN Is enabled, the maximum period, in seconds, that STUN Binding Requests MUST be sent by the CPE for the purpose of maintaining the binding in the Gateway. This applies specifically to Binding Requests sent from the UDP Connection Request address and port. A value of -1 indicates that no maximum period is specified.
-
1.0
STUNMinimumKeepAlivePeriod
unsignedInt
W
If STUN Is enabled, the minimum period, in seconds, that STUN Binding Requests can be sent by the CPE for the purpose of maintaining the binding in the Gateway. This limit applies only to Binding Requests sent from the UDP Connection Request address and port, and only those that do not contain the BINDING-CHANGE attribute. This limit does not apply to retransmissions following the procedures defined in [RFC3489].
-
1.0
NATDetected
boolean
R
When STUN is enabled, this parameter indicates whether or not the CPE has detected address and/or port mapping in use. A true value indicates that the received MAPPED-ADDRESS in the most recent Binding Response differs from the CPE’s source address and port. When STUNEnable is false, this value MUST be false.
-
1.0

TR069实际实现

1、UDPConnectionRequestAddressNotificationLimit和STUNPassword、STUNUsername不实现
2、UDPConnectionRequestAddress和NATDetected为只读节点,通过inform报文发送

测试配置(XACS)

测试部环境:

1、远程控制10.50.100.254
2、开启stun进程指令后加一个&,使其在后台运行

禅道测试用例:

命令行测试stun功能:

/userfs/bin/stun-client 10.50.100.215 -v -p 0 -i 10.50.100.39   -min 30 -max 30 -sp 3478

页面配置测试stun功能:

报文

stun request+response:

 
request:

response:

重新inform上报UDPConnectionRequestAddress和NATDetected节点值

 

TR069-STUN的更多相关文章

  1. CWMP开源代码研究——stun的NAT穿透

    原创作品,转载请注明出处,严禁非法转载.如有错误,请留言! email:40879506@qq.com 参考: http://www.cnblogs.com/myblesh/p/6259765.htm ...

  2. Android学习——移植tr069程序到Android平台

    原创作品,转载请注明出处,严禁非法转载.如有错误,请留言! email:40879506@qq.com 声明:本系列涉及的开源程序代码学习和研究,严禁用于商业目的. 如有任何问题,欢迎和我交流.(企鹅 ...

  3. 关于tr069网管开发系列教程

    原创作品,转载请注明出处,严禁非法转载.如有错误,请留言! email:40879506@qq.com 声明:本系列涉及的开源程序代码学习和研究,严禁用于商业目的. 如有任何问题,欢迎和我交流.(企鹅 ...

  4. webrtc进阶-信令篇-之三:信令、stun、turn、ice

    webRTC支持点对点通讯,但是webRTC仍然需要服务端:  . 协调通讯过程中客户端之间需要交换元数据,    如一个客户端找到另一个客户端以及通知另一个客户端开始通讯.  . 需要处理NAT(网 ...

  5. STUN和TURN技术浅析

    转自:http://blog.csdn.net/yu_xiang/article/details/9227023 在现实Internet网络环境中,大多数计算机主机都位于防火墙或NAT之后,只有少部分 ...

  6. 实测可用的免费STUN服务器!

    实测可用的免费STUN服务器!     以实际ping延迟排序: stun.voipbuster.com 287ms stun.wirlab.net 320ms s1.taraba.net       ...

  7. Android IOS WebRTC 音视频开发总结(十一)-- stun&turn部署

    本篇文章主要介绍webrtc里面的stun,turn服务的安装与配置(转载请说明出处: http://www.cnblogs.com/lingyunhu, RTC.Blacker) 说到STUN,TU ...

  8. [转]webrtc学习: 部署stun和turn服务器

    [转]webrtc学习: 部署stun和turn服务器 http://www.cnblogs.com/lingdhox/p/4209659.html webrtc的P2P穿透部分是由libjingle ...

  9. [转]STUN和TURN技术浅析

    [转]STUN和TURN技术浅析 http://www.h3c.com.cn/MiniSite/Technology_Circle/Net_Reptile/The_Five/Home/Catalog/ ...

  10. P2P通信标准协议(一)之STUN

    前一段时间在P2P通信原理与实现中介绍了P2P打洞的基本原理和方法,我们可以根据其原理为自己的网络程序设计一套通信规则, 当然如果这套程序只有自己在使用是没什么问题的.可是在现实生活中,我们的程序往往 ...

随机推荐

  1. MetaGPT( The Multi-Agent Framework):颠覆AI开发的革命性多智能体元编程框架

    "MetaGPT( The Multi-Agent Framework):颠覆AI开发的革命性多智能体元编程框架" 一个多智能体元编程框架,给定一行需求,它可以返回产品文档.架构设 ...

  2. 5.2 Windows驱动开发:内核取KERNEL模块基址

    模块是程序加载时被动态装载的,模块在装载后其存在于内存中同样存在一个内存基址,当我们需要操作这个模块时,通常第一步就是要得到该模块的内存基址,模块分为用户模块和内核模块,这里的用户模块指的是应用层进程 ...

  3. 关于 vant 移动端的 rem 适配方案

    一.使用 lib-flexible 动态设置 rem 基准值 (html 标签的字体大小) (1) 安装依赖: npm i amfe-flexible -D (2) 在main.js 中引入 impo ...

  4. 47从零开始用Rust编写nginx,配对还有这么多要求!负载均衡中的路径匹配

    wmproxy wmproxy已用Rust实现http/https代理, socks5代理, 反向代理, 负载均衡, 静态文件服务器,websocket代理,四层TCP/UDP转发,内网穿透等,会将实 ...

  5. 201871010111-刘佳华 实验二 个人项目—《D[01]背包问题》项目报告

    实验二 软件工程个人项目 ========== 时间:2021-3-18 项目 内容 课程班级博客链接 课程链接 这个作业要求链接 作业要求 我的课程学习目标 1.了解软件工程过程中个人项目的开发流程 ...

  6. C#/.NET该如何自学入门?

    前言 随着DotNetGuide技术社区交流群的不断壮大(目前4个群都已经满500人,已开5群现已有180多个小伙伴),越来越多应届生和其他领域的小伙伴加入了我们这个大家庭.在此期间我在个人微信.公众 ...

  7. Hive数据导入与导出

    数据导入 ● 本地文件导入 -- 本地文件导入(local) LOAD DATA local INPATH '/home/hadoop/sourceA.txt' INTO TABLE testA PA ...

  8. C# 二十年语法变迁之 C# 2,C# 3 ,C# 4参考

    C# 二十年语法变迁之 C# 2,C# 3 ,C# 4参考 https://benbowen.blog/post/two_decades_of_csharp_i/ 自从 C# 于 2000 年推出以来 ...

  9. NC19429 红球进黑洞

    题目链接 题目 题目描述 在心理疏导室中有一种奇特的疏导工具,叫做红球.红球被提前分为了许多正方形小方格. 每当有人来找ATB做心理疏导时,ATB就会让他去先玩红球,然后通过红球小格方的高度来判断一个 ...

  10. es6 快速入门 系列 —— 解构

    其他章节请看: es6 快速入门 系列 解构 我们经常使用数组或对象存储数据,然后从中提取出相关数据信息 试图解决的问题 以前开发者为了从对象或数组中提取出特定数据并赋值给变量,编写了很多重复的代码, ...