The invention discloses a timing method and system of a router, including steps: S11. establishing a connection with a computer; S12. obtaining the IP and DNS servers allocated by RouterOS by DHCP; S13. obtaining the time information of NTP servers on RouterOS by directing to the intranet IP of RouterOS. The invention accesses the computer network interface through a router and obtains the RouterOS allocated IP and DNS servers by DHCP, so that the router will be directed to the RouterOS intranet IP when requesting the time information of the domain name written in the internal file, so as to obtain the time information of the NTP server on RouterOS, that is, only the time information of the NTP server on RouterOS is needed. The WAN port of the router to be tested and the computer network port equipped with RouterOS virtual machine can be connected through the network wire to complete the time matching, without removing the router shell and adding welding serial port on the circuit board, which simplifies the operation, saves resources, and guarantees the accuracy of time information obtained by the router from the NTP server. .
【技术实现步骤摘要】
一种路由器的对时方法及系统
本专利技术涉及通信领域,尤其涉及一种路由器的对时方法及系统。
技术介绍
路由器(Router),是连接因特网中各局域网、广域网的设备,它会根据信道的情况自动选择和设定路由,以最佳路径,按前后顺序发送信号。路由器是互联网络的枢纽,用于连接多个逻辑上分开的网络,所谓逻辑网络是代表一个单独的网络或者一个子网。当数据从一个子网传输到另一个子网时,可通过路由器的路由功能来完成。路由器已经成为我们生活中重要的设备之一,而我们在使用无线路由器之前往往需要对无线路由器进行功能测试,经常需要对样机进行对时操作,即将待测路由器的内部时间设定为我们所需要的时间。这种需要在测试无线路由器家长控制和各种定时模块功能的过程中显得尤为重要。然而现有的更改无线路由器内部时钟的方法,往往是依赖于通过串口进入待测样机后台并通过串口命令来修改时间,这就意味着对路由器修改时间时就需要对样机外壳进行拆卸,并在PCB电路板上焊上串口,此外,还需要格外的USB转RS232串口线来实现计算机和样机串口连接,然后修改串口命名实现时间的修改,操作繁琐。公开号为CN106357439A的专利公开了一种更新路由器时间的方法和系统,其中方法包括:当客户端登录路由器时,获取当前客户端的系统时间,并将所述客户端的系统时间和用户登录信息发送给网络服务器;在所述用户登录信息正确的情况下,如果路由器的系统时间和路由器的预设值相同,则所述路由器的系统时间没有同步更新;将所述路由器的系统时间同步更新为所述客户端的系统时间。本专利技术能够。本专利技术即使在网络不通或者时间服务器不正常的情况下,也能够更 ...
【技术保护点】
1.一种路由器的对时方法,其特征在于,包括步骤:S1.与计算机建立连接;S2.通过DHCP方式获取到RouterOS分配的IP和DNS服务器;S3.通过定向到RouterOS的内网IP上获取RouterOS上NTP服务器的时间信息。
【技术特征摘要】
1.一种路由器的对时方法,其特征在于,包括步骤:S1.与计算机建立连接;S2.通过DHCP方式获取到RouterOS分配的IP和DNS服务器;S3.通过定向到RouterOS的内网IP上获取RouterOS上NTP服务器的时间信息。2.根据权利要求1所述的一种路由器的对时方法,其特征在于,所述与计算机建立连接是路由器的WAN口通过网线连接至计算机的网口而建立连接的。3.根据权利要求1所述的一种路由器的对时方法,其特征在于,所述计算机上预先安装有RouterOS虚拟机和winbox配置工具。4.根据权利要求1所述的一种路由器的对时方法,其特征在于,所述路由器为软路由。5.根据权利要求1所述的一种路由器的对时方法,其特征在于,所述NTP服务器中预先添加有所述路由器对时服务器域名与所述RouterOS内网IP的对应关系。6.一种路由器的对...
【专利技术属性】
技术研发人员:李念韩,
申请(专利权)人:四川斐讯信息技术有限公司,
类型:发明
国别省市:四川,51
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。