WO2019057167A1 - Method for obtaining ip address, device, and mobile terminal - Google Patents

Method for obtaining ip address, device, and mobile terminal Download PDF

Info

Publication number
WO2019057167A1
WO2019057167A1 PCT/CN2018/107022 CN2018107022W WO2019057167A1 WO 2019057167 A1 WO2019057167 A1 WO 2019057167A1 CN 2018107022 W CN2018107022 W CN 2018107022W WO 2019057167 A1 WO2019057167 A1 WO 2019057167A1
Authority
WO
WIPO (PCT)
Prior art keywords
address
access point
terminal
access control
wireless access
Prior art date
Application number
PCT/CN2018/107022
Other languages
French (fr)
Chinese (zh)
Inventor
吴兆云
王慧鑫
方燕
袁龙泉
何子龙
周维龙
Original Assignee
惠州Tcl移动通信有限公司
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 惠州Tcl移动通信有限公司 filed Critical 惠州Tcl移动通信有限公司
Publication of WO2019057167A1 publication Critical patent/WO2019057167A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W48/00Access restriction; Network selection; Access point selection
    • H04W48/08Access restriction or access information delivery, e.g. discovery data delivery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W48/00Access restriction; Network selection; Access point selection
    • H04W48/16Discovering, processing access restriction or access information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management

Definitions

  • the present application relates to the field of communications technologies, and in particular, to a method, an apparatus, and a mobile terminal for acquiring an IP address.
  • Wi-Fi networks have become a common wireless network used in people's daily life and work. More and more end users transmit data through WI-FI.
  • DHCP Dynamic Host Configuration Protocol
  • the technical problem to be solved by the present application is to provide a method, a device, and a mobile terminal for obtaining an IP address, which can reduce the time for obtaining an IP address and improve the user experience.
  • the first technical solution adopted by the present application is to provide a device having a storage function, the device storing program data, and the program data can be executed to implement the following operations: establishing with a wireless access point When connecting, reading a preset IP storage list, where the IP storage list includes connection information between the terminal and the wireless access point; and obtaining the medium access control address of the wireless access point and the connection information between the terminal and the wireless access point If the media access control address of the wireless access point exists in the connection information between the terminal and the wireless access point, if the matching is successful, the IP corresponding to the media access control address of the wireless access point is obtained in the IP storage list.
  • connection information includes the IP address, the lease time of the IP address, and the dynamic host configuration protocol server the address of.
  • the second technical solution adopted by the present application is to provide a mobile terminal, the terminal includes a processor and a communication circuit electrically coupled to each other, and the processor is configured to perform the following actions: in the communication circuit and the wireless connection
  • the obtained medium access control address of the wireless access point is matched with the preset IP storage list; if the matching is successful, the medium access control address of the wireless access point is obtained in the IP storage list.
  • Corresponding IP address determining whether the lease time of the IP address is within a preset time range; if yes, controlling the communication circuit to use the IP address and storing the current connection information.
  • the third technical solution adopted by the present application is: providing a method for obtaining an IP address, the method comprising: acquiring a medium of a wireless access point when establishing a connection with a wireless access point; The access control address is matched with the preset IP storage list; if the matching is successful, the IP address corresponding to the media access control address of the wireless access point is obtained in the IP storage list; determining whether the lease time of the IP address is in the first pre- Set the time range; if yes, use the IP address and store the current connection information.
  • the present application provides a method, an apparatus, and a terminal for obtaining an IP address.
  • a method for obtaining an IP address when the connection is established with the wireless access point, the obtained media access control address of the wireless access point is matched with a preset IP storage list, and if the matching is successful, and If the lease time of the IP address is within a preset time range, the IP address can be used, so that the user does not need to reconnect the IP address every time the user connects to the wireless access point, thereby saving the time for connecting the wireless access point and improving The user experience.
  • FIG. 1 is a schematic flowchart of a first embodiment of a method for obtaining an IP address according to the present application
  • step S101 in the method for obtaining an IP address in the present application
  • FIG. 3 is a schematic flowchart of a second embodiment of a method for obtaining an IP address according to the present application
  • step S301 is a schematic diagram of a specific implementation process of step S301 in the method for obtaining an IP address in the present application
  • FIG. 5 is a schematic structural diagram of a mobile terminal according to the present application.
  • FIG. 6 is another schematic structural diagram of a mobile terminal according to the present application.
  • FIG. 7 is a schematic structural diagram of an apparatus having a storage function according to the present application.
  • An Access Point is a wireless network access point, commonly known as a "hot spot.” Its function is to connect the wired signal to the wireless network after it is connected to the wired network, and the notebook or other terminal device accesses the wireless Wi-Fi local area network by receiving the signal transmitted by it.
  • DHCP Dynamic Host Configuration Protocol
  • the Address Resolution Protocol is a TCP/IP protocol that obtains a physical address based on an IP address.
  • the host sends the information, it broadcasts the ARP request containing the target IP address to all hosts on the network, and receives the return message to determine the physical address of the target. After receiving the return message, the IP address and physical address are stored in the local ARP.
  • the cache keeps a certain amount of time, and the next time the request is made, the ARP cache is directly queried to save resources.
  • Acknowledgement is a transmission type control character that the receiving station sends to the transmitting station in data communication. Indicates that the data sent has been confirmed to be correct.
  • the media access address (Media Access Control or Medium Access Control, MAC) is used to define the location of the network device.
  • the Layer 3 network layer is responsible for the IP address
  • the Layer 2 data link layer is responsible for the MAC address. Therefore, a host will have a MAC address, and each network location will have an IP address specific to it.
  • FIG. 1 is a schematic flowchart of a first embodiment of a method for obtaining an IP address according to the present application.
  • the execution body in this embodiment may be a terminal (such as a notebook, a computer, a mobile phone, a wearable device, etc.).
  • the terminal can be implemented by hardware or software.
  • the method of the present embodiment is not limited to the sequence of the flow shown in FIG. 1 if substantially the same result is obtained. As shown, the method includes the following steps:
  • the obtained media access control address of the wireless access point is matched with a preset IP storage list.
  • FIG. 2 is a schematic flowchart of a specific implementation process of further expanding the step S101 in the first embodiment, and the wireless device obtained in this embodiment is obtained on the basis of the first embodiment of the present application.
  • the matching of the media access control address of the access point with the preset IP storage list includes the following steps:
  • the preset IP storage list is read, wherein the IP storage list includes connection information of the terminal and the wireless access point.
  • connection information includes the IP address, a lease time of the IP address, and an address of the dynamic host configuration protocol server.
  • the obtained media access control address of the wireless access point is matched with the connection information of the terminal and the wireless access point.
  • the MAC address of the AP is obtained, and the preset IP storage list is read, where the IP storage list stores the connection information of the AP connected to the AP each time, and the MAC of the AP is The address is used as the query condition to match the preset IP storage list. If the corresponding MAC address is found in the IP storage list, the matching is successful, that is, the terminal has previously connected to the AP; if the IP storage list is not found in the IP storage list The corresponding MAC address indicates that the matching is unsuccessful, that is, the terminal has not connected to the AP before.
  • the terminal is not connected to the AP, and the DHCP Discovery message is sent.
  • the AP forwards the DHCP Discovery to each DHCP server in the network.
  • the DHCP Discovery message the IP address assigned to the terminal is carried in the DHCP offer message and sent to the terminal by using the AP, and the terminal selects a DHCP offer message.
  • the IP address in the IP address is used as the selected IP address, and the DHCP request message carrying the selected IP address is sent; after receiving the DHCP request message, the AP forwards the DHCP request message to each DHCP server in the network; After receiving the DHCP request message, the DHCP server of the selected IP address saves the entry of the wireless client, and the selected IP address is carried in the DHCP ACK message and sent to the terminal by using the AP.
  • the IP address in the DHCP ACK packet is used as the finally obtained IP address.
  • T1 is set to August 1st, 2017 at 08:00:00 (year, month, day, hour, minute and second), T2 is set to 240 hours, then T0 is August 1, 2017, 08:00:00 + 192 hours. That is, at 08:00:00 on August 9, 2017, if the current system time is 11:15:20 on August 8, 2017, then T0 is greater than the current system time, and the lease time of the IP address is determined to be in the first If the current system time is 08:15:20 on August 10, 2017, T0 is less than the current system time, and it is determined that the lease time of the IP address is not within the first preset time range.
  • the IP address lease time refers to the expiration date of the IP address configuration information acquired by the client computer at the DHCP server. After the client automatically obtains an IP address, it usually has a certain period of use. After the deadline, you need to re-apply for an IP address. However, frequent IP address changes can cause trouble for management. User search can make the client computer have permanent access to the IP address by setting the IP address lease term.
  • the first preset time is a time value set according to the lease time. If it is within the first preset time range, it indicates that the IP address can continue to be used; if not within the first preset time range, it indicates When the lease expires, you need to re-apply for an IP address.
  • the obtained medium access control address of the wireless access point is matched with the preset IP storage list, and if the matching is successful, If the lease time of the IP address is within the preset time range, the IP address can be used, which enables the user to reconnect the IP address each time the wireless access point is connected, saving the time for connecting the wireless access point and improving the time. user experience.
  • FIG. 3 is a schematic flowchart of a method for obtaining an IP address according to a second embodiment of the present application. This embodiment includes:
  • FIG. 4 is a schematic diagram of a specific implementation process of further expanding the step S301 in the second embodiment, which is based on the first embodiment of the present application. Determining whether the IP address is already occupied includes the following steps:
  • an encapsulated address resolution protocol broadcast packet is sent; wherein the address resolution protocol broadcast packet includes the IP address and a source medium access control address of the terminal.
  • the ARP broadcast packet is encapsulated, and the obtained IP address is set as the source address and the destination address of the ARP broadcast packet, and the MAC address of the terminal is set as the source MAC address, and the destination MAC address is set to all 00, as the broadcast mode, and then The encapsulated ARP broadcast packet is sent out.
  • the IP address is determined to be occupied.
  • the terminal determines that the IP address conflict occurs, that is, the IP address. Already occupied.
  • the IP address is determined to be unoccupied.
  • the terminal receives the corresponding ARP response, and the response is analyzed to find that the MAC address corresponding to the IP address queried by the current terminal is owned by the current terminal, it is determined that the terminal does not have an IP address conflict, that is, the IP address. Not occupied.
  • the current IP address is used. Otherwise, the process of obtaining an IP address in the case where the matching is unsuccessful in the first embodiment is not described here.
  • the current connection information is stored when the terminal connects to the wireless access point, and the connection information is provided for the next connection to the wireless access point.
  • the address resolution protocol response that the IP address is not occupied is returned, or the dynamic information returned by the dynamic host configuration protocol server is received.
  • the host configures the protocol response message, and then obtains the IP address according to the method of sending the DHCP Discovery packet.
  • the ARP broadcast packet is sent to determine that the IP address is not occupied, and the dynamic host configuration protocol request message frame is sent to the dynamic host.
  • the dynamic host configuration protocol response message acquires the IP address and stores current connection information. Therefore, each time the user uses the terminal to connect to the wireless access point, the IP address does not need to be reconnected, which saves the time for connecting the wireless access point and improves the user experience.
  • FIG. 5 is a schematic structural diagram of a mobile terminal.
  • the mobile terminal 50 includes a processor 501 and a communication circuit 502 electrically coupled to each other.
  • the processor 501 can be configured to: when the communication circuit 502 establishes a connection with the wireless access point, match the obtained media access control address of the wireless access point with a preset IP storage list; if the matching is successful, Obtaining an IP address corresponding to the media access control address of the wireless access point in the IP storage list; determining whether the lease time of the IP address is within a preset time range; if yes, controlling the communication circuit 502 uses the IP address and stores the current connection information.
  • the specific working process of the processor 501 and the communication circuit 502 is as described above with reference to the method for obtaining an IP address, and details are not described herein again.
  • the embodiment provides a mobile terminal, where the mobile terminal includes a processor and a communication circuit electrically coupled to each other.
  • the processor matches the obtained media access control address of the wireless access point with a preset IP storage list when the communication circuit establishes a connection with the wireless access point, and if the matching is successful, and the IP address is If the lease time is within the preset time range, the IP address can be used, which enables the user to reconnect the IP address each time the wireless access point is connected, saving the time for connecting the wireless access point and improving the user experience.
  • FIG. 6 is another schematic structural diagram of a mobile terminal according to the present application.
  • a mobile terminal 60 further includes: a transceiver 601 coupled to the processor 501.
  • the transceiver 601 can be configured to: if the lease time of the IP address is not within the first preset time range, send an address resolution protocol broadcast packet to determine whether the IP address is already occupied, and send a dynamic host configuration protocol request message frame. Go to the Dynamic Host Configuration Protocol server to request the assignment of the IP address.
  • the transceiver 601 is further configured to send the encapsulated address resolution protocol broadcast packet, where the address resolution protocol broadcast packet includes the IP address and a source medium access control address of the terminal.
  • the processor 501 is specifically configured to determine whether the address resolution protocol broadcast packet is received in the second preset time range, and the address resolution protocol response that is not occupied by the IP address is returned, and the dynamic host configuration protocol server is received.
  • the returned dynamic host configuration protocol response message if yes, the IP address is obtained from the dynamic host configuration protocol response message, and the current connection information is stored.
  • the processor 501 is further configured to: parse the address resolution protocol response corresponding to the address resolution protocol broadcast packet that is received, and display the media access control address corresponding to the IP address in the parsing result If the source medium access control address of the terminal is different, it is determined that the IP address is already occupied; or
  • the media access control address corresponding to the IP address is the same as the source media access control address of the terminal, it is determined that the IP address is not occupied.
  • the specific working process of the processor 501 and the communication circuit 601 is as described above with reference to the method for obtaining an IP address, and details are not described herein again.
  • FIG. 7 is a schematic structural diagram of an apparatus having a storage function.
  • the apparatus 70 having a storage function stores program data 701 thereon, and the program data 701 can be executed to implement the foregoing acquisition.
  • the present invention provides a method, an apparatus, and a terminal for acquiring an IP address, which are different from the prior art.
  • a method for obtaining an IP address when the connection is established with the wireless access point, the obtained media access control address of the wireless access point is matched with a preset IP storage list, and if the matching is successful, and If the lease time of the IP address is within a preset time range, the IP address can be used, so that the user does not need to reconnect the IP address every time the user connects to the wireless access point, thereby saving the time for connecting the wireless access point and improving The user experience.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Small-Scale Networks (AREA)

Abstract

Disclosed in the present application are a method for obtaining an IP address, a device, and a terminal. In the provided method for obtaining an IP address, an obtained medium access control address of a wireless access point is matched with a preset IP storage list when establishing a connection with the wireless access point, and if the matching succeeds and the lease time of an IP address is within a preset time range, the IP address can be used. Thus, a user does not need to reconnect to the IP address during each connection to the wireless access point, thereby reducing the time for connecting to the wireless access point and improving the user experience.

Description

获取IP地址的方法、装置及移动终端Method, device and mobile terminal for obtaining IP address 技术领域Technical field
本申请涉及通信技术领域,特别是涉及一种获取IP地址的方法、装置及移动终端。The present application relates to the field of communications technologies, and in particular, to a method, an apparatus, and a mobile terminal for acquiring an IP address.
背景技术Background technique
目前,无线局域网(Wireless Fidelity,Wi-Fi)网络已经成为人们日常生活和工作中常用的一种无线网络,越来越多的终端用户通过WI-FI传输数据。At present, Wireless Fidelity (Wi-Fi) networks have become a common wireless network used in people's daily life and work. More and more end users transmit data through WI-FI.
在传统方式中,用户在使用终端接入无线接入点(Access Point,AP)时,终端需要先通过动态主机配置协议(Dynamic Host Configuration Protocol,DHCP)请求获得IP地址,以访问外部网络,但是,通过DHCP需要较长的时间才能获取到IP地址,并且用户每次连接AP时,都需要重复这个过程,耗时长,用户体验差。In the traditional mode, when a user accesses a wireless access point (AP), the terminal needs to obtain an IP address through a Dynamic Host Configuration Protocol (DHCP) to access the external network. It takes a long time to obtain an IP address through DHCP, and each time the user connects to the AP, the process needs to be repeated, which takes a long time and has a poor user experience.
发明内容Summary of the invention
本申请主要解决的技术问题是提供一种获取IP地址的方法、装置及移动终端,能够减少获取IP地址的时间,提高用户体验。The technical problem to be solved by the present application is to provide a method, a device, and a mobile terminal for obtaining an IP address, which can reduce the time for obtaining an IP address and improve the user experience.
为解决上述技术问题,本申请采用的第一个技术方案是:提供一种具有存储功能的装置,该装置存储有程序数据,程序数据能够被执行以实现如下操作:在与无线接入点建立连接时,读取预设的IP存储列表,其中IP存储列表包括终端与无线接入点的连接信息;将获取到的无线接入点的媒质访问控制地址与终端与无线接入点的连接信息进行匹配;若无线接入点的媒质访问控制地址存在于终端与无线接入点的连接信息中,则匹配成功,则在IP存储列表中获取与无线接入点的媒质访问控制地址对应的IP地址;判断IP地址的租约时间是否在第一预设时间范围 内;若是,则使用IP地址,并存储当前的连接信息,其中连接信息包括IP地址、IP地址的租约时间、动态主机配置协议服务器的地址。In order to solve the above technical problem, the first technical solution adopted by the present application is to provide a device having a storage function, the device storing program data, and the program data can be executed to implement the following operations: establishing with a wireless access point When connecting, reading a preset IP storage list, where the IP storage list includes connection information between the terminal and the wireless access point; and obtaining the medium access control address of the wireless access point and the connection information between the terminal and the wireless access point If the media access control address of the wireless access point exists in the connection information between the terminal and the wireless access point, if the matching is successful, the IP corresponding to the media access control address of the wireless access point is obtained in the IP storage list. Address; determining whether the lease time of the IP address is within the first preset time range; if yes, using the IP address and storing the current connection information, wherein the connection information includes the IP address, the lease time of the IP address, and the dynamic host configuration protocol server the address of.
为解决上述技术问题,本申请采用的第二个技术方案是:提供一种移动终端,该终端包括相互电性耦合的处理器和通信电路,处理器用于执行如下动作:在通信电路与无线接入点建立连接时,将获取到的无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配;若匹配成功,则在IP存储列表中获取与无线接入点的媒质访问控制地址对应的IP地址;判断IP地址的租约时间是否在预设时间范围内;若是,则控制通信电路使用IP地址,并存储当前的连接信息。In order to solve the above technical problem, the second technical solution adopted by the present application is to provide a mobile terminal, the terminal includes a processor and a communication circuit electrically coupled to each other, and the processor is configured to perform the following actions: in the communication circuit and the wireless connection When the connection is established, the obtained medium access control address of the wireless access point is matched with the preset IP storage list; if the matching is successful, the medium access control address of the wireless access point is obtained in the IP storage list. Corresponding IP address; determining whether the lease time of the IP address is within a preset time range; if yes, controlling the communication circuit to use the IP address and storing the current connection information.
为解决上述技术问题,本申请采用的第三个技术方案是:提供一种获取IP地址的方法,该方法包括:在与无线接入点建立连接时,将获取到的无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配;若匹配成功,则在IP存储列表中获取与无线接入点的媒质访问控制地址对应的IP地址;判断IP地址的租约时间是否在第一预设时间范围内;若是,则使用IP地址,并存储当前的连接信息。To solve the above technical problem, the third technical solution adopted by the present application is: providing a method for obtaining an IP address, the method comprising: acquiring a medium of a wireless access point when establishing a connection with a wireless access point; The access control address is matched with the preset IP storage list; if the matching is successful, the IP address corresponding to the media access control address of the wireless access point is obtained in the IP storage list; determining whether the lease time of the IP address is in the first pre- Set the time range; if yes, use the IP address and store the current connection information.
本申请的有益效果是:区别于现有技术的情况,本申请提供一种获取IP地址的方法、装置及终端。通过提供一种获取IP地址的方法,在与无线接入点建立连接时,将获取到的所述无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配,若匹配成功,且所述IP地址的租约时间在预设时间范围内,则可以使用IP地址,能够使用户每次连接无线接入点时,不需要重新连接IP地址,节约了连接无线接入点的时间,提高了用户体验。The beneficial effects of the present application are: different from the prior art, the present application provides a method, an apparatus, and a terminal for obtaining an IP address. By providing a method for obtaining an IP address, when the connection is established with the wireless access point, the obtained media access control address of the wireless access point is matched with a preset IP storage list, and if the matching is successful, and If the lease time of the IP address is within a preset time range, the IP address can be used, so that the user does not need to reconnect the IP address every time the user connects to the wireless access point, thereby saving the time for connecting the wireless access point and improving The user experience.
附图说明DRAWINGS
图1是本申请获取IP地址的方法第一实施例的流程示意图;1 is a schematic flowchart of a first embodiment of a method for obtaining an IP address according to the present application;
图2是本申请获取IP地址的方法中步骤S101的具体实现流程示意图;2 is a schematic flowchart of a specific implementation process of step S101 in the method for obtaining an IP address in the present application;
图3是本申请获取IP地址的方法第二实施例的流程示意图;3 is a schematic flowchart of a second embodiment of a method for obtaining an IP address according to the present application;
图4是本申请获取IP地址的方法中步骤S301的具体实现流程示意 图;4 is a schematic diagram of a specific implementation process of step S301 in the method for obtaining an IP address in the present application;
图5是本申请一种移动终端的结构示意图;FIG. 5 is a schematic structural diagram of a mobile terminal according to the present application; FIG.
图6是本申请一种移动终端的另一结构示意图;6 is another schematic structural diagram of a mobile terminal according to the present application;
图7是本申请一种具有存储功能的装置的结构示意图。FIG. 7 is a schematic structural diagram of an apparatus having a storage function according to the present application.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述。The technical solutions in the embodiments of the present application will be clearly and completely described in the following with reference to the accompanying drawings in the embodiments.
无线接入点(Access Point,AP)是一个无线网络的接入点,俗称“热点”。它的作用是把它接入有线网络后把有线信号转为无线网络,笔记本或其他终端设备通过接受它发射的信号接入无线Wi-Fi局域网。An Access Point (AP) is a wireless network access point, commonly known as a "hot spot." Its function is to connect the wired signal to the wireless network after it is connected to the wired network, and the notebook or other terminal device accesses the wireless Wi-Fi local area network by receiving the signal transmitted by it.
动态主机配置协议(Dynamic Host Configuration Protocol,DHCP)是一个局域网的网络协议,使用UDP协议工作,主要有两个用途:给内部网络或网络服务供应商自动分配IP地址;给用户或者内部网络管理员作为对所有计算机作中央管理的手段,在RFC 2131中有详细的描述。The Dynamic Host Configuration Protocol (DHCP) is a LAN network protocol that works with the UDP protocol and has two main purposes: to automatically assign IP addresses to internal networks or network service providers; to users or internal network administrators. As a means of central management of all computers, it is described in detail in RFC 2131.
地址解析协议(Address Resolution Protocol,ARP)是根据IP地址获取物理地址的一个TCP/IP协议。主机发送信息时将包含目标IP地址的ARP请求广播到网络上的所有主机,并接收返回消息,以此确定目标的物理地址;收到返回消息后将该IP地址和物理地址存入本机ARP缓存中并保留一定时间,下次请求时直接查询ARP缓存以节约资源。The Address Resolution Protocol (ARP) is a TCP/IP protocol that obtains a physical address based on an IP address. When the host sends the information, it broadcasts the ARP request containing the target IP address to all hosts on the network, and receives the return message to determine the physical address of the target. After receiving the return message, the IP address and physical address are stored in the local ARP. The cache keeps a certain amount of time, and the next time the request is made, the ARP cache is directly queried to save resources.
确认字符(Acknowledgement,ACK)即在数据通信中,接收站发给发送站的一种传输类控制字符。表示发来的数据已确认接收无误。Acknowledgement (ACK) is a transmission type control character that the receiving station sends to the transmitting station in data communication. Indicates that the data sent has been confirmed to be correct.
媒质访问地址(Media Access Control或者Medium Access Control,MAC),用来定义网络设备的位置。在OSI模型中,第三层网络层负责IP地址,第二层数据链路层则负责MAC地址。因此一个主机会有一个MAC地址,而每个网络位置会有一个专属于它的IP地址。The media access address (Media Access Control or Medium Access Control, MAC) is used to define the location of the network device. In the OSI model, the Layer 3 network layer is responsible for the IP address, and the Layer 2 data link layer is responsible for the MAC address. Therefore, a host will have a MAC address, and each network location will have an IP address specific to it.
请参阅图1,图1是本申请获取IP地址的方法第一实施例的流程示意图,本实施例中的执行主体,可以为终端(譬如笔记本、电脑、手机、可穿戴设备等),所述终端可以采用硬件或者软件的方式实现。另外, 需注意的是,若有实质上相同的结果,本实施例的方法并不以图1所示的流程顺序为限。如图所示,该方法包括以下步骤:Referring to FIG. 1 , FIG. 1 is a schematic flowchart of a first embodiment of a method for obtaining an IP address according to the present application. The execution body in this embodiment may be a terminal (such as a notebook, a computer, a mobile phone, a wearable device, etc.). The terminal can be implemented by hardware or software. In addition, it should be noted that the method of the present embodiment is not limited to the sequence of the flow shown in FIG. 1 if substantially the same result is obtained. As shown, the method includes the following steps:
在S101中,在与无线接入点建立连接时,将获取到的所述无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配。In S101, when establishing a connection with the wireless access point, the obtained media access control address of the wireless access point is matched with a preset IP storage list.
可选地,请参阅图2,图2是在本申请第一实施例的基础上,对第一实施例中S101步骤的进一步扩展的具体实现流程示意图,本实施例将获取到的所述无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配包括以下步骤:Optionally, please refer to FIG. 2. FIG. 2 is a schematic flowchart of a specific implementation process of further expanding the step S101 in the first embodiment, and the wireless device obtained in this embodiment is obtained on the basis of the first embodiment of the present application. The matching of the media access control address of the access point with the preset IP storage list includes the following steps:
在S201中,读取所述预设的IP存储列表,其中,所述IP存储列表包括所述终端与所述无线接入点的连接信息。In S201, the preset IP storage list is read, wherein the IP storage list includes connection information of the terminal and the wireless access point.
可选地,所述连接信息包括所述IP地址、所述IP地址的租约时间、所述动态主机配置协议服务器的地址。Optionally, the connection information includes the IP address, a lease time of the IP address, and an address of the dynamic host configuration protocol server.
在S202中,将获取到的所述无线接入点的媒质访问控制地址与所述终端与所述无线接入点的连接信息进行匹配。In S202, the obtained media access control address of the wireless access point is matched with the connection information of the terminal and the wireless access point.
在S203中,若所述无线接入点的媒质访问控制地址存在于所述终端与所述无线接入点的连接信息中,则匹配成功。In S203, if the media access control address of the wireless access point exists in the connection information between the terminal and the wireless access point, the matching is successful.
具体地,当与AP建立成功的物理连接时,获取AP的MAC地址,读取预设的IP存储列表,其中,该IP存储列表中存储了终端每次连接AP的连接信息,将AP的MAC地址作为查询条件,与预设的IP存储列表进行匹配,若在IP存储列表中找到了对应的MAC地址,则表示匹配成功,即终端此前连接过该AP;若在IP存储列表中找不到对应的MAC地址,则表示匹配不成功,即终端此前未连接过该AP。Specifically, when a successful physical connection is established with the AP, the MAC address of the AP is obtained, and the preset IP storage list is read, where the IP storage list stores the connection information of the AP connected to the AP each time, and the MAC of the AP is The address is used as the query condition to match the preset IP storage list. If the corresponding MAC address is found in the IP storage list, the matching is successful, that is, the terminal has previously connected to the AP; if the IP storage list is not found in the IP storage list The corresponding MAC address indicates that the matching is unsuccessful, that is, the terminal has not connected to the AP before.
可选地,若匹配不成功,则表示终端此前未连接过该AP,则发送DHCP Discovery报文,所述AP接收到所述DHCP Discovery报文后,向网络中各个DHCP服务器转发所述DHCP Discovery报文,各个DHCP服务器接收到所述DHCP Discovery报文,将为所述终端分配的IP地址携带在DHCP offer报文中通过所述AP发送给所述终端,所述终端选择一个DHCP offer报文中的IP地址作为选定的IP地址,并发送携带选定IP地址的DHCP request报文;所述AP接收到DHCP request报文后,向 网络中的各个DHCP服务器转发该DHCP request报文;分配选定IP地址的DHCP服务器接收到DHCP request报文后,保存该无线客户端的表项,并将该选定IP地址携带在DHCP ACK报文中通过所述AP发送给所述终端,所述终端将所述DHCP ACK报文中的IP地址作为最终获取的IP地址。Optionally, if the matching is unsuccessful, the terminal is not connected to the AP, and the DHCP Discovery message is sent. After receiving the DHCP Discovery message, the AP forwards the DHCP Discovery to each DHCP server in the network. And receiving, by the DHCP server, the DHCP Discovery message, the IP address assigned to the terminal is carried in the DHCP offer message and sent to the terminal by using the AP, and the terminal selects a DHCP offer message. The IP address in the IP address is used as the selected IP address, and the DHCP request message carrying the selected IP address is sent; after receiving the DHCP request message, the AP forwards the DHCP request message to each DHCP server in the network; After receiving the DHCP request message, the DHCP server of the selected IP address saves the entry of the wireless client, and the selected IP address is carried in the DHCP ACK message and sent to the terminal by using the AP. The IP address in the DHCP ACK packet is used as the finally obtained IP address.
在本申请实施例中,在与无线接入点建立连接时,将获取到的所述无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配,根据匹配的结果执行其对应的操作,能够提高连接AP的效率。In the embodiment of the present application, when establishing a connection with the wireless access point, matching the obtained media access control address of the wireless access point with a preset IP storage list, and performing corresponding correspondence according to the matching result. Operation can improve the efficiency of connecting APs.
在S102中,若匹配成功,则在所述IP存储列表中获取与所述无线接入点的媒质访问控制地址对应的IP地址。In S102, if the matching is successful, an IP address corresponding to the medium access control address of the wireless access point is obtained in the IP storage list.
在S103中,判断所述IP地址的租约时间是否在第一预设时间范围内。In S103, it is determined whether the lease time of the IP address is within a first preset time range.
可选地,所述判断所述IP地址的租约时间是否在第一预设时间范围内包括:按照如下公式计算第一预设时间:T0=T1+T2*0.8;其中,T0为所述第一预设时间,T1为第一次获取所述IP地址的时间,T2为所述租约时间;若T0大于当前系统时间,则确定所述IP地址的租约时间在所述第一预设时间范围内;若T0小于或等于当前系统时间,则确定所述IP地址的租约时间不在所述第一预设时间范围内。Optionally, the determining whether the lease time of the IP address is within a first preset time range comprises: calculating a first preset time according to the following formula: T0=T1+T2*0.8; wherein, T0 is the foregoing a predetermined time, T1 is the time when the IP address is acquired for the first time, and T2 is the lease time; if T0 is greater than the current system time, determining that the lease time of the IP address is in the first preset time range If the T0 is less than or equal to the current system time, it is determined that the lease time of the IP address is not within the first preset time range.
例如:T1设定为2017年8月1日08:00:00(年月日时分秒),T2设定为240小时,则T0为2017年8月1日08:00:00+192小时,即为2017年8月9日08:00:00,若当前系统时间为2017年8月8日11:15:20,则T0大于当前系统时间,确定所述IP地址的租约时间在所述第一预设时间范围内;若当前系统时间为2017年8月10日08:15:20,则T0小于当前系统时间,确定所述IP地址的租约时间不在所述第一预设时间范围内。For example: T1 is set to August 1st, 2017 at 08:00:00 (year, month, day, hour, minute and second), T2 is set to 240 hours, then T0 is August 1, 2017, 08:00:00 + 192 hours. That is, at 08:00:00 on August 9, 2017, if the current system time is 11:15:20 on August 8, 2017, then T0 is greater than the current system time, and the lease time of the IP address is determined to be in the first If the current system time is 08:15:20 on August 10, 2017, T0 is less than the current system time, and it is determined that the lease time of the IP address is not within the first preset time range.
在本申请实施例中,IP地址租约时间是指客户端计算机在DHCP服务器所获取的IP地址配置信息的使用期限。客户端在自动获取一个IP地址后,一般会有一定的使用期限,期限过后需要重新申请IP地址。然而频繁的IP地址变动会给管理工作带来麻烦,用户搜索可以通过设置 IP地址租约期限使客户端计算机拥有IP地址的永久使用权。第一预设时间为根据租约时间而设定的一个时间值,如果在第一预设时间范围内,则表示,所述IP地址可以继续使用;如果不在第一预设时间范围内,则表示,租约期满,需要重新申请IP地址。In the embodiment of the present application, the IP address lease time refers to the expiration date of the IP address configuration information acquired by the client computer at the DHCP server. After the client automatically obtains an IP address, it usually has a certain period of use. After the deadline, you need to re-apply for an IP address. However, frequent IP address changes can cause trouble for management. User search can make the client computer have permanent access to the IP address by setting the IP address lease term. The first preset time is a time value set according to the lease time. If it is within the first preset time range, it indicates that the IP address can continue to be used; if not within the first preset time range, it indicates When the lease expires, you need to re-apply for an IP address.
在S104中,若是,则使用所述IP地址,并存储当前的连接信息。In S104, if yes, the IP address is used and the current connection information is stored.
以上可以看出,本实施例通过在与无线接入点建立连接时,将获取到的所述无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配,若匹配成功,且所述IP地址的租约时间在预设时间范围内,则可以使用IP地址,能够使用户每次连接无线接入点时,不需要重新连接IP地址,节约了连接无线接入点的时间,提高了用户体验。It can be seen that, in this embodiment, when the connection is established with the wireless access point, the obtained medium access control address of the wireless access point is matched with the preset IP storage list, and if the matching is successful, If the lease time of the IP address is within the preset time range, the IP address can be used, which enables the user to reconnect the IP address each time the wireless access point is connected, saving the time for connecting the wireless access point and improving the time. user experience.
请参阅图3,图3是本申请获取IP地址的方法第二实施例的流程示意图,本实施例包括:Referring to FIG. 3, FIG. 3 is a schematic flowchart of a method for obtaining an IP address according to a second embodiment of the present application. This embodiment includes:
在S301中,若所述IP地址的租约时间不在所述第一预设时间范围内,则发送地址解析协议广播包以判断所述IP地址是否已经被占用,同时发送动态主机配置协议请求消息帧至动态主机配置协议服务器以请求分配所述IP地址。In S301, if the lease time of the IP address is not within the first preset time range, sending an address resolution protocol broadcast packet to determine whether the IP address is already occupied, and sending a dynamic host configuration protocol request message frame. Go to the Dynamic Host Configuration Protocol server to request the assignment of the IP address.
可选地,请参阅图4,图4是在本申请第一实施例的基础上,对第二实施例中S301步骤的进一步扩展的具体实现流程示意图,本实施例发送地址解析协议广播包以判断所述IP地址是否已经被占用包括以下步骤:Optionally, please refer to FIG. 4. FIG. 4 is a schematic diagram of a specific implementation process of further expanding the step S301 in the second embodiment, which is based on the first embodiment of the present application. Determining whether the IP address is already occupied includes the following steps:
在S401中,发送已封装的地址解析协议广播包;其中,所述地址解析协议广播包包括所述IP地址以及终端的源媒质访问控制地址。In S401, an encapsulated address resolution protocol broadcast packet is sent; wherein the address resolution protocol broadcast packet includes the IP address and a source medium access control address of the terminal.
具体地,封装ARP广播包,将获取的IP地址设为ARP广播包的源地址和目的地址,将终端的MAC地址设置为源MAC地址,目的MAC地址设置为全00,作为广播方式,然后将封装好的ARP广播包发送出去。Specifically, the ARP broadcast packet is encapsulated, and the obtained IP address is set as the source address and the destination address of the ARP broadcast packet, and the MAC address of the terminal is set as the source MAC address, and the destination MAC address is set to all 00, as the broadcast mode, and then The encapsulated ARP broadcast packet is sent out.
在S402中,对接收到返回的对应于所述地址解析协议广播包的地址解析协议响应进行解析。In S402, the address resolution protocol response corresponding to the address resolution protocol broadcast packet received and received is analyzed.
在S403中,若所述解析结果中显示所述IP地址对应的媒质访问控 制地址与所述移动终端的源媒质访问控制地址不同,则确定所述IP地址已经被占用。In S403, if the media access control address corresponding to the IP address is different from the source media access control address of the mobile terminal, the IP address is determined to be occupied.
具体地,如果终端有收到对应的ARP响应,对该响应进行解析得知当前终端所查询的IP地址所对应的MAC地址并非当前终端所有,则判断终端出现了IP地址冲突情况,即IP地址已经被占用。Specifically, if the terminal receives the corresponding ARP response, and the response is analyzed to find that the MAC address corresponding to the IP address queried by the current terminal is not the current terminal, the terminal determines that the IP address conflict occurs, that is, the IP address. Already occupied.
在S404中,若所述解析结果中显示所述IP地址对应的媒质访问控制地址与所述移动终端的源媒质访问控制地址相同,则确定所述IP地址未被占用。In S404, if the media access control address corresponding to the IP address is the same as the source media access control address of the mobile terminal, the IP address is determined to be unoccupied.
具体地,如果终端有收到对应的ARP响应,对该响应进行解析得知当前终端所查询的IP地址所对应的MAC地址为当前终端所有,则判断终端没有出现IP地址冲突情况,即IP地址未被占用。Specifically, if the terminal receives the corresponding ARP response, and the response is analyzed to find that the MAC address corresponding to the IP address queried by the current terminal is owned by the current terminal, it is determined that the terminal does not have an IP address conflict, that is, the IP address. Not occupied.
在S302中,判断是否在第二预设时间范围内接收到所述地址解析协议广播包返回所述IP地址未被占用的地址解析协议响应,且接收到所述动态主机配置协议服务器返回的动态主机配置协议应答消息。In S302, it is determined whether the address resolution protocol broadcast packet is received in the second preset time range, and the address resolution protocol response that the IP address is not occupied is returned, and the dynamic information returned by the dynamic host configuration protocol server is received. The host configures the protocol reply message.
具体地,当通过ARP解析得治IP地址未被占用,并且DHCP服务器在第一预设时间范围内返回DHCP ACK消息,则使用当前IP地址。除此以外结果,参照上述实施例一中匹配不成功情况下获取IP地址的过程,此处不再赘述。Specifically, when the IP address is not occupied by the ARP resolution, and the DHCP server returns a DHCP ACK message within the first preset time range, the current IP address is used. Otherwise, the process of obtaining an IP address in the case where the matching is unsuccessful in the first embodiment is not described here.
在S303中,若是,则从所述动态主机配置协议应答消息中获取所述IP地址,并存储当前的连接信息。In S303, if yes, the IP address is obtained from the dynamic host configuration protocol response message, and the current connection information is stored.
具体地,当终端连接无线接入点时存储当前的连接信息,为下一次连接该无线接入点提供连接信息。Specifically, the current connection information is stored when the terminal connects to the wireless access point, and the connection information is provided for the next connection to the wireless access point.
可选地,若未在第二预设时间范围内接收到所述地址解析协议广播包返回所述IP地址未被占用的地址解析协议响应,或者接收到所述动态主机配置协议服务器返回的动态主机配置协议应答消息,则按照发送DHCP Discovery报文的方式来获取IP地址,具体如上文所述,此处不再赘述。Optionally, if the address resolution protocol broadcast packet is not received within the second preset time range, the address resolution protocol response that the IP address is not occupied is returned, or the dynamic information returned by the dynamic host configuration protocol server is received. The host configures the protocol response message, and then obtains the IP address according to the method of sending the DHCP Discovery packet. The details are as follows, and are not mentioned here.
以上可以看出,本实施例中当IP地址的租约时间不在第一预设时间范围内,则通过发送ARP广播包以判断IP地址未被占用,同时发送动 态主机配置协议请求消息帧至动态主机配置协议服务器以请求分配所述IP地址,并且在第二预设时间范围内接收到ARP广播包返回所述IP地址未被占用的ARP响应,且接收到DHCP服务器返回的DHCP ACK消息,则从所述动态主机配置协议应答消息中获取所述IP地址,并存储当前的连接信息。从而在用户使用终端每次连接无线接入点时,不需要重新连接IP地址,节约了连接无线接入点的时间,提高了用户体验。It can be seen that, in this embodiment, when the lease time of the IP address is not within the first preset time range, the ARP broadcast packet is sent to determine that the IP address is not occupied, and the dynamic host configuration protocol request message frame is sent to the dynamic host. Configuring a protocol server to request allocation of the IP address, and receiving an ARP broadcast packet in the second preset time range to return an ARP response that is not occupied by the IP address, and receiving a DHCP ACK message returned by the DHCP server, The dynamic host configuration protocol response message acquires the IP address and stores current connection information. Therefore, each time the user uses the terminal to connect to the wireless access point, the IP address does not need to be reconnected, which saves the time for connecting the wireless access point and improves the user experience.
请参阅图5,图5本申请一种移动终端的结构示意图,一种移动终端50包括:相互电性耦合的处理器501、通信电路502。Referring to FIG. 5 , FIG. 5 is a schematic structural diagram of a mobile terminal. The mobile terminal 50 includes a processor 501 and a communication circuit 502 electrically coupled to each other.
处理器501可以用于在所述通信电路502与无线接入点建立连接时,将获取到的所述无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配;若匹配成功,则在所述IP存储列表中获取与所述无线接入点的媒质访问控制地址对应的IP地址;判断所述IP地址的租约时间是否在预设时间范围内;若是,则控制所述通信电路502使用所述IP地址,并存储当前的连接信息。The processor 501 can be configured to: when the communication circuit 502 establishes a connection with the wireless access point, match the obtained media access control address of the wireless access point with a preset IP storage list; if the matching is successful, Obtaining an IP address corresponding to the media access control address of the wireless access point in the IP storage list; determining whether the lease time of the IP address is within a preset time range; if yes, controlling the communication circuit 502 uses the IP address and stores the current connection information.
处理器501与通信电路502的具体工作过程参照上述获取IP地址的方法所述,此处不再赘述。The specific working process of the processor 501 and the communication circuit 502 is as described above with reference to the method for obtaining an IP address, and details are not described herein again.
以上可以看出,本实施例提供一种移动终端,该移动终端包括相互电性耦合的处理器、通信电路。其中,处理器在通信电路与无线接入点建立连接时,将获取到的所述无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配,若匹配成功,且所述IP地址的租约时间在预设时间范围内,则可以使用IP地址,能够使用户每次连接无线接入点时,不需要重新连接IP地址,节约了连接无线接入点的时间,提高了用户体验。As can be seen from the above, the embodiment provides a mobile terminal, where the mobile terminal includes a processor and a communication circuit electrically coupled to each other. The processor matches the obtained media access control address of the wireless access point with a preset IP storage list when the communication circuit establishes a connection with the wireless access point, and if the matching is successful, and the IP address is If the lease time is within the preset time range, the IP address can be used, which enables the user to reconnect the IP address each time the wireless access point is connected, saving the time for connecting the wireless access point and improving the user experience.
请参阅图6,图6是本申请一种移动终端的另一结构示意图,一种移动终端60还包括:与所述处理器501相互耦合的收发器601。Please refer to FIG. 6. FIG. 6 is another schematic structural diagram of a mobile terminal according to the present application. A mobile terminal 60 further includes: a transceiver 601 coupled to the processor 501.
收发器601可以用于若所述IP地址的租约时间不在第一预设时间范围内,则发送地址解析协议广播包以判断所述IP地址是否已经被占用,同时发送动态主机配置协议请求消息帧至动态主机配置协议服务器以请求分配所述IP地址。收发器601还可以具体用于发送已封装的地址解 析协议广播包;其中,所述地址解析协议广播包包括将所述IP地址以及终端的源媒质访问控制地址。The transceiver 601 can be configured to: if the lease time of the IP address is not within the first preset time range, send an address resolution protocol broadcast packet to determine whether the IP address is already occupied, and send a dynamic host configuration protocol request message frame. Go to the Dynamic Host Configuration Protocol server to request the assignment of the IP address. The transceiver 601 is further configured to send the encapsulated address resolution protocol broadcast packet, where the address resolution protocol broadcast packet includes the IP address and a source medium access control address of the terminal.
处理器501可以具体用于判断是否在第二预设时间范围内接收到所述地址解析协议广播包返回所述IP地址未被占用的地址解析协议响应,且接收到所述动态主机配置协议服务器返回的动态主机配置协议应答消息;若是,则从所述动态主机配置协议应答消息中获取所述IP地址,并存储当前的连接信息。The processor 501 is specifically configured to determine whether the address resolution protocol broadcast packet is received in the second preset time range, and the address resolution protocol response that is not occupied by the IP address is returned, and the dynamic host configuration protocol server is received. The returned dynamic host configuration protocol response message; if yes, the IP address is obtained from the dynamic host configuration protocol response message, and the current connection information is stored.
处理器501还可以具体用于对接收到返回的对应于所述地址解析协议广播包的地址解析协议响应进行解析;若所述解析结果中显示所述IP地址对应的媒质访问控制地址与所述终端的源媒质访问控制地址不同,则确定所述IP地址已经被占用;或The processor 501 is further configured to: parse the address resolution protocol response corresponding to the address resolution protocol broadcast packet that is received, and display the media access control address corresponding to the IP address in the parsing result If the source medium access control address of the terminal is different, it is determined that the IP address is already occupied; or
若所述解析结果中显示所述IP地址对应的媒质访问控制地址与所述终端的源媒质访问控制地址相同,则确定所述IP地址未被占用。If the media access control address corresponding to the IP address is the same as the source media access control address of the terminal, it is determined that the IP address is not occupied.
处理器501与通信电路601的具体工作过程参照上述获取IP地址的方法所述,此处不再赘述。The specific working process of the processor 501 and the communication circuit 601 is as described above with reference to the method for obtaining an IP address, and details are not described herein again.
请参阅图7,图7是本申请一种具有存储功能的装置的结构示意图,一种具有存储功能的装置70其上存储有程序数据701,所述程序数据701能够被执行以实现如上述获取IP地址的方法所述的方法。Please refer to FIG. 7. FIG. 7 is a schematic structural diagram of an apparatus having a storage function. The apparatus 70 having a storage function stores program data 701 thereon, and the program data 701 can be executed to implement the foregoing acquisition. The method described in the method of IP address.
本发明的有益效果是:区别于现有技术的情况,本申请提供一种获取IP地址的方法、装置及终端。通过提供一种获取IP地址的方法,在与无线接入点建立连接时,将获取到的所述无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配,若匹配成功,且所述IP地址的租约时间在预设时间范围内,则可以使用IP地址,能够使用户每次连接无线接入点时,不需要重新连接IP地址,节约了连接无线接入点的时间,提高了用户体验。The present invention provides a method, an apparatus, and a terminal for acquiring an IP address, which are different from the prior art. By providing a method for obtaining an IP address, when the connection is established with the wireless access point, the obtained media access control address of the wireless access point is matched with a preset IP storage list, and if the matching is successful, and If the lease time of the IP address is within a preset time range, the IP address can be used, so that the user does not need to reconnect the IP address every time the user connects to the wireless access point, thereby saving the time for connecting the wireless access point and improving The user experience.
以上所述仅为本申请的实施方式,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above description is only the embodiment of the present application, and thus does not limit the scope of the patent application, and the equivalent structure or equivalent process transformation of the specification and the drawings of the present application, or directly or indirectly applied to other related technologies. The fields are all included in the scope of patent protection of this application.

Claims (16)

  1. 一种具有存储功能的装置,其中,所述装置存储有程序数据,所述程序数据能够被执行以实现如下操作:A device having a storage function, wherein the device stores program data, the program data being executable to perform the following operations:
    在与无线接入点建立连接时,读取预设的IP存储列表,其中所述IP存储列表包括终端与所述无线接入点的连接信息;Reading a preset IP storage list when establishing a connection with the wireless access point, where the IP storage list includes connection information between the terminal and the wireless access point;
    将获取到的所述无线接入点的媒质访问控制地址与所述终端与所述无线接入点的连接信息进行匹配;And matching the obtained media access control address of the wireless access point with the connection information of the terminal and the wireless access point;
    若所述无线接入点的媒质访问控制地址存在于所述终端与所述无线接入点的连接信息中,则匹配成功,则在所述IP存储列表中获取与所述无线接入点的媒质访问控制地址对应的IP地址;If the media access control address of the wireless access point exists in the connection information between the terminal and the wireless access point, if the matching is successful, acquiring the wireless access point in the IP storage list The IP address corresponding to the media access control address;
    判断所述IP地址的租约时间是否在第一预设时间范围内;Determining whether the lease time of the IP address is within a first preset time range;
    若是,则使用所述IP地址,并存储当前的连接信息,其中所述连接信息包括所述IP地址、所述IP地址的租约时间、所述动态主机配置协议服务器的地址。If yes, the IP address is used, and the current connection information is stored, wherein the connection information includes the IP address, a lease time of the IP address, and an address of the dynamic host configuration protocol server.
  2. 根据权利要求1所述的装置,其中,所述程序数据还能够被执行以实现如下操作:The apparatus of claim 1 wherein said program data is further executable to:
    若所述IP地址的租约时间不在所述第一预设时间范围内,则发送地址解析协议广播包以判断所述IP地址是否已经被占用,同时发送动态主机配置协议请求消息帧至动态主机配置协议服务器以请求分配所述IP地址;If the lease time of the IP address is not within the first preset time range, send an address resolution protocol broadcast packet to determine whether the IP address is already occupied, and send a dynamic host configuration protocol request message frame to the dynamic host configuration. The protocol server allocates the IP address by request;
    判断是否在第二预设时间范围内接收到所述地址解析协议广播包返回所述IP地址未被占用的地址解析协议响应,且接收到所述动态主机配置协议服务器返回的动态主机配置协议应答消息;Determining whether the address resolution protocol broadcast packet is received in the second preset time range, and the address resolution protocol response that the IP address is not occupied is returned, and the dynamic host configuration protocol response returned by the dynamic host configuration protocol server is received. Message
    若是,则从所述动态主机配置协议应答消息中获取所述IP地址,并存储当前的连接信息。If yes, the IP address is obtained from the dynamic host configuration protocol response message, and the current connection information is stored.
  3. 根据权利要求2所述的装置,其中,所述程序数据被执行的所述发送地址解析协议广播包以判断所述IP地址是否已经被占用的操作,包 括:The apparatus according to claim 2, wherein said program address data is executed by said transmission address resolution protocol to broadcast a packet to determine whether said IP address is already occupied, including:
    发送已封装的地址解析协议广播包;其中,所述地址解析协议广播包包括所述IP地址以及终端的源媒质访问控制地址;Transmitting an encapsulated address resolution protocol broadcast packet; wherein the address resolution protocol broadcast packet includes the IP address and a source medium access control address of the terminal;
    对接收到返回的对应于所述地址解析协议广播包的地址解析协议响应进行解析;Parsing an address resolution protocol response corresponding to the address resolution protocol broadcast packet received and parsing;
    若所述解析结果中显示所述IP地址对应的媒质访问控制地址与所述终端的源媒质访问控制地址不同,则确定所述IP地址已经被占用;或If the media access control address corresponding to the IP address is different from the source media access control address of the terminal, the IP address is determined to be occupied; or
    若所述解析结果中显示所述IP地址对应的媒质访问控制地址与所述终端的源媒质访问控制地址相同,则确定所述IP地址未被占用。If the media access control address corresponding to the IP address is the same as the source media access control address of the terminal, it is determined that the IP address is not occupied.
  4. 根据权利要求1所述的装置,其中,所述程序数据被执行的所述判断所述IP地址的租约时间是否在第一预设时间范围内的操作,包括:The apparatus according to claim 1, wherein the operation of determining, by the program data, whether a lease time of the IP address is within a first preset time range comprises:
    按照如下公式计算第一预设时间:T0=T1+T2*0.8;其中,T0为所述第一预设时间,T1为第一次获取所述IP地址的时间,T2为所述租约时间;The first preset time is calculated according to the following formula: T0=T1+T2*0.8; wherein T0 is the first preset time, T1 is the time for acquiring the IP address for the first time, and T2 is the lease time;
    若T0大于当前系统时间,则确定所述IP地址的租约时间在所述第一预设时间范围内;If the T0 is greater than the current system time, determining that the lease time of the IP address is within the first preset time range;
    若T0小于或等于当前系统时间,则确定所述IP地址的租约时间不在所述第一预设时间范围内。If T0 is less than or equal to the current system time, it is determined that the lease time of the IP address is not within the first preset time range.
  5. 一种移动终端,其中,所述终端包括相互电性耦合的处理器和通信电路,所述处理器用于执行如下动作:A mobile terminal, wherein the terminal includes a processor and a communication circuit electrically coupled to each other, and the processor is configured to perform the following actions:
    在所述通信电路与无线接入点建立连接时,将获取到的所述无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配;若匹配成功,则在所述IP存储列表中获取与所述无线接入点的媒质访问控制地址对应的IP地址;判断所述IP地址的租约时间是否在预设时间范围内;若是,则控制所述通信电路使用所述IP地址,并存储当前的连接信息。When the communication circuit establishes a connection with the wireless access point, matching the obtained media access control address of the wireless access point with a preset IP storage list; if the matching is successful, the IP storage list is Obtaining an IP address corresponding to the media access control address of the wireless access point; determining whether the lease time of the IP address is within a preset time range; if yes, controlling the communication circuit to use the IP address, and Store current connection information.
  6. 根据权利要求5所述的终端,其中,所述终端还包括:The terminal of claim 5, wherein the terminal further comprises:
    与所述处理器相互耦合的收发器;a transceiver coupled to the processor;
    所述收发器用于若所述IP地址的租约时间不在第一预设时间范围内,则发送地址解析协议广播包以判断所述IP地址是否已经被占用,同 时发送动态主机配置协议请求消息帧至动态主机配置协议服务器以请求分配所述IP地址;The transceiver is configured to: if the lease time of the IP address is not within the first preset time range, send an address resolution protocol broadcast packet to determine whether the IP address is already occupied, and send a dynamic host configuration protocol request message frame to The dynamic host configuration protocol server requests the allocation of the IP address;
    所述处理器用于判断是否在第二预设时间范围内接收到所述地址解析协议广播包返回所述IP地址未被占用的地址解析协议响应,且接收到所述动态主机配置协议服务器返回的动态主机配置协议应答消息;若是,则从所述动态主机配置协议应答消息中获取所述IP地址,并存储当前的连接信息。The processor is configured to determine whether the address resolution protocol broadcast packet is received in the second preset time range, and the address resolution protocol response that is not occupied by the IP address is returned, and the dynamic host configuration protocol server returns The dynamic host configuration protocol response message; if yes, the IP address is obtained from the dynamic host configuration protocol response message, and the current connection information is stored.
  7. 根据权利要求6所述的终端,其中,The terminal according to claim 6, wherein
    所述收发器具体用于发送已封装的地址解析协议广播包;其中,所述地址解析协议广播包包括所述IP地址以及终端的源媒质访问控制地址;The transceiver is specifically configured to send an encapsulated address resolution protocol broadcast packet, where the address resolution protocol broadcast packet includes the IP address and a source medium access control address of the terminal;
    所述处理器具体用于对接收到返回的对应于所述地址解析协议广播包的地址解析协议响应进行解析;若所述解析结果中显示所述IP地址对应的媒质访问控制地址与所述终端的源媒质访问控制地址不同,则确定所述IP地址已经被占用;或The processor is specifically configured to parse the received address resolution protocol response corresponding to the address resolution protocol broadcast packet, and display the media access control address corresponding to the IP address and the terminal in the parsing result. If the source medium access control address is different, it is determined that the IP address is already occupied; or
    若所述解析结果中显示所述IP地址对应的媒质访问控制地址与所述终端的源媒质访问控制地址相同,则确定所述IP地址未被占用。If the media access control address corresponding to the IP address is the same as the source media access control address of the terminal, it is determined that the IP address is not occupied.
  8. 根据权利要求5所述的终端,其中,所述处理器用于执行的所述判断所述IP地址的租约时间是否在第一预设时间范围内的动作,包括:The terminal according to claim 5, wherein the action performed by the processor to determine whether the lease time of the IP address is within a first preset time range comprises:
    按照如下公式计算第一预设时间:T0=T1+T2*0.8;其中,T0为所述第一预设时间,T1为第一次获取所述IP地址的时间,T2为所述租约时间;The first preset time is calculated according to the following formula: T0=T1+T2*0.8; wherein T0 is the first preset time, T1 is the time for acquiring the IP address for the first time, and T2 is the lease time;
    若T0大于当前系统时间,则确定所述IP地址的租约时间在所述第一预设时间范围内;If the T0 is greater than the current system time, determining that the lease time of the IP address is within the first preset time range;
    若T0小于或等于当前系统时间,则确定所述IP地址的租约时间不在所述第一预设时间范围内。If T0 is less than or equal to the current system time, it is determined that the lease time of the IP address is not within the first preset time range.
  9. 根据权利要求5所述的终端,其中,所述处理器用于执行的所述将获取到的所述无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配的动作,包括:The terminal according to claim 5, wherein the performing, by the processor, the matching of the obtained medium access control address of the wireless access point with a preset IP storage list, includes:
    读取所述预设的IP存储列表,其中,所述IP存储列表包括所述终端与所述无线接入点的连接信息;Reading the preset IP storage list, where the IP storage list includes connection information between the terminal and the wireless access point;
    将获取到的所述无线接入点的媒质访问控制地址与所述终端与所述无线接入点的连接信息进行匹配;And matching the obtained media access control address of the wireless access point with the connection information of the terminal and the wireless access point;
    若所述无线接入点的媒质访问控制地址存在于所述终端与所述无线接入点的连接信息中,则匹配成功。If the media access control address of the wireless access point exists in the connection information between the terminal and the wireless access point, the matching is successful.
  10. 根据权利要求5所述的终端,其中,所述连接信息包括所述IP地址、所述IP地址的租约时间、所述动态主机配置协议服务器的地址。The terminal of claim 5, wherein the connection information comprises the IP address, a lease time of the IP address, and an address of the dynamic host configuration protocol server.
  11. 一种获取IP地址的方法,其中,包括:A method for obtaining an IP address, including:
    在与无线接入点建立连接时,将获取到的所述无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配;When establishing a connection with the wireless access point, matching the obtained media access control address of the wireless access point with a preset IP storage list;
    若匹配成功,则在所述IP存储列表中获取与所述无线接入点的媒质访问控制地址对应的IP地址;If the matching is successful, obtaining an IP address corresponding to the media access control address of the wireless access point in the IP storage list;
    判断所述IP地址的租约时间是否在第一预设时间范围内;Determining whether the lease time of the IP address is within a first preset time range;
    若是,则使用所述IP地址,并存储当前的连接信息。If so, the IP address is used and the current connection information is stored.
  12. 根据权利要求11所述的方法,其中,所述方法还包括:The method of claim 11 wherein the method further comprises:
    若所述IP地址的租约时间不在所述第一预设时间范围内,则发送地址解析协议广播包以判断所述IP地址是否已经被占用,同时发送动态主机配置协议请求消息帧至动态主机配置协议服务器以请求分配所述IP地址;If the lease time of the IP address is not within the first preset time range, send an address resolution protocol broadcast packet to determine whether the IP address is already occupied, and send a dynamic host configuration protocol request message frame to the dynamic host configuration. The protocol server allocates the IP address by request;
    判断是否在第二预设时间范围内接收到所述地址解析协议广播包返回所述IP地址未被占用的地址解析协议响应,且接收到所述动态主机配置协议服务器返回的动态主机配置协议应答消息;Determining whether the address resolution protocol broadcast packet is received in the second preset time range, and the address resolution protocol response that the IP address is not occupied is returned, and the dynamic host configuration protocol response returned by the dynamic host configuration protocol server is received. Message
    若是,则从所述动态主机配置协议应答消息中获取所述IP地址,并存储当前的连接信息。If yes, the IP address is obtained from the dynamic host configuration protocol response message, and the current connection information is stored.
  13. 根据权利要求12所述的方法,其中,The method of claim 12, wherein
    所述发送地址解析协议广播包以判断所述IP地址是否已经被占用包括:The sending an address resolution protocol broadcast packet to determine whether the IP address is already occupied includes:
    发送已封装的地址解析协议广播包;其中,所述地址解析协议广播 包包括所述IP地址以及终端的源媒质访问控制地址;Transmitting an encapsulated address resolution protocol broadcast packet; wherein the address resolution protocol broadcast packet includes the IP address and a source medium access control address of the terminal;
    对接收到返回的对应于所述地址解析协议广播包的地址解析协议响应进行解析;Parsing an address resolution protocol response corresponding to the address resolution protocol broadcast packet received and parsing;
    若所述解析结果中显示所述IP地址对应的媒质访问控制地址与所述终端的源媒质访问控制地址不同,则确定所述IP地址已经被占用;或If the media access control address corresponding to the IP address is different from the source media access control address of the terminal, the IP address is determined to be occupied; or
    若所述解析结果中显示所述IP地址对应的媒质访问控制地址与所述终端的源媒质访问控制地址相同,则确定所述IP地址未被占用。If the media access control address corresponding to the IP address is the same as the source media access control address of the terminal, it is determined that the IP address is not occupied.
  14. 根据权利要求11所述的方法,其中,The method of claim 11 wherein
    所述判断所述IP地址的租约时间是否在第一预设时间范围内包括:The determining whether the lease time of the IP address is within a first preset time range includes:
    按照如下公式计算第一预设时间:T0=T1+T2*0.8;其中,T0为所述第一预设时间,T1为第一次获取所述IP地址的时间,T2为所述租约时间;The first preset time is calculated according to the following formula: T0=T1+T2*0.8; wherein T0 is the first preset time, T1 is the time for acquiring the IP address for the first time, and T2 is the lease time;
    若T0大于当前系统时间,则确定所述IP地址的租约时间在所述第一预设时间范围内;If the T0 is greater than the current system time, determining that the lease time of the IP address is within the first preset time range;
    若T0小于或等于当前系统时间,则确定所述IP地址的租约时间不在所述第一预设时间范围内。If T0 is less than or equal to the current system time, it is determined that the lease time of the IP address is not within the first preset time range.
  15. 根据权利要求11所述的方法,其中,The method of claim 11 wherein
    所述将获取到的所述无线接入点的媒质访问控制地址与预设的IP存储列表进行匹配包括:The matching the obtained media access control address of the wireless access point with the preset IP storage list includes:
    读取所述预设的IP存储列表,其中,所述IP存储列表包括所述终端与所述无线接入点的连接信息;Reading the preset IP storage list, where the IP storage list includes connection information between the terminal and the wireless access point;
    将获取到的所述无线接入点的媒质访问控制地址与所述终端与所述无线接入点的连接信息进行匹配;And matching the obtained media access control address of the wireless access point with the connection information of the terminal and the wireless access point;
    若所述无线接入点的媒质访问控制地址存在于所述终端与所述无线接入点的连接信息中,则匹配成功。If the media access control address of the wireless access point exists in the connection information between the terminal and the wireless access point, the matching is successful.
  16. 根据权利要求11所述的方法,其中,The method of claim 11 wherein
    所述连接信息包括所述IP地址、所述IP地址的租约时间、所述动态主机配置协议服务器的地址。The connection information includes the IP address, a lease time of the IP address, and an address of the dynamic host configuration protocol server.
PCT/CN2018/107022 2017-09-22 2018-09-21 Method for obtaining ip address, device, and mobile terminal WO2019057167A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710870411.X 2017-09-22
CN201710870411.XA CN107613042A (en) 2017-09-22 2017-09-22 Obtain the method, device and mobile terminal of IP address

Publications (1)

Publication Number Publication Date
WO2019057167A1 true WO2019057167A1 (en) 2019-03-28

Family

ID=61057798

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/107022 WO2019057167A1 (en) 2017-09-22 2018-09-21 Method for obtaining ip address, device, and mobile terminal

Country Status (2)

Country Link
CN (1) CN107613042A (en)
WO (1) WO2019057167A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114301876A (en) * 2021-12-23 2022-04-08 深圳创维数字技术有限公司 Address allocation method, system, device and computer readable storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110062063B (en) * 2019-05-30 2022-03-29 中磊电子(苏州)有限公司 Network address management device and method

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060233128A1 (en) * 2005-04-15 2006-10-19 Kapil Sood Apparatus, system and method capable of pre-allocating and communicating IP address information during wireless communication
CN102316447A (en) * 2011-09-14 2012-01-11 福建星网锐捷网络有限公司 Internet protocol (IP) address allocation and sending method, wireless access device, server and system
CN103957288A (en) * 2014-04-28 2014-07-30 福建星网锐捷网络有限公司 Method, device and equipment for IP address dynamic allocation
CN104202834A (en) * 2014-09-22 2014-12-10 联想(北京)有限公司 Control method, controller and electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101127727B (en) * 2007-09-28 2012-07-04 电信科学技术研究院 IP address configuration and mobile detection method for mobile IP
CN102739821A (en) * 2012-07-03 2012-10-17 大唐移动通信设备有限公司 Method and system for allocating IP addresses
CN105812505A (en) * 2016-05-06 2016-07-27 上海斐讯数据通信技术有限公司 Method and device for renewing lease of IP address of terminal equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060233128A1 (en) * 2005-04-15 2006-10-19 Kapil Sood Apparatus, system and method capable of pre-allocating and communicating IP address information during wireless communication
CN102316447A (en) * 2011-09-14 2012-01-11 福建星网锐捷网络有限公司 Internet protocol (IP) address allocation and sending method, wireless access device, server and system
CN103957288A (en) * 2014-04-28 2014-07-30 福建星网锐捷网络有限公司 Method, device and equipment for IP address dynamic allocation
CN104202834A (en) * 2014-09-22 2014-12-10 联想(北京)有限公司 Control method, controller and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114301876A (en) * 2021-12-23 2022-04-08 深圳创维数字技术有限公司 Address allocation method, system, device and computer readable storage medium
CN114301876B (en) * 2021-12-23 2023-11-21 深圳创维数字技术有限公司 Address allocation method, system, device and computer readable storage medium

Also Published As

Publication number Publication date
CN107613042A (en) 2018-01-19

Similar Documents

Publication Publication Date Title
US11729615B2 (en) Internet of things communication method, apparatus, and system
KR101943843B1 (en) Apparatus and method for transmitting/receiving ip information in a radio communication network
US9277575B2 (en) Method, device and network system of establishing a tunnel
JP2022043169A5 (en)
KR101589239B1 (en) Method and apparatus for packet call setup
CN111432044B (en) Multi-link equipment MAC address management method and device and multi-link equipment
US20200195646A1 (en) Method, Device and System for Obtaining Local Domain Name
US9661493B2 (en) Apparatus and method for providing a wireless communication in a portable terminal
WO2021121286A1 (en) Data transmission method and apparatus, computer device and storage medium
WO2011160587A1 (en) Method and system for connecting a dual-stack terminal to networks
WO2013104271A1 (en) Feedback method for actively scanning user terminal and access point
US20240163243A1 (en) Systems and methods for improving arp/nd performance on host communication devices
WO2014000678A1 (en) Connection establishment method and device for packet data network
WO2013135124A1 (en) Discovery method, device and system for application-layer traffic optimization server
EP3883203A1 (en) Ipv6 address configuration method and router device
WO2023025180A1 (en) Node management method, node and system
WO2019057167A1 (en) Method for obtaining ip address, device, and mobile terminal
KR20150041952A (en) IP based sleep mode control method using synchonization information
EP2700254B1 (en) Apparatus and method for transmitting and receiving ip information in a wireless communication network
JP2019008645A (en) SERVER DEVICE, METHOD FOR ALLOWING SERVER DEVICE TO COMMUNICATE WITH IoT DEVICE, COMPUTER PROGRAM, COMMUNICATION SYSTEM AND IoT DEVICE
WO2020124954A1 (en) Method and apparatus for implementing wireless roaming, gateway, and storage medium
WO2013185696A2 (en) Data processing method and device
WO2018006684A1 (en) Message processing method and device, and router
CN113473493A (en) Communication method and device
WO2017166038A1 (en) Communication method and terminal

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18859084

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18859084

Country of ref document: EP

Kind code of ref document: A1