CN105119679A - Method and system for realizing SNTP client time synchronization - Google Patents

Method and system for realizing SNTP client time synchronization Download PDF

Info

Publication number
CN105119679A
CN105119679A CN201510617535.8A CN201510617535A CN105119679A CN 105119679 A CN105119679 A CN 105119679A CN 201510617535 A CN201510617535 A CN 201510617535A CN 105119679 A CN105119679 A CN 105119679A
Authority
CN
China
Prior art keywords
passage
sntp
dns
address
time synchronized
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.)
Granted
Application number
CN201510617535.8A
Other languages
Chinese (zh)
Other versions
CN105119679B (en
Inventor
夏敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fiberhome Telecommunication Technologies Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Fiberhome Telecommunication Technologies Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Priority to CN201510617535.8A priority Critical patent/CN105119679B/en
Publication of CN105119679A publication Critical patent/CN105119679A/en
Application granted granted Critical
Publication of CN105119679B publication Critical patent/CN105119679B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a method and system for realizing SNTP client time synchronization. The method includes the following steps of determining whether the time synchronization channel of an SNTP client is a TR069 channel or VOIP channel, if no, the time synchronization is carried out by a default route, if yes, the DNS address of the WAN port of the time synchronization channel is acquired; adding a strategy route having the DNS address as the destination address into the routing table of the time synchronization channel; performing domain name resolution of the SNTP server through the strategy route; deleting the strategy route after the domain name resolution is completed; and constructing an NTP message, by which the SNTP client is in network communication with the IP address of the resolved SNTP server to realize the time synchronization of the SNTP client. The method and system are not influenced by network structure change and have no influence to user networking, the flexibility and the reliability are high, and the defects of time synchronization carried out by the default route and a conventional time synchronization mechanism are made up.

Description

A kind ofly realize SNTP client time synchronous method and system
Technical field
The present invention relates to family gateway equipment field, be specifically related to a kind ofly realize SNTP client time synchronous method and system.
Background technology
Along with the increase of home gateway service function, and the adjustment of networking structure, the time synchronized of home gateway not only relies on INTERNETWAN and connects configuration and default route, traditional Time Synchronization Mechanism is as NTP (NetworkTimeProcotol, NTP (Network Time Protocol)), NTP time synchronized refers to carries out time calibration by the Network Time Protocol of network and time source, precondition is, time source exports must pass through network interface, data output format must meet Network Time Protocol, PC all in local area network (LAN), server and miscellaneous equipment keep synchronous by network and time server, Network Time Protocol automatic decision network delay, and time bias is carried out to the data obtained, thus make the lan device time keep precisely unified.But, when INTERNETWAN connection has no time server for bridge joint networking mode or INTERNET passage, the time synchronized of family gateway equipment cannot be realized by default route or traditional Time Synchronization Mechanism.
Summary of the invention
Technical problem to be solved by this invention is when INTERNETWAN connection has no time server for bridge joint networking mode or INTERNET passage, cannot be realized the problem of family gateway equipment time synchronized by default route or traditional Time Synchronization Mechanism.
In order to solve the problems of the technologies described above, the technical solution adopted in the present invention is to provide and a kind ofly realizes SNTP client time synchronous method, comprises the following steps:
Step 101: whether the time synchronized passage judging SNTP client is TR069 passage or VOIP passage, if so, goes to step 102; Otherwise, carry out time synchronized by default route;
Step 102: the WAN mouth dns address of acquisition time synchronizing channel;
Step 103: adding purpose address is the policybased routing of dns address in the routing table of time synchronized passage;
Step 104: domain name mapping is carried out to SNTP server by policybased routing;
Step 105: after domain name mapping completes, deletion strategy route;
Step 106: build NTP message, SNTP client carries out network service by NTP message and the IP address of the SNTP server parsed, and realizes the time synchronized of SNTP client.
In technique scheme, domain name is resolved and is specifically comprised the following steps:
Dns address is obtained from the DNS configuration file of time synchronized passage;
Judge whether this dns address is empty, if so, then terminates; Otherwise adding purpose address is the policybased routing of dns address in the routing table of time synchronized passage;
Search/etc/hosts file in whether there is the IP relation of SNTP server domain name and correspondence, if exist, then dns resolution success, deletion strategy route; Otherwise build DNS query message, forwarded by policybased routing, the inquiry of DNS query message is called SNTP server domain name, deletion strategy route after dns resolution success.
In technique scheme, if described time synchronized passage has two described dns address, then add two described policybased routing.
Present invention also offers and a kind ofly realize SNTP client time synchronous system, comprising:
Judging unit, judges whether the time synchronized passage of SNTP client is TR069 passage or VOIP passage;
Acquiring unit, when the time synchronized passage of SNTP client be TR069 passage or VOIP passage time, the WAN mouth dns address of acquisition time synchronizing channel;
Very first time lock unit, when the non-TR069 passage of time synchronized passage or the VOIP passage of SNTP client, SNTP client carries out time synchronized by default route;
First increases unit, and in the routing table of time synchronized passage, adding purpose address is the policybased routing of dns address;
Domain name mapping unit, carries out domain name mapping by policybased routing to SNTP server;
Delete cells, after domain name mapping completes, deletion strategy route;
Second time synchronized unit, when the time synchronized passage of SNTP client be TR069 passage or VOIP passage time, build NTP message, SNTP client carries out network service by NTP message and the IP address of the SNTP server parsed, and realizes the time synchronized of SNTP client.
In technique scheme, domain name resolution unit specifically comprises:
Processing unit, obtains dns address from the DNS configuration file of time synchronized passage; Judge whether this dns address is empty, if so, then terminate, otherwise adding purpose address is the policybased routing of dns address in the routing table of time synchronized passage;
Domain name mapping subelement, search/etc/hosts file in whether exist SNTP server domain name and and the IP relation of correspondence, if exist, then dns resolution success, deletion strategy route; Otherwise build DNS query message, forwarded by policybased routing, the inquiry of DNS query message is called SNTP server domain name, deletion strategy route after dns resolution success.
In technique scheme, also comprise the second increase unit, when described time synchronized passage has two described dns address, add two described policybased routing.
The present invention, by the time synchronized passage of configuration SNTP client, when this time synchronized passage be not TR069 passage or VOIP passage time, time synchronized is carried out by default route, when this time synchronized passage be TR069 passage or VOIP passage time, by adding policybased routing in the routing table of this time synchronized passage, by policybased routing, domain name mapping is carried out to SNTP server, and after domain name mapping completes, deletion strategy route, build NTP message, SNTP client carries out network service by NTP message and the IP address of the SNTP server parsed, realize the time synchronized of SNTP client.This programme not by the impact of network configuration change, and does not affect user's online, and flexibility is high, and reliability is strong, compensate for the deficiency of being carried out time synchronized by default route and traditional Time Synchronization Mechanism.
Accompanying drawing explanation
What Fig. 1 provided for the embodiment of the present invention a kind ofly realizes SNTP client time synchronous method flow diagram;
The flow chart of the domain name mapping that Fig. 2 provides for the embodiment of the present invention;
What Fig. 3 provided for the embodiment of the present invention a kind ofly realizes SNTP client time synchronous system configuration schematic diagram.
Embodiment
Below in conjunction with specification drawings and specific embodiments, the present invention is described in detail.
Embodiments provide and a kind ofly realize SNTP client time synchronous method, by configuration CPE (CustomerPremiseEquipment, ustomer premises access equipment) SNTP (SimpleNetworkTimeProtocol of equipment, SNTP) the time synchronized passage of client, obtain the WAN (WideAreaNetwork of this time synchronized passage, wide area network) mouth IP address and corresponding DNS (DomainNameSystem, domain name system) address, in the routing table of this time synchronized passage, adding purpose address is the policybased routing of dns address, by this policybased routing, domain name mapping is carried out to SNTP server, deletion strategy route after domain name mapping completes, build NTP (NetworkTimeProtocol, NTP (Network Time Protocol)) message, SNTP client carries out network service by NTP message and the IP address of the SNTP server parsed, thus realize the time synchronized of SNTP client, as shown in Figure 1, described method specifically comprises the following steps:
The time synchronized passage of step 101, configuration SNTP client.
Step 102, judge whether this time synchronized passage is TR069 passage or VOIP passage, if so, then perform step 103; Otherwise, perform step 108.
The WAN mouth dns address of step 103, acquisition TR069 passage or VOIP passage.
Step 104, in the routing table of TR069 passage or VOIP passage, adding purpose address is the policybased routing of dns address.
It should be noted that, if TR069 passage or VOIP passage have two dns address, then add two policybased routing.
Step 105, by the policybased routing in the routing table of TR069 passage or VOIP passage, domain name mapping is carried out to SNTP server.
After step 106, domain name mapping complete, delete the policybased routing in the routing table of TR069 passage or VOIP passage.
Step 107, structure NTP message, SNTP client carries out network service by NTP message and the IP address of the SNTP server parsed, and realizes the time synchronized of SNTP client, executes this step, no longer performs step 108.
Step 108, carry out time synchronized by default route.
Carry out time synchronized for synchronizing channel setup time for TR069 below, domain name mapping is described in detail, and as shown in Figure 2, the method specifically comprises the following steps:
Step 201, from the DNS configuration file/etc/resolv_TR069.conf of TR069 passage, obtain the dns address of TR069 passage.
Step 202, judge that whether this dns address is empty, if so, then perform step 207; Otherwise, perform step 203.
Step 203, in the routing table of TR069 passage, adding purpose address is the policybased routing of dns address.
It should be noted that, if TR069 passage has two dns address, then add two policybased routing.
Step 204, search cpe device /etc/hosts file in whether there is the IP relation of SNTP server domain name and correspondence, if exist, then perform step 206; Otherwise, perform step 205.
Step 205, structure DNS query message, destination address is the dns address of TR069 passage, and the inquiry in DNS query message is called SNTP server domain name.
Step 206, dns resolution success, deletion strategy route.
It should be noted that, policybased routing in step 203 forwards DNS query message for during dns resolution, such as, the policybased routing that a destination address is the dns address that TR069WAN connects is added in the routing table of TR069 passage, the DNS query message then sent from TR069 passage can forward from this policybased routing, realizes the domain name mapping of SNTP server.
This policybased routing of deletion after dns resolution completes, otherwise when the dns address that the dns address that INTERNETWAN connects is connected with TR069 or VOIPWAN is identical, the data of user's online can be forwarded by TR069 or VOIP passage, thus affect the function of surfing the Net of family gateway equipment.
Step 207, end dns resolution.
The embodiment of the present invention additionally provides and a kind ofly realizes SNTP client time synchronous system, as shown in Figure 3, comprising:
Judging unit 10, judges whether the time synchronized passage of SNTP client is TR069 passage or VOIP passage;
Acquiring unit 20, when the time synchronized passage of SNTP client be TR069 passage or VOIP passage time, the WAN mouth dns address of acquisition time synchronizing channel;
Very first time lock unit 30, when the non-TR069 passage of time synchronized passage or the VOIP passage of SNTP client, SNTP client carries out time synchronized by default route;
First increases unit 40, and in the routing table of time synchronized passage, adding purpose address is the policybased routing of dns address;
Domain name mapping unit 50, carries out domain name mapping by policybased routing to SNTP server;
Delete cells 60, after domain name mapping completes, deletion strategy route;
Second time synchronized unit 70, when the time synchronized passage of SNTP client be TR069 passage or VOIP passage time, build NTP message, SNTP client carries out network service by NTP message and the IP address of the SNTP server parsed, and realizes the time synchronized of SNTP client.
The present invention is not limited to above-mentioned preferred forms, and anyone should learn the structural change made under enlightenment of the present invention, and every have identical or close technical scheme with the present invention, all falls within protection scope of the present invention.

Claims (6)

1. realize a SNTP client time synchronous method, it is characterized in that, comprise the following steps:
Step 101: whether the time synchronized passage judging SNTP client is TR069 passage or VOIP passage, if so, goes to step 102; Otherwise, carry out time synchronized by default route;
Step 102: the WAN mouth dns address of acquisition time synchronizing channel;
Step 103: adding purpose address is the policybased routing of dns address in the routing table of time synchronized passage;
Step 104: domain name mapping is carried out to SNTP server by policybased routing;
Step 105: after domain name mapping completes, deletion strategy route;
Step 106: build NTP message, SNTP client carries out network service by NTP message and the IP address of the SNTP server parsed, and realizes the time synchronized of SNTP client.
2. the method for claim 1, is characterized in that, domain name is resolved and specifically comprised the following steps:
Dns address is obtained from the DNS configuration file of time synchronized passage;
Judge whether this dns address is empty, if so, then terminates; Otherwise adding purpose address is the policybased routing of dns address in the routing table of time synchronized passage;
Search/etc/hosts file in whether there is the IP relation of SNTP server domain name and correspondence, if exist, then dns resolution success, deletion strategy route; Otherwise build DNS query message, forwarded by policybased routing, the inquiry of DNS query message is called SNTP server domain name, deletion strategy route after dns resolution success.
3. the method for claim 1, is characterized in that, if described time synchronized passage has two described dns address, then adds two described policybased routing.
4. realize a SNTP client time synchronous system, it is characterized in that, comprising:
Judging unit, judges whether the time synchronized passage of SNTP client is TR069 passage or VOIP passage;
Acquiring unit, when the time synchronized passage of SNTP client be TR069 passage or VOIP passage time, the WAN mouth dns address of acquisition time synchronizing channel;
Very first time lock unit, when the non-TR069 passage of time synchronized passage or the VOIP passage of SNTP client, SNTP client carries out time synchronized by default route;
First increases unit, and in the routing table of time synchronized passage, adding purpose address is the policybased routing of dns address;
Domain name mapping unit, carries out domain name mapping by policybased routing to SNTP server;
Delete cells, after domain name mapping completes, deletion strategy route;
Second time synchronized unit, when the time synchronized passage of SNTP client be TR069 passage or VOIP passage time, build NTP message, SNTP client carries out network service by NTP message and the IP address of the SNTP server parsed, and realizes the time synchronized of SNTP client.
5. system as claimed in claim 4, it is characterized in that, domain name resolution unit specifically comprises:
Processing unit, obtains dns address from the DNS configuration file of time synchronized passage; Judge whether this dns address is empty, if so, then terminate, otherwise adding purpose address is the policybased routing of dns address in the routing table of time synchronized passage;
Domain name mapping subelement, search/etc/hosts file in whether exist SNTP server domain name and and the IP relation of correspondence, if exist, then dns resolution success, deletion strategy route; Otherwise build DNS query message, forwarded by policybased routing, the inquiry of DNS query message is called SNTP server domain name, deletion strategy route after dns resolution success.
6. system as claimed in claim 4, is characterized in that, also comprise the second increase unit, when described time synchronized passage has two described dns address, add two described policybased routing.
CN201510617535.8A 2015-09-24 2015-09-24 A kind of method and system for realizing that SNTP client times are synchronous Active CN105119679B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510617535.8A CN105119679B (en) 2015-09-24 2015-09-24 A kind of method and system for realizing that SNTP client times are synchronous

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510617535.8A CN105119679B (en) 2015-09-24 2015-09-24 A kind of method and system for realizing that SNTP client times are synchronous

Publications (2)

Publication Number Publication Date
CN105119679A true CN105119679A (en) 2015-12-02
CN105119679B CN105119679B (en) 2017-09-29

Family

ID=54667587

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510617535.8A Active CN105119679B (en) 2015-09-24 2015-09-24 A kind of method and system for realizing that SNTP client times are synchronous

Country Status (1)

Country Link
CN (1) CN105119679B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108540251A (en) * 2018-06-27 2018-09-14 四川斐讯信息技术有限公司 A kind of setting means and system of router
CN111837358A (en) * 2018-03-14 2020-10-27 华为技术有限公司 Distributed network time protocol
CN113489564A (en) * 2021-07-04 2021-10-08 芯河半导体科技(无锡)有限公司 Method for realizing SNTP client time synchronization

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101771661A (en) * 2008-12-29 2010-07-07 华为技术有限公司 Method, device and system for determining clock source
CN101895589A (en) * 2010-07-26 2010-11-24 杭州华三通信技术有限公司 Wide area network router and method for establishing routing table items therein
CN102439905A (en) * 2011-09-30 2012-05-02 华为技术有限公司 Method, device and system of finding network topology automatically
CN104052565A (en) * 2014-06-26 2014-09-17 青岛海信移动通信技术股份有限公司 Time synchronization method and communication terminal
CN104202204A (en) * 2014-09-26 2014-12-10 浙江中控技术股份有限公司 Clock synchronous control method, device and system based on SNTP
CN104202219A (en) * 2014-09-17 2014-12-10 上海斐讯数据通信技术有限公司 Multi-service wan connection binding testing method and system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101771661A (en) * 2008-12-29 2010-07-07 华为技术有限公司 Method, device and system for determining clock source
CN101895589A (en) * 2010-07-26 2010-11-24 杭州华三通信技术有限公司 Wide area network router and method for establishing routing table items therein
CN102439905A (en) * 2011-09-30 2012-05-02 华为技术有限公司 Method, device and system of finding network topology automatically
CN104052565A (en) * 2014-06-26 2014-09-17 青岛海信移动通信技术股份有限公司 Time synchronization method and communication terminal
CN104202219A (en) * 2014-09-17 2014-12-10 上海斐讯数据通信技术有限公司 Multi-service wan connection binding testing method and system
CN104202204A (en) * 2014-09-26 2014-12-10 浙江中控技术股份有限公司 Clock synchronous control method, device and system based on SNTP

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111837358A (en) * 2018-03-14 2020-10-27 华为技术有限公司 Distributed network time protocol
CN111837358B (en) * 2018-03-14 2022-01-11 华为技术有限公司 Method and system for time synchronization in network
US11528084B2 (en) 2018-03-14 2022-12-13 Huawei Technologies Co., Ltd. Distributed network time protocol
CN108540251A (en) * 2018-06-27 2018-09-14 四川斐讯信息技术有限公司 A kind of setting means and system of router
CN113489564A (en) * 2021-07-04 2021-10-08 芯河半导体科技(无锡)有限公司 Method for realizing SNTP client time synchronization

Also Published As

Publication number Publication date
CN105119679B (en) 2017-09-29

Similar Documents

Publication Publication Date Title
US10476795B2 (en) Data packet forwarding
US8649292B2 (en) Method, apparatus and system for virtual network configuration and partition handover
JP6009672B2 (en) Method for synchronizing distribution clocks with a high precision time protocol in a communication network
US20150180672A1 (en) Relay System and Switching Device
WO2017114153A1 (en) Service function chaining (sfc) communication method and device
CN102970227A (en) Method and device for achieving virtual extensible local area network (VXLAN) message transmitting in application specific integrated circuit (ASIC)
EP3026872B1 (en) Packet forwarding method, apparatus, and system
US7839855B2 (en) Layer 2 address translation for service provider wholesale IP sessions
CN103118148B (en) A kind of ARP buffering updating method and equipment
WO2010139238A1 (en) Method and device for implementing mac-forced forwarding
US20100202441A1 (en) Method and apparatus for the user-specific configuration of a communications port
CN101282248B (en) Method for measuring network application performance supporting internet high bandwidth real time video application
RU2012137184A (en) METHOD AND SYSTEM OF REALIZING THE REACH OF THE ROUTE TO THE HOST IN THE RING OF ACCESS TO THE NETWORK OF TRANSFER OF PACKAGES
CN106789725B (en) Method, device and system for realizing traffic redirection
CN102710485B (en) Transparent proxy method and proxy server
CN103166854B (en) LAN and wan business binding method and system
CN105119679A (en) Method and system for realizing SNTP client time synchronization
US8531974B2 (en) Technique for testing peers in multicast network domain
CN102664811B (en) Message forwarding method and device
JP2020188478A (en) Method for synchronizing topology information in sfc network, and routing network element
CN108833232A (en) A kind of pppoe client implementation method and pppoe client based on VPP
EP2567514A1 (en) Interworking between ethernet and mpls
CN109218191B (en) System and method for enabling multicast packets to traverse non-multicast networks
US20090154480A1 (en) Communication control method and system
CN116599775B (en) Asset discovery system and method combining active and passive detection

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant