CN113489564A - Method for realizing SNTP client time synchronization - Google Patents
Method for realizing SNTP client time synchronization Download PDFInfo
- Publication number
- CN113489564A CN113489564A CN202110754046.2A CN202110754046A CN113489564A CN 113489564 A CN113489564 A CN 113489564A CN 202110754046 A CN202110754046 A CN 202110754046A CN 113489564 A CN113489564 A CN 113489564A
- Authority
- CN
- China
- Prior art keywords
- time
- synchronization
- server
- time synchronization
- channel
- 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.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04J—MULTIPLEX COMMUNICATION
- H04J3/00—Time-division multiplex systems
- H04J3/02—Details
- H04J3/06—Synchronising arrangements
- H04J3/0635—Clock or time synchronisation in a network
- H04J3/0638—Clock or time synchronisation among nodes; Internode synchronisation
- H04J3/0658—Clock or time synchronisation among packet nodes
- H04J3/0661—Clock or time synchronisation among packet nodes using timestamps
- H04J3/0667—Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L61/00—Network arrangements, protocols or services for addressing or naming
- H04L61/45—Network directories; Name-to-address mapping
- H04L61/4505—Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
- H04L61/4511—Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses a method for realizing SNTP client time synchronization, which comprises the following steps: configuring a sntp client; judging a channel; obtaining a DNS address and device of an interface of a channel wan; entering a time synchronization server cycle; a DNS resolution time server; if the analysis fails, taking down a time server, and performing cycle operation until the analysis is successful to obtain an IP; connecting, and taking down a time server if the connection fails, and performing cycle operation until the IP connection is successful; and performing time synchronization by adopting a select blocking interval, and if synchronization failure occurs, exiting circulation and taking a second time server. The invention avoids the synchronization failure of a single time server, has main and standby functions and supports 5 ntp time servers to the maximum extent. The interval synchronization is supported, at present, most of the time synchronization is carried out for the first time by electrifying, and the interval time synchronization can be maintained better by the synchronous time synchronization with unfixed intervals.
Description
Technical Field
The invention relates to the technical field of home gateway equipment, in particular to a method for realizing SNTP client time synchronization.
Background
NTP (Network Time protocol) is a Time synchronization protocol defined by RFC 1305, and is used to synchronize Time between a distributed Time server and a client.
At present, ntp synchronous time synchronization has the following defects: 1. along with the adjustment of the networking structure of the household optical modem, if the INTERNET connection is in a bridging networking mode or the INTERNET channel has no time server, time synchronization cannot be realized through a default route; 2. in the past, synchronization is carried out through a single server, and the condition that synchronization cannot be carried out frequently occurs; and 3, the sntp client performs one-time synchronization or unfixed synchronization only when being powered on for the first time, and does not perform periodic synchronization.
The existing patent No. 201510617535.8 discloses a technical solution of a method and a system for realizing SNTP client time synchronization, which uses a policy routing manner, and can solve the first of the above disadvantages, but the remaining two points cannot be solved.
Therefore, the invention provides a method for realizing SNTP client time synchronization by using a static routing mode, which solves the three problems of the defects.
Disclosure of Invention
The present invention aims to provide a method for realizing SNTP client time synchronization, so as to solve the problems proposed in the above background art.
In order to achieve the purpose, the invention provides the following technical scheme:
a method for realizing SNTP client time synchronization comprises the following steps:
(1) and (3) the sntp client side interface is configured, and the interface is configured with a time synchronization channel, synchronization interval time and at most five NTP time servers.
(2) And (4) well configuring an interface, clicking to store, and entering flow processing.
Judging a time synchronization channel, and if the time synchronization channel is INTERNET or other channels, obtaining a DNS address and wan interface device through a default route; if the number is TR069 and VOIP, all IP and PPP connections are traversed, whether the X _ CT _ COM _ ServiceList is TR069 and VIOP is judged, and the corresponding DNS address and wan interface device are obtained.
(3) And entering a time synchronization server cycle according to the configured server.
(4) And D, firstly, acquiring a first time server, resolving the domain name of the time server through the DNS address acquired in the step two and the device of the wan interface, and acquiring a second time server if the resolution fails, and the similar operation is carried out.
(5) And (4) successfully analyzing, obtaining the IP, connecting, and obtaining the second time server for circular operation if the connection fails.
(6) And if the IP connection is successful, performing time synchronization by adopting select blocking intervals, and if the synchronization fails, exiting the cycle and taking the second time server.
Compared with the prior art, the invention has the advantages that:
1. when the family optical modem INTERNET channel has no time server, the time synchronization can not be realized through a default route or a traditional time synchronization mechanism.
2. The synchronization failure of a single time server is avoided, the master time server and the standby time server are provided, and 5 ntp time servers are supported to the maximum extent.
3. The interval synchronization is supported, at present, most of the time synchronization is carried out for the first time by electrifying, and the interval time synchronization can be maintained better by the synchronous time synchronization with unfixed intervals.
Drawings
Fig. 1 is a flowchart of a method for implementing SNTP client time synchronization.
Fig. 2 is a configuration diagram of the sntp client interface in the present invention.
Detailed Description
The technical solution of the present patent will be described in further detail with reference to the following embodiments.
Referring to fig. 1, a method for implementing SNTP client time synchronization includes the following steps:
the (first) sntp client interface configuration is as shown in fig. 2 below:
configuring a time synchronization channel, synchronization interval time and at most five NTP time servers on an interface;
secondly, the interface is configured, clicking and storing are carried out, and the flow chart processing is carried out;
judging a time synchronization channel, and if the time synchronization channel is INTERNET or other channels, obtaining a DNS address and wan interface device through a default route; if the number of the IP addresses is TR069 and VOIP, traversing all IP and PPP connections, and judging whether the X _ CT _ COM _ ServiceList is TR069 and VIOP to obtain the corresponding DNS address and wan interface device;
entering time synchronization server circulation according to the configured server;
firstly, acquiring a first time server, resolving the domain name of the time server through the DNS address acquired in the step two and the device of the wan interface, and acquiring a second time server if the resolution fails, wherein other servers adopt the same kind of operation;
step four, resolving is successful, IP is obtained, connection is carried out, and if connection fails, the second time server is taken for circular operation;
and (VI) if the IP connection is successful, adopting select blocking intervals to carry out time synchronization, and if the synchronization fails, exiting the cycle and taking the second time server.
According to the technical scheme, when multi-channel time synchronization is carried out, DNS can be selected from an Internet channel, tr069 and VOIP channel, and domain name is analyzed to obtain IP for synchronous time synchronization. The technical scheme of the invention supports multiple ntp servers, and one server fails to synchronize and can be switched to a standby server for synchronization.
Although the preferred embodiments of the present patent have been described in detail, the present patent is not limited to the above embodiments, and various changes can be made without departing from the spirit of the present patent within the knowledge of those skilled in the art.
Claims (4)
1. A method for realizing SNTP client time synchronization is characterized by comprising the following steps:
(1) configuring a sntp client interface, and configuring a time synchronization channel, synchronization interval time and a plurality of NTP time servers on the interface;
(2) judging a time synchronization channel to obtain a DNS address and device of a channel wan interface;
(3) entering a time synchronization server cycle according to the configured server;
(4) firstly, acquiring a first time server, resolving a domain name of the time server through the DNS address acquired in the step two and the device of the wan interface, and taking down the time server if the resolution fails;
(5) step (4), resolving successfully, obtaining IP, connecting, and taking down a time server for circular operation if the connection fails;
(6) and if the IP connection is successful, performing time synchronization by adopting select blocking intervals, and if the synchronization fails, exiting the cycle and taking the second time server.
2. A method for realizing SNTP client time synchronization according to claim 1, wherein in step (1), at most five NTP time servers are provided.
3. The method of claim 1, wherein the operations of the other timeservers are the same as the operations of the second timeserver when selecting.
4. The method according to claim 1, wherein the specific determination in step (2) is as follows: judging a time synchronization channel, and if the time synchronization channel is INTERNET or other channels, obtaining a DNS address and wan interface device through a default route; if the number is TR069 and VOIP, all IP and PPP connections are traversed, whether the X _ CT _ COM _ ServiceList is TR069 and VIOP is judged, and the corresponding DNS address and wan interface device are obtained.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110754046.2A CN113489564A (en) | 2021-07-04 | 2021-07-04 | Method for realizing SNTP client time synchronization |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110754046.2A CN113489564A (en) | 2021-07-04 | 2021-07-04 | Method for realizing SNTP client time synchronization |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113489564A true CN113489564A (en) | 2021-10-08 |
Family
ID=77940708
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110754046.2A Pending CN113489564A (en) | 2021-07-04 | 2021-07-04 | Method for realizing SNTP client time synchronization |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113489564A (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1459940A (en) * | 2002-05-21 | 2003-12-03 | 深圳市中兴通讯股份有限公司上海第二研究所 | Method of time synchronization in broad band CDMA |
CN105119679A (en) * | 2015-09-24 | 2015-12-02 | 烽火通信科技股份有限公司 | Method and system for realizing SNTP client time synchronization |
-
2021
- 2021-07-04 CN CN202110754046.2A patent/CN113489564A/en active Pending
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1459940A (en) * | 2002-05-21 | 2003-12-03 | 深圳市中兴通讯股份有限公司上海第二研究所 | Method of time synchronization in broad band CDMA |
CN105119679A (en) * | 2015-09-24 | 2015-12-02 | 烽火通信科技股份有限公司 | Method and system for realizing SNTP client time synchronization |
Non-Patent Citations (2)
Title |
---|
LI88811: "windows系统时间同步及同步频率设置", 《知乎》, pages 1 - 2 * |
网络工程师笔记: "NTP时间同步技术详解", 《知乎》, pages 1 - 3 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11171914B2 (en) | Systems and methods for automatic inventory and DNS record generation | |
CN107613037B (en) | Domain name redirection method and system | |
CN101582925B (en) | Network address translation method and system | |
US8305933B2 (en) | Method and apparatus for detecting devices on a local area network | |
JP2007207231A (en) | Method for accessing distributed service in network | |
JP4361803B2 (en) | Method and apparatus for borrowing parameters for network address translator configuration | |
MacDonald et al. | NAT behavior discovery using session traversal utilities for NAT (STUN) | |
WO2017161965A1 (en) | Method, device, and system for dynamic domain name system (dns) redirection | |
JP2013500653A (en) | Method for providing information, home gateway and home network system | |
EP2690832B1 (en) | Communication device, communication system, and communication method | |
EP1418733B1 (en) | Method for assigning a virtual network identifier to a terminal, terminal and dynamic host configuration server for implementing this method | |
Monir et al. | Application and assessment of click modular firewall vs pox firewall in sdn/nfv framework | |
CN113489564A (en) | Method for realizing SNTP client time synchronization | |
CN105119679B (en) | A kind of method and system for realizing that SNTP client times are synchronous | |
CN114900502B (en) | Network registration method, device, electronic equipment and readable storage medium | |
CN115118700B (en) | Communication method and communication system | |
US20200287784A1 (en) | Priority based selection of time services | |
CN112532765B (en) | Network access method and system thereof | |
Cisco | Device Management | |
JP2007158608A (en) | Sip server | |
JP5054666B2 (en) | VPN connection device, packet control method, and program | |
CN111030988B (en) | Self-feedback dispatching diversion method and system | |
KR19990050416A (en) | IP address translation method providing full access between non-Internet service network and Internet service network | |
JP6001512B2 (en) | Communication control system and communication control method | |
CN108092843B (en) | General test method for router |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |