CN103297461B - NAT session keepalive duration method to set up and client and server - Google Patents
NAT session keepalive duration method to set up and client and server Download PDFInfo
- Publication number
- CN103297461B CN103297461B CN201210048864.1A CN201210048864A CN103297461B CN 103297461 B CN103297461 B CN 103297461B CN 201210048864 A CN201210048864 A CN 201210048864A CN 103297461 B CN103297461 B CN 103297461B
- Authority
- CN
- China
- Prior art keywords
- keep
- qos level
- alive
- client
- server
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 23
- 238000013507 mapping Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 2
- 230000004083 survival effect Effects 0.000 description 2
- 239000002699 waste material Substances 0.000 description 2
- 241000700605 Viruses Species 0.000 description 1
- 238000001514 detection method Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000002085 persistent effect Effects 0.000 description 1
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
Description
技术领域technical field
本申请涉及NAT会话保活时长设置方法以及实现该方法的客户端和服务器。This application relates to a method for setting a NAT session keep-alive duration and a client and a server for realizing the method.
背景技术Background technique
NetworkAddressTranslation(网络地址转换)简称NAT,是一个IETF标准,能将一个IP地址域映射到另一个IP地址域,从而为终端主机提供透明路由,以解决当前公网IP地址紧缺和网络安全问题。但是NAT设备中记录并保活的用户公网IP地址与私网IP地址的映射信息具有一定的存活周期,当存活周期内无新的请求消息时,NAT会话将被释放,之后服务器主动推送的消息将无法送到客户端,影响用户体验。Network Address Translation (Network Address Translation), referred to as NAT, is an IETF standard that can map one IP address domain to another IP address domain, thereby providing transparent routing for end hosts to solve the current shortage of public network IP addresses and network security issues. However, the mapping information between the user's public network IP address and private network IP address recorded and kept alive in the NAT device has a certain survival period. When there is no new request message within the survival period, the NAT session will be released, and then the server actively pushes the Messages will not be sent to the client, affecting user experience.
为了解决上述问题,一种方式是客户端持续不断的发送心跳消息,来保活用户的NAT会话信息,使得使用了NAT设备的私有TCP/IP网络中的主机与服务器之间保持长连接,以保证客户端与服务器间的网络安全和数据的顺畅通行。然而,心跳消息的持续不断发送,严重消耗了无线信道资源,降低了无线资源利用率。In order to solve the above problems, one way is that the client continuously sends heartbeat messages to keep the user's NAT session information alive, so that the host in the private TCP/IP network using the NAT device and the server maintain a long connection, so as to Ensure network security and smooth flow of data between client and server. However, the continuous sending of heartbeat messages seriously consumes radio channel resources and reduces the utilization rate of radio resources.
一种避免持续不断发送心跳消息的方式是基于PCP进行NAT会话保活的方案。PCP(PortControlProtocol)是IETF定义的用于PCP客户端和PCP服务器(如NAT)之间进行会话保活的协议。其核心是,PCP客户端将需要保活的IP地址、端口及保活周期等信息发送至PCP服务器,服务器将分配的公网IP地址、端口及协商后的保活周期等信息返回至客户端,之后客户端发送保活消息进行会话保活。根据这种方式,虽然避免了持续不断发送心跳消息,然而,由于PCP服务器一般按照客户端的需求来设置保活周期,容易造成IP地址资源的浪费。A way to avoid continuously sending heartbeat messages is to implement a PCP-based NAT session keep-alive solution. PCP (PortControlProtocol) is a protocol defined by IETF for session keep-alive between a PCP client and a PCP server (such as NAT). The core is that the PCP client sends information such as the IP address, port, and keep-alive period that need to be kept alive to the PCP server, and the server returns the information such as the allocated public network IP address, port, and negotiated keep-alive period to the client. , and then the client sends a keep-alive message to keep the session alive. According to this method, although the continuous sending of heartbeat messages is avoided, the PCP server generally sets the keep-alive period according to the requirements of the client, which easily causes waste of IP address resources.
发明内容Contents of the invention
为了解决现有基于PCP的NAT会话保活时长设置的资源浪费问题,本申请提出了一种NAT会话保活时长设置方法以及实现该方法的客户端和服务器。In order to solve the resource waste problem of the existing PCP-based NAT session keep-alive duration setting, the present application proposes a method for setting the NAT session keep-alive duration and a client and a server implementing the method.
根据本申请的一个方面,提出了一种NAT会话保活时长设置方法,可包括:客户端根据用户和/或业务信息获取QoS等级;客户端向服务器发送所述QoS等级;服务器接收所述请求消息,根据所述QoS等级确定NAT会话保活时长;以及服务器向客户端发送所述NAT会话保活时长。According to one aspect of the present application, a method for setting a NAT session keep-alive duration is proposed, which may include: the client obtains the QoS level according to user and/or service information; the client sends the QoS level to the server; the server receives the request message, determining the NAT session keep-alive duration according to the QoS level; and the server sends the NAT session keep-alive duration to the client.
根据本申请的另一个方面,提出了一种客户端,可包括:QoS等级获取模块,根据用户和/或业务信息来获取QoS等级;发送模块,发送所述QoS等级;以及接收模块,接收保活时长信息。According to another aspect of the present application, a client is proposed, which may include: a QoS level acquisition module, which acquires the QoS level according to user and/or service information; a sending module, which sends the QoS level; and a receiving module, which receives the guaranteed Live information.
根据本申请的又一个方面,提出了一种服务器,可包括:接收模块,接收包含QoS等级的消息;保活时长确定模块,根据所述QoS等级,确定NAT会话保活时长;以及发送模块,发送所述NAT会话保活时长。According to another aspect of the present application, a server is proposed, which may include: a receiving module that receives a message including a QoS level; a keep-alive duration determination module that determines a NAT session keep-alive duration according to the QoS level; and a sending module, Send the keep-alive duration of the NAT session.
通过本申请的方法和装置,可根据不同用户和/或业务的具体特性来设置NAT会话保活时长,从而使得NAT资源得以合理分配与释放,提高资源利用率。Through the method and device of the present application, the NAT session keep-alive duration can be set according to specific characteristics of different users and/or services, so that NAT resources can be reasonably allocated and released, and resource utilization can be improved.
附图说明Description of drawings
图1是根据本申请一个实施方案的NAT会话保活时长设置方法的流程图;Fig. 1 is a flow chart of the NAT session keep-alive duration setting method according to an embodiment of the present application;
图2是根据本申请一个实施方案的客户端设备的框图;以及Figure 2 is a block diagram of a client device according to one embodiment of the present application; and
图3是根据本申请一个实施方案的服务器设备的框图。FIG. 3 is a block diagram of a server device according to one embodiment of the present application.
具体实施方式detailed description
下面参照附图,对本申请的实施方案进行详细说明。Embodiments of the present application will be described in detail below with reference to the accompanying drawings.
图1是根据本申请一个实施方案的NAT会话保活时长设置方法的流程图。如图1所示,在步骤S1002,客户端可根据用户或业务信息或者用户和业务信息的组合,来获取QoS等级。然后在步骤S1004,客户端可向服务器发送所获取的QoS等级。在步骤S1006,服务器接收客户端发送的请求消息,并根据QoS等级来确定保活时长。之后,在步骤S1008,服务器将所确定的保活时长发送给客户端。Fig. 1 is a flowchart of a method for setting a NAT session keep-alive duration according to an embodiment of the present application. As shown in FIG. 1 , in step S1002, the client may obtain the QoS level according to user or service information or a combination of user and service information. Then in step S1004, the client may send the acquired QoS level to the server. In step S1006, the server receives the request message sent by the client, and determines the keep-alive duration according to the QoS level. Afterwards, in step S1008, the server sends the determined keep-alive duration to the client.
通过该方法,可根据不同用户和/或业务的具体特性来设置NAT会话保活时长,从而使得NAT资源得以合理分配与释放,提高资源利用率。Through this method, the NAT session keep-alive duration can be set according to specific characteristics of different users and/or services, so that NAT resources can be reasonably allocated and released, and resource utilization can be improved.
根据本申请的具体实施方案,为了针对不同的用户、业务等信息分配不同的保活周期,可在客户端中配置QoS等级查询表,从而可根据用户、业务信息或者用户与业务信息的组合来查找对应的QoS等级。该QoS等级查询表可由运营商配置,并可进行灵活修改。According to the specific implementation plan of this application, in order to allocate different keep-alive periods for different users, services and other information, a QoS level lookup table can be configured in the client, so that the QoS level query table can be configured according to the user, service information or the combination of user and service information. Find the corresponding QoS class. The QoS class lookup table can be configured by the operator and can be modified flexibly.
可以理解,既可同时考虑用户和业务两个因素,也可单独考虑用户和业务的其中一个因素,后面将进行详细说明。It can be understood that the two factors of user and service may be considered simultaneously, or one of the factors of user and service may be considered separately, which will be described in detail later.
可以理解,客户端可通过各种现有方式获取业务信息,例如,通过DPI进行业务检测,或者增加其它网元(例如,PCRF)进行业务信息上报。It can be understood that the client can obtain service information through various existing methods, for example, service detection through DPI, or add other network elements (for example, PCRF) to report service information.
根据一个具体实施方案,当客户端获取了QoS等级后,可将其插入将要向服务器发送的请求消息中增加的QoS等级标志位,通过请求消息向服务器发送QoS等级。According to a specific embodiment, after the client obtains the QoS level, it can insert it into the QoS level flag added in the request message to be sent to the server, and send the QoS level to the server through the request message.
根据一个具体实施方案,服务器中可配置有保活时长查询表,可根据QoS等级,通过查询保活时长查询表来确定保活时长。与QoS等级查询表类似,保活时长查询表可由运营商配置,并可进行灵活修改。作为一个具体实施例,可为较高QoS等级设置较高的保活时长,这样,在资源紧张的情况下,可优先为高QoS等级的用户或业务提供服务。According to a specific implementation solution, the server may be configured with a keep-alive time lookup table, and the keep-alive time length may be determined by querying the keep-alive time lookup table according to the QoS level. Similar to the QoS level query table, the keep-alive duration query table can be configured by the operator and can be flexibly modified. As a specific embodiment, a higher keep-alive duration can be set for a higher QoS level, so that in the case of resource shortage, users or services with a high QoS level can be given priority in providing services.
下面详细说明如何根据用户和业务信息来设置保活时长。The following describes in detail how to set the keep-alive duration based on user and business information.
在一个具体实施例中,客户端中配置QoS等级查询表可以是仅根据业务来对应QoS等级。例如,针对友好的永远在线类应用,由于永远在线类应用本来就是需要长在线的,可为其保持长连接,而减少该类应用的心跳消息发送频率,降低其对无线资源的占用。因此,可以为这类应用设置较高的对应QoS等级,从而配置较长的保活时长。又例如,对于不合作应用或病毒等应用,可以设置较低的QoS等级,服务器可以拒绝该类应用申请。In a specific embodiment, configuring the QoS level lookup table in the client may only correspond to the QoS level according to the service. For example, for friendly always-on applications, since the always-on applications originally need to be permanently online, a persistent connection can be maintained for them, and the heartbeat message sending frequency of such applications can be reduced to reduce their occupation of wireless resources. Therefore, you can set a higher corresponding QoS level for this type of application, so as to configure a longer keep-alive duration. For another example, for applications such as uncooperative applications or viruses, a lower QoS level may be set, and the server may reject applications of such applications.
在另一个具体实施例中,客户端中配置QoS等级查询表可以是仅根据用户来对应QoS等级。例如,可以为VIP用户提供较高的优先级,即根据用户等级来提供差异化的QoS等级。在资源紧张时,为高QoS等级的用户提供服务,而拒绝低QoS等级用户的PCP请求。In another specific embodiment, the configuration of the QoS level lookup table in the client may only correspond to the QoS level according to the user. For example, higher priority can be provided for VIP users, that is, differentiated QoS levels can be provided according to user levels. When resources are tight, provide services for users with high QoS levels, and reject PCP requests of users with low QoS levels.
当服务器确定了保活时长后,将其发送给客户端,客户端可根据接收到的保活时长,发送NAT会话保活消息。After the server determines the keep-alive duration, it sends it to the client, and the client can send a NAT session keep-alive message according to the received keep-alive duration.
可以理解,NAT会话保活消息可以与之前发送的包含QoS请求消息相同。服务器会维护用户会话映射关系,在一定时间内(即超时时间)没有数据发送,则会删除该映射表,因此用户就无法接入服务(如访问internet),保活周期即是这个映射关系的超时时间,因此只要在这个超时时间内再收到消息,该会话就会保留。It can be understood that the NAT session keep-alive message may be the same as the previously sent message containing the QoS request. The server will maintain the user session mapping relationship. If no data is sent within a certain period of time (that is, the timeout period), the mapping table will be deleted, so the user will not be able to access services (such as accessing the Internet). The keep-alive period is the mapping relationship. Timeout period, so as long as another message is received within this timeout period, the session will remain.
接下来参照图2,描述根据本申请实施方案的客户端设备。Referring next to FIG. 2 , a client device according to an embodiment of the present application will be described.
如图2所示,客户端设备20可包括QoS等级获取模块202和发送模块204。QoS等级获取模块202可根据用户和/或业务信息来获取QoS等级,而发送模块204可发送所获取的QoS等级。As shown in FIG. 2 , the client device 20 may include a QoS class acquisition module 202 and a sending module 204 . The QoS level acquiring module 202 can acquire the QoS level according to user and/or service information, and the sending module 204 can send the acquired QoS level.
根据一个实施方案,QoS等级获取模块可配置有QoS等级查询表,QoS等级获取模块根据用户和/或业务信息,通过查询所述QoS等级查询表来获取QoS等级。According to an embodiment, the QoS level acquisition module may be configured with a QoS level lookup table, and the QoS level acquisition module acquires the QoS level by querying the QoS level lookup table according to user and/or service information.
根据一个实施方案,在客户端的请求消息中,可增加QoS等级标志位,发送模块发送包含了QoS等级的请求消息。According to an embodiment, in the request message of the client, a QoS level flag bit can be added, and the sending module sends the request message including the QoS level.
根据一个实施方案,客户端可进一步包括接收模块(未示出),接收保活时长信息。发送模块可根据所接收的保活时长信息,发送NAT会话保活消息。According to an embodiment, the client may further include a receiving module (not shown), configured to receive keep-alive duration information. The sending module can send a NAT session keep-alive message according to the received keep-alive duration information.
接下来参照图3,描述根据本申请实施方案的服务器设备。Referring next to FIG. 3 , a server device according to an embodiment of the present application will be described.
如图所示,服务器30可包括接收模块302、保活时长确定模块304以及发送模块306。接收模块302可接收包含QoS等级的消息。保活时长确定模块304可根据QoS等级,确定保活时长,而发送模块306可发送所述保活时长。As shown in the figure, the server 30 may include a receiving module 302 , a keep-alive duration determining module 304 and a sending module 306 . The receiving module 302 can receive a message including a QoS class. The keep-alive duration determination module 304 can determine the keep-alive duration according to the QoS level, and the sending module 306 can send the keep-alive duration.
根据一个实施方案,保活时长确定模块可配置有保活时长查询表,保活时长确定模块可根据QoS等级,通过查询所述保活时长查询表来确定保活时长。According to an embodiment, the keep-alive duration determination module may be configured with a keep-alive duration query table, and the keep-alive duration determination module may determine the keep-alive duration by querying the keep-alive duration query table according to the QoS level.
以上参照附图对本申请的示例性的实施方案进行了描述。本领域技术人员应该理解,上述实施方案仅仅是为了说明的目的而所举的示例,而不是用来进行限制。凡在本申请的教导和权利要求保护范围下所作的任何修改、等同替换等,均应包含在本申请要求保护的范围内。The exemplary embodiments of the present application are described above with reference to the accompanying drawings. Those skilled in the art should understand that the above-mentioned embodiments are only examples for the purpose of illustration, rather than limitation. Any modification, equivalent replacement, etc. made under the teaching of the present application and the protection scope of the claims shall be included in the protection scope of the present application.
Claims (11)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210048864.1A CN103297461B (en) | 2012-02-28 | 2012-02-28 | NAT session keepalive duration method to set up and client and server |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210048864.1A CN103297461B (en) | 2012-02-28 | 2012-02-28 | NAT session keepalive duration method to set up and client and server |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN103297461A CN103297461A (en) | 2013-09-11 |
| CN103297461B true CN103297461B (en) | 2016-05-25 |
Family
ID=49097777
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201210048864.1A Active CN103297461B (en) | 2012-02-28 | 2012-02-28 | NAT session keepalive duration method to set up and client and server |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN103297461B (en) |
Families Citing this family (10)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US10374936B2 (en) * | 2015-12-30 | 2019-08-06 | Juniper Networks, Inc. | Reducing false alarms when using network keep-alive messages |
| CN107528931B (en) * | 2016-06-22 | 2021-06-18 | 中兴通讯股份有限公司 | IP address self-adaptive keeping method, device and system based on user behavior |
| US10397085B1 (en) | 2016-06-30 | 2019-08-27 | Juniper Networks, Inc. | Offloading heartbeat responses message processing to a kernel of a network device |
| CN107995235A (en) * | 2016-10-26 | 2018-05-04 | 中国移动通信有限公司研究院 | The method and terminal that a kind of keep-alive time determines |
| CN106789394A (en) * | 2016-11-18 | 2017-05-31 | 上海斐讯数据通信技术有限公司 | A kind of connection server keep Alive Packet control method long and system |
| CN109962988B (en) * | 2017-12-25 | 2022-01-11 | 中国电信股份有限公司 | Method and system for configuring NAT (network Address translation) aging duration and NAT equipment |
| CN110691148B (en) * | 2018-07-05 | 2022-04-29 | 中国移动通信有限公司研究院 | A method, apparatus, device and storage medium for determining NAT aging time |
| CN110381130B (en) * | 2019-07-12 | 2020-05-29 | 湖南新云网科技有限公司 | Keep-alive long connection method, device, communication terminal and storage medium |
| CN111866107B (en) * | 2020-07-10 | 2023-01-03 | 杭州叙简科技股份有限公司 | Mobile law enforcement instrument keep-alive method according to balance |
| CN115209478B (en) * | 2022-09-16 | 2022-11-25 | 南京博鼎资讯科技有限公司 | Data processing method for long-term alive-keeping of new-generation mobile communication based on artificial intelligence |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2001003400A2 (en) * | 1999-07-02 | 2001-01-11 | Nokia Internet Communications Inc. | Real-time traffic shaper with garanteed bandwidth for best-effort traffic |
| CN1581791A (en) * | 2003-08-01 | 2005-02-16 | 华为技术有限公司 | Method for providing reliable transmission service quality in communication network |
| CN101252457A (en) * | 2003-08-01 | 2008-08-27 | 华为技术有限公司 | Method for providing reliable transmission quality of service in a communication network |
| CN101345641A (en) * | 2008-08-21 | 2009-01-14 | 中兴通讯股份有限公司 | Multicast access equipment and method |
| CN101501663A (en) * | 2005-04-22 | 2009-08-05 | 思科技术公司 | Approach for securely deploying network devices |
-
2012
- 2012-02-28 CN CN201210048864.1A patent/CN103297461B/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| WO2001003400A2 (en) * | 1999-07-02 | 2001-01-11 | Nokia Internet Communications Inc. | Real-time traffic shaper with garanteed bandwidth for best-effort traffic |
| CN1581791A (en) * | 2003-08-01 | 2005-02-16 | 华为技术有限公司 | Method for providing reliable transmission service quality in communication network |
| CN101252457A (en) * | 2003-08-01 | 2008-08-27 | 华为技术有限公司 | Method for providing reliable transmission quality of service in a communication network |
| CN101501663A (en) * | 2005-04-22 | 2009-08-05 | 思科技术公司 | Approach for securely deploying network devices |
| CN101345641A (en) * | 2008-08-21 | 2009-01-14 | 中兴通讯股份有限公司 | Multicast access equipment and method |
Also Published As
| Publication number | Publication date |
|---|---|
| CN103297461A (en) | 2013-09-11 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN103297461B (en) | NAT session keepalive duration method to set up and client and server | |
| CN103096435B (en) | Connect keeping method, device and mobile terminal | |
| CN109600768B (en) | Method, device and system for managing network slices | |
| EP2608491B1 (en) | Method, apparatus and system for allocating public IP address | |
| CN109803281B (en) | Network service management method, equipment and system | |
| CN112637364B (en) | Method, client and system for establishing P2P connection | |
| CN101729500B (en) | Method, device and system for identifying IP session | |
| CN103561124B (en) | Base station data configuring method and device | |
| CN102790811B (en) | A kind of method and apparatus of cross-over NAT equipment in monitor network | |
| CN102377833B (en) | Method and device for managing network address translation | |
| US9049122B2 (en) | Bandwidth probing messages | |
| CN101483928A (en) | Establishing method, mobile network and policy control entity for data connection of mobile network | |
| CN102447746B (en) | Information supply method, family gateway and family network system | |
| CN102204191A (en) | A message transmission method and a network-network routing device | |
| CN102664899A (en) | Service processing method, service processing device and service processing system | |
| CN102299974B (en) | A kind of method and apparatus realizing IPv6 prefix assignment | |
| CN102098355A (en) | Cloud service-based IPv6 (internet protocol version 6)/IPv4 (internet protocol version 4) translation method with communication initiated by IPv6 party | |
| CN105979405A (en) | Method and device for accessing video device | |
| CN102075588B (en) | Method and system for realizing network address translation (NAT) transversing and equipment | |
| CN104780230A (en) | Method, system and cloud system for automatically obtaining cloud server IP address | |
| CN102487396A (en) | User position determining method and system | |
| CN103348740B (en) | An access processing method, device and system | |
| CN101426030A (en) | Method and terminal for acquiring network address | |
| CN103179229A (en) | Data service communication method, equipment and system | |
| CN103181121B (en) | A kind of access processing method, equipment and system |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant |