CN102833360A - Method and device for automatically generating Internet protocol (IP) address of off-line terminal - Google Patents
Method and device for automatically generating Internet protocol (IP) address of off-line terminal Download PDFInfo
- Publication number
- CN102833360A CN102833360A CN2011101593392A CN201110159339A CN102833360A CN 102833360 A CN102833360 A CN 102833360A CN 2011101593392 A CN2011101593392 A CN 2011101593392A CN 201110159339 A CN201110159339 A CN 201110159339A CN 102833360 A CN102833360 A CN 102833360A
- Authority
- CN
- China
- Prior art keywords
- address
- intermediate code
- decimal
- digits
- code
- 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
- 238000000034 method Methods 0.000 title claims abstract description 61
- 238000000605 extraction Methods 0.000 claims abstract description 20
- 238000006243 chemical reaction Methods 0.000 claims description 40
- 238000001514 detection method Methods 0.000 abstract description 6
- 239000000284 extract Substances 0.000 abstract description 3
- 238000010586 diagram Methods 0.000 description 2
- 230000000295 complement effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000000737 periodic effect Effects 0.000 description 1
- 239000013589 supplement Substances 0.000 description 1
- 230000001502 supplementing effect Effects 0.000 description 1
Images
Landscapes
- Small-Scale Networks (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明实施例公开了一种脱网终端的IP地址自动生成方法,该方法获取脱网终端自身在网络内的唯一标识;将所述唯一标识提取为预设位数的数字形式中间码;通过二进制编码的十进制BCD码法或取位法,将所述中间码转换为IP地址。本发明还公开了一种脱网终端的IP地址自动生成装置,该方法和装置使脱网终端不需要发送检测报文即可确保自身生成的IP地址的唯一性。
The embodiment of the present invention discloses a method for automatically generating an IP address of an off-net terminal. The method obtains the unique identifier of the off-net terminal itself in the network; extracts the unique identifier as an intermediate code in digital form with a preset number of digits; through Binary-coded decimal BCD code method or bit extraction method to convert the intermediate code into an IP address. The invention also discloses a device for automatically generating an IP address of an off-net terminal. The method and device enable the off-net terminal to ensure the uniqueness of the IP address generated by itself without sending a detection message.
Description
技术领域 technical field
本发明涉及网络通信技术领域,特别涉及一种脱网终端的IP地址自动生成方法及装置。The invention relates to the technical field of network communication, in particular to a method and device for automatically generating an IP address of an off-network terminal.
背景技术 Background technique
当前在很多通信系统中,终端设备自动生成IP地址的方式主要是通过动态主机设置(DHCP)协议与服务器端交互来实现。Currently, in many communication systems, the automatic generation of an IP address by a terminal device is mainly realized by interacting with a server through a Dynamic Host Configuration (DHCP) protocol.
当网络中所有的终端设备脱网运行时,如果网络中某个执行DHCP服务的终端设备发生故障,将导致终端设备不能获取IP地址,终端设备之间不能实现通信;为了解决脱网状态下,终端设备不经DHCP方式获取IP地址,现有技术中通常由终端采取某种策略,实现IP地址的自动生成,从而使脱网终端可以根据自动生成的IP地址实现端对端通信。When all the terminal devices in the network are running offline, if a terminal device in the network that executes the DHCP service fails, the terminal device cannot obtain an IP address, and the communication between the terminal devices cannot be realized; in order to solve the problem of offline status, The terminal device does not obtain the IP address through DHCP. In the prior art, the terminal usually adopts a certain strategy to realize the automatic generation of the IP address, so that the off-network terminal can realize end-to-end communication according to the automatically generated IP address.
但是,现有技术在脱网终端自动生成自身的IP地址后,还需要向网络内其它脱网终端设备发送检测报文,以确保自身的IP地址唯一,这样做显然增加了网络负载。However, in the prior art, after the off-net terminal automatically generates its own IP address, it still needs to send a detection message to other off-net terminal devices in the network to ensure that its own IP address is unique, which obviously increases the network load.
另外,脱网终端自动生成到IP地址后,还需要通过域名系统DNS获取对端设备的IP地址,才能和对端通信,当DNS系统也故障时,该方法虽然能够保证脱网终端生成的自身的IP地址唯一,但由于该方法只能生成自身IP地址,而不能获取对端IP地址,所以仍然不能实现端对端通信。In addition, after the off-network terminal automatically generates an IP address, it needs to obtain the IP address of the peer device through the domain name system DNS in order to communicate with the peer device. The IP address of the network is unique, but because this method can only generate its own IP address, but cannot obtain the peer IP address, it still cannot achieve peer-to-peer communication.
发明内容 Contents of the invention
有鉴于此,本发明提供了一种脱网终端的IP地址自动生成方法及装置,使脱网终端不需要发送检测报文即可确保自身生成的IP地址的唯一性。In view of this, the present invention provides a method and device for automatically generating an IP address of an off-net terminal, so that the off-net terminal can ensure the uniqueness of the IP address generated by itself without sending a detection message.
为达上述目的,本发明的技术方案具体是这样实现的:For reaching above-mentioned purpose, technical scheme of the present invention is specifically realized like this:
一种脱网终端的IP地址自动生成方法,该方法包括:A method for automatically generating an IP address of an off-net terminal, the method comprising:
获取脱网终端自身在网络内的唯一标识;Obtain the unique identification of the offline terminal itself in the network;
将所述唯一标识提取为预设位数的数字形式中间码;Extracting the unique identifier as an intermediate code in digital form with a preset number of digits;
通过二进制编码的十进制BCD码法或取位法,将所述中间码转换为IP地址。The intermediate code is converted into an IP address by using a binary-coded decimal BCD code method or a bit extraction method.
较佳地,该方法进一步包括:Preferably, the method further comprises:
获取对端设备在网络内的唯一标识;Obtain the unique identifier of the peer device in the network;
按照所述将唯一标识转换为IP地址的方法,将所述对端设备在网络内的唯一标识转换为IP地址;According to the method for converting the unique identifier into an IP address, the unique identifier of the peer device in the network is converted into an IP address;
根据所述对端设备的IP地址与所述对端设备进行端对端通信。Perform end-to-end communication with the peer device according to the IP address of the peer device.
较佳地,所述IP地址为IPv4地址。Preferably, the IP address is an IPv4 address.
较佳地,所述将所述唯一标识提取为预设位数的数字形式中间码包括:Preferably, said intermediate code in digital form that extracts said unique identifier as a preset number of digits includes:
通过补位或确保唯一性的哈希算法,将所述唯一标识提取为8位或4位十进制数字形式的中间码。The unique identifier is extracted as an intermediate code in the form of 8-digit or 4-digit decimal numbers by padding or a hash algorithm to ensure uniqueness.
较佳地,所述BCD码法包括:Preferably, the BCD code method includes:
通过8421码将8位或4位十进制数字形式的中间码转换为二进制4部分形式的IPv4地址,再将每一部分的二进制数字转换为十进制数字,得到十进制,4部分形式的IPv4地址。The 8-digit or 4-digit intermediate code in the form of decimal numbers is converted into a binary 4-part IPv4 address through the 8421 code, and then each part of the binary number is converted into a decimal number to obtain a decimal, 4-part IPv4 address.
较佳地,所述取位法包括:Preferably, the positioning method includes:
通过取合适的位数,将8位或4位十进制数字形式的中间码直接转换成十进制4部分形式的IPv4地址。By taking the appropriate number of digits, the intermediate code in the form of 8-digit or 4-digit decimal numbers is directly converted into an IPv4 address in the form of decimal 4-parts.
较佳地,所述IP地址为IPv6地址。Preferably, the IP address is an IPv6 address.
较佳地,所述将所述唯一标识提取为预设位数的数字形式中间码包括:Preferably, said intermediate code in digital form that extracts said unique identifier as a preset number of digits includes:
通过补位或确保唯一性的哈希算法,将所述唯一标识提取为16位或8位十进制数字形式的中间码。The unique identifier is extracted as an intermediate code in the form of 16 or 8 decimal numbers by padding or a unique hash algorithm.
较佳地,所述BCD码法包括:Preferably, the BCD code method includes:
通过8421码将所述16位或8位十进制数字形式的中间码转换为二进制8部分形式的IPv6地址主机号,再将每一部分的二进制数字转换为十进制数字,得到十进制,8部分形式的IPv6地址主机号;Convert the intermediate code in the form of 16 or 8 decimal numbers into an IPv6 address host number in the form of binary 8-parts through the 8421 code, and then convert each part of the binary number into a decimal number to obtain a decimal, IPv6 address in the form of 8 parts host number;
将所述IPv6地址主机号与预先取得的IPv6地址前缀组合为完整IPv6地址。Combining the IPv6 address host number with the pre-acquired IPv6 address prefix into a complete IPv6 address.
较佳地,所述取位法包括:Preferably, the positioning method includes:
通过取合适的位数,将所述16位或8位十进制数字形式的中间码直接转换成十进制8部分形式的IPv6地址主机号;By taking the appropriate number of digits, the intermediate code in the form of 16 or 8 decimal numbers is directly converted into an IPv6 address host number in the form of 8 decimal parts;
将所述IPv6地址主机号与预先取得的IPv6地址前缀组合为完整IPv6地址。Combining the IPv6 address host number with the pre-acquired IPv6 address prefix into a complete IPv6 address.
一种脱网终端的IP地址自动生成装置,该装置包括:A device for automatically generating an IP address of an off-net terminal, the device comprising:
标识获取模块,用于获取脱网终端自身在网络内的唯一标识;An identification acquisition module, configured to acquire the unique identification of the off-network terminal itself in the network;
转换模块,与所述标识获取模块相连,用于将所述唯一标识提取为预设位数的数字形式中间码,并通过二进制编码的十进制BCD码法或取位法将所述中间码转换为IP地址。The conversion module is connected with the identification acquisition module, and is used to extract the unique identification as a digital form intermediate code with a preset number of digits, and convert the intermediate code into IP address.
较佳地,该装置进一步包括:Preferably, the device further includes:
对端获取模块,用于获取对端设备在网络内的唯一标识;The peer acquisition module is used to obtain the unique identifier of the peer device in the network;
所述转换模块,进一步与所述对端获取模块相连,用于将所述对端设备的唯一标识提取为预设位数的数字形式中间码,并将所述对端设备的中间码转换为IP地址;The conversion module is further connected with the peer acquisition module, and is used to extract the unique identifier of the peer device as a digital intermediate code with a preset number of digits, and convert the intermediate code of the peer device into IP address;
通信模块,与所述转换模块相连,用于根据所述对端设备的IP地址与所述对端设备进行端对端通信。A communication module, connected to the conversion module, for performing end-to-end communication with the peer device according to the IP address of the peer device.
较佳地,所述转换模块包括:Preferably, the conversion module includes:
提取单元,用于通过补位或确保唯一性的哈希算法将所述唯一标识提取为8位或4位十进制数字形式的中间码;The extraction unit is used to extract the unique identifier into an intermediate code in the form of 8 or 4 decimal numbers through filling or a hash algorithm to ensure uniqueness;
转换单元,与所述提取单元相连,用于通过BCD码法或取位法将所述8位或4位数字形式的中间码转换为IPv4地址。The converting unit is connected with the extracting unit, and is used for converting the intermediate code in the form of 8-digit or 4-digit numbers into an IPv4 address by BCD code method or bit extraction method.
较佳地,所述转换单元通过8421码将8位或4位十进制数字形式的中间码转换为二进制4部分形式的IPv4地址,再将每一部分的二进制数字转换为十进制数字,得到十进制,4部分形式的IPv4地址。Preferably, the conversion unit converts the intermediate code in the form of 8-bit or 4-digit decimal numbers into an IPv4 address in the form of binary 4-parts through 8421 code, and then converts the binary numbers of each part into decimal numbers to obtain decimal, 4-part An IPv4 address of the form.
较佳地,所述转换单元通过取合适的位数,将8位或4位十进制数字形式的中间码直接转换成十进制4部分形式的IPv4地址。Preferably, the conversion unit directly converts the intermediate code in the form of 8-digit or 4-digit decimal numbers into an IPv4 address in the form of decimal 4-parts by taking an appropriate number of digits.
较佳地,所述转换模块包括:Preferably, the conversion module includes:
提取单元,用于通过补位或确保唯一性的哈希算法将所述唯一标识提取为16位或8位十进制数字形式的中间码;The extraction unit is used to extract the unique identifier into an intermediate code in the form of 16 or 8 decimal numbers through filling or a hash algorithm to ensure uniqueness;
转换单元,与所述提取单元相连,用于通过BCD码法或取位法将所述16位或8位十进制数字形式的中间码转换为IPv6地址。The converting unit is connected with the extracting unit, and is used for converting the intermediate code in the form of 16-digit or 8-digit decimal numbers into an IPv6 address through BCD code method or bit extraction method.
较佳地,所述转换单元通过8421码将16位或8位十进制数字形式的中间码转换为二进制8部分形式的IPv6地址主机号,再将每一部分的二进制数字转换为十进制数字,得到十进制,8部分形式的IPv6地址主机号;Preferably, the conversion unit converts the intermediate code in the form of 16 or 8 decimal numbers into an IPv6 address host number in the form of binary 8 parts through 8421 code, and then converts the binary numbers of each part into decimal numbers to obtain decimal, 8-part IPv6 address host number;
将所述IPv6地址主机号与预先取得的IPv6地址前缀组合为完整IPv6地址。Combining the IPv6 address host number with the pre-acquired IPv6 address prefix into a complete IPv6 address.
较佳地,所述转换单元通过取合适的位数,将16位或8位数字形式的中间码直接转换成十进制8部分形式的IPv6地址;Preferably, the conversion unit directly converts the intermediate code in the form of 16 or 8 digits into an IPv6 address in the form of decimal 8 parts by taking the appropriate number of digits;
将所述IPv6地址主机号与预先取得的IPv6地址前缀组合为完整IPv6地址。Combining the IPv6 address host number with the pre-acquired IPv6 address prefix into a complete IPv6 address.
由上述技术方案可见,本发明的这种脱网终端的IP地址自动生成方法及装置,利用脱网终端本身在网络内的某种唯一标识,通过特定算法使之转换为IP地址,以唯一标识的唯一性保证转换后的IP地址的唯一性,因而无需发送唯一性检测报文。另外,脱网终端使用相同的算法即可通过对端的所述唯一标识而得到对端的IP地址,从而无需DNS系统的支持,即可实现端对端通信。It can be seen from the above technical solution that the method and device for automatically generating the IP address of the off-net terminal of the present invention utilizes a certain unique identifier of the off-net terminal itself in the network, converts it into an IP address through a specific algorithm, and uniquely identifies it The uniqueness of the converted IP address ensures the uniqueness of the converted IP address, so there is no need to send a uniqueness detection packet. In addition, the off-net terminal can use the same algorithm to obtain the IP address of the peer end through the unique identifier of the peer end, so that end-to-end communication can be realized without the support of the DNS system.
附图说明 Description of drawings
图1为本发明实施例的脱网终端IP地址自动生成方法流程图。FIG. 1 is a flowchart of a method for automatically generating an IP address of an off-network terminal according to an embodiment of the present invention.
图2为本发明实施例的脱网终端IP地址自动生成装置结构示意图。Fig. 2 is a schematic structural diagram of an apparatus for automatically generating an IP address of an off-network terminal according to an embodiment of the present invention.
图3为本发明实施例的转换模块结构示意图。Fig. 3 is a schematic structural diagram of a conversion module according to an embodiment of the present invention.
具体实施方式 Detailed ways
为使本发明的目的、技术方案及优点更加清楚明白,以下参照附图并举实施例,对本发明进一步详细说明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and examples.
本发明主要是利用脱网终端本身在网络内的某种唯一标识,通过特定算法使之转换为IP地址,以唯一标识的唯一性保证转换后的IP地址的唯一性,因而无需发送唯一性检测报文。另外,脱网终端使用相同的算法即可通过对端的所述唯一标识而得到对端的IP地址,从而无需DNS系统的支持,即可实现端对端通信。The present invention mainly uses a certain unique identifier of the off-network terminal itself in the network, converts it into an IP address through a specific algorithm, and guarantees the uniqueness of the converted IP address with the uniqueness of the unique identifier, so there is no need to send a uniqueness detection message. In addition, the off-net terminal can use the same algorithm to obtain the IP address of the peer end through the unique identifier of the peer end, so that end-to-end communication can be realized without the support of the DNS system.
图1为本发明实施例的IP地址自动生成方法流程图,如图1所示,该方法包括如下步骤:Fig. 1 is the flow chart of the IP address automatic generation method of the embodiment of the present invention, as shown in Fig. 1, the method comprises the following steps:
步骤101,获取脱网终端自身在网络内的唯一标识;Step 101, obtaining the unique identifier of the off-network terminal itself in the network;
本发明中要求脱网终端必须具备在网络内除IP地址以外的用于唯一标识脱网终端的标识,例如手机号码、固话号码等,当然如果有多种唯一标识,可以选择其一,也可以优先选择数字形式的唯一标识。In the present invention, it is required that the off-net terminal must have an identifier for uniquely identifying the off-net terminal in the network except the IP address, such as a mobile phone number, a fixed-line number, etc. Of course, if there are multiple unique identifiers, you can choose one, or Unique identifiers in numerical form may be preferred.
步骤102,将所述唯一标识提取预设位数的数字形式中间码;Step 102, extracting the intermediate code in digital form with a preset number of digits from the unique identifier;
本步骤中,由于获取的具体唯一标识不同,在转换为IP地址之前,需要先将其提取为统一的数字形式中间码;而具体中间码的位数,还需要根据最终转换的IP地址是IPv4地址还是IPv6地址来确定。In this step, due to the different specific unique identifiers obtained, before converting it into an IP address, it needs to be extracted into a unified digital form intermediate code; and the number of bits of the specific intermediate code also needs to be determined according to whether the final converted IP address is IPv4 The address is still determined by the IPv6 address.
对于IPv4地址,可以提取为8位或4位十进制的数字形式的中间码,提取时,如果唯一标识为纯数字形式且小于8位,则可以采用补位的方式,将其补为8位,如果小于4位,则可以补到4位或补到8位均可;当然如果是4位或8位则无需补位,或者把4位补到8位。补位时,补在原数字之后或之前,或者前后均补都是可以的。For an IPv4 address, it can be extracted as an 8-digit or 4-digit intermediate code in the form of decimal numbers. When extracting, if the unique identifier is in pure digital form and less than 8 digits, it can be complemented to 8 digits by means of complementing. If it is less than 4 digits, it can be supplemented to 4 digits or 8 digits; of course, if it is 4 digits or 8 digits, no complement is required, or 4 digits can be complemented to 8 digits. When supplementing, it is possible to supplement after or before the original number, or both before and after.
如果唯一标识是数字与字母组合,或者大于8位的十进制数字,则可以先采用自定义的哈希算法,将唯一标识提取为8位或4位数字形式,该哈希算法要保证转换的唯一性,具体算法本发明并不限定,可自定义。If the unique identifier is a combination of numbers and letters, or a decimal number greater than 8 digits, you can first use a custom hash algorithm to extract the unique identifier into 8-digit or 4-digit numbers. The hash algorithm must ensure the uniqueness of the conversion The specific algorithm is not limited in the present invention and can be customized.
对于IPv6地址,由于IPv6地址是由64位地址前缀和64位主机号两部分组成,一般来说,地址前缀是手工设置在终端上的,或者是终端设备自动从网段内的路由器周期通告报文中获取的,所以不管脱网与否,终端的地址前缀部分都是可以预先获取到的,所以对于IPv6地址来说,只要生成IPv6地址主机号部分即可,最后将前缀部分与生成的主机号部分组合起来,即可得到完整的IPv6地址。For an IPv6 address, since an IPv6 address is composed of two parts: a 64-bit address prefix and a 64-bit host number, generally speaking, the address prefix is manually set on the terminal, or the terminal device automatically sends a periodic notification report from the router in the network segment. It is obtained in the article, so regardless of whether it is offline or not, the prefix part of the terminal address can be obtained in advance, so for the IPv6 address, it is only necessary to generate the host number part of the IPv6 address, and finally combine the prefix part with the generated host The complete IPv6 address can be obtained by combining the number parts.
所以本步骤中,如果生成的是IPv6地址,则是将唯一标识提取为16位或8位的十进制数字形式中间码,具体提取方法和IPv4地址相似,只不过位数有区别而已,这里不再详述。Therefore, in this step, if an IPv6 address is generated, the unique identifier is extracted as an intermediate code in the form of a 16-digit or 8-digit decimal number. The specific extraction method is similar to that of an IPv4 address, except that the number of digits is different. detail.
步骤103,通过BCD码法或取位法,将所述中间码转换为IP地址。Step 103, convert the intermediate code into an IP address by BCD code method or bit extraction method.
与步骤102相同,转换为IP地址时也需要根据最终转换的IP地址是IPv4地址还是IPv6地址来确定具体方法;Same as step 102, when converting to an IP address, it is also necessary to determine the specific method according to whether the final converted IP address is an IPv4 address or an IPv6 address;
对于IPv4地址,在将唯一标识提取为8位或4位十进制数字形式的中间码后,即可通过BCD码法或取位法将其转换为IPv4地址。以唯一标识为8位数字的典型固话号码为例,如12345678,采用BCD码法,先将数字12345678转换为二进制的编码,以8421码为例,12345678将转换为0001(1)0010(2)0011(3)0100(4)0101(5)0110(6)0111(7)1000(8)再按照IPv4地址的形式将其划分为4部分即表示为00010010.00110100.01010110.01111000,将每部分的二进制数转换为十进制,得到IPv4地址为18.52.86.120;如果采用取位法,则直接取合适的位数,将12345678转换为IPv4地址的4部分形式,这里的“合适的位数”是指取位后满足IPv4地址的4部分形式,且每一部分均符合IPv4地址的地址范围;例如4部分中每部分取两位,得到IPv4地址为12.34.56.78,或者第一部分取3位,第二部分取1位,后两部分取2位,得到IPv4地址为123.4.56.78。另外,取位时要考虑到IPv4地址的地址范围,每一部分不能超过255,如果取位为12.345.6.78,那么其中一部分345超过了255,那么这样的取位是不合适的。4位数字通过BCD码法和取位法转换为IPv4地址的方法相同,例如1234,采用BCD码和取位法,转换后的IPv4地址均为1.2.3.4。For an IPv4 address, after extracting the unique identifier as an intermediate code in the form of 8-digit or 4-digit decimal digits, it can be converted into an IPv4 address through the BCD code method or bit extraction method. Take a typical fixed-line number with a unique identifier of 8 digits as an example, such as 12345678, use the BCD code method to first convert the number 12345678 into a binary code, take the 8421 code as an example, 12345678 will be converted into 0001(1)0010(2 )0011(3)0100(4)0101(5)0110(6)0111(7)1000(8) is divided into 4 parts according to the form of IPv4 address, which is expressed as 00010010.00110100.01010110.01111000, and the binary number of each part Converted to decimal, the IPv4 address is 18.52.86.120; if the bit method is used, the appropriate number of digits is directly taken, and 12345678 is converted into the 4-part form of the IPv4 address. The "appropriate number of digits" here refers to Satisfy the 4-part form of an IPv4 address, and each part conforms to the address range of an IPv4 address; for example, if each of the 4 parts takes two bits, the IPv4 address is 12.34.56.78, or the first part takes 3 bits and the second part takes 1 bit , the latter two parts take 2 bits, and the IPv4 address is 123.4.56.78. In addition, the address range of the IPv4 address should be considered when selecting bits, and each part cannot exceed 255. If the bit selection is 12.345.6.78, then part of 345 exceeds 255, so such bit selection is inappropriate. The 4-digit number is converted into an IPv4 address through the BCD code method and the digit method in the same way, for example, 1234, using the BCD code and the digit method, the converted IPv4 address is 1.2.3.4.
对于IPv6地址,也可以使用BCD码法和取位法进行转换,转换方法与IPv4地址是相似的,只不过需要转换为8部分十进制数字形式的IPv6地址主机号,这里不再详述,另外,需要注意的是,转换后得到的是IPv6地址主机号,还需要将转换后的IPv6地址主机号与预先获得的IPv6地址前缀组合,才能得到完整的IPv6地址。与IPv4地址相似,对于IPv6地址来说,“合适的位数”是指取位后满足IPv6地址的8部分形式,且每一部分均符合IPv6地址的地址范围。For IPv6 addresses, BCD code method and bit method can also be used for conversion. The conversion method is similar to IPv4 addresses, except that it needs to be converted into an IPv6 address host number in the form of 8 decimal numbers, which will not be described in detail here. In addition, It should be noted that the host number of the IPv6 address is obtained after conversion, and the complete IPv6 address needs to be obtained by combining the converted IPv6 address host number with the pre-obtained IPv6 address prefix. Similar to an IPv4 address, for an IPv6 address, "appropriate number of digits" refers to the 8-part format that satisfies the IPv6 address after taking the digits, and each part conforms to the address range of the IPv6 address.
另外,获取自身的IPv4或IPv6地址后,如果要进行后续的端对端通信,则可以继续获取对端设备的唯一标识,例如通过脱网终端中保存的对端设备的唯一标识列表,典型的如通讯录中的手机号码、固话号码列表等,或者用户手工输入的对端号码;之后采用上述相同的转换方法,即可得到对端的IPv4或IPv6地址,从而可以直接进行后续的端对端通信,而无需DNS系统解析对端号码。In addition, after obtaining its own IPv4 or IPv6 address, if subsequent peer-to-peer communication is to be carried out, it can continue to obtain the unique identifier of the peer device, for example, through the list of unique identifiers of the peer device saved in the offline terminal, a typical For example, the list of mobile phone numbers and fixed-line numbers in the address book, or the peer number manually entered by the user; after that, the same conversion method as above can be used to obtain the IPv4 or IPv6 address of the peer, so that the subsequent peer-to-peer can be directly carried out Communication without the need for the DNS system to resolve the peer number.
另外,本发明还提供一种脱网终端的IP地址自动生成装置,该装置如图2所示,包括:In addition, the present invention also provides a device for automatically generating an IP address for an off-network terminal, as shown in Figure 2, including:
标识获取模块201,用于获取脱网终端自身在网络内的唯一标识;An
转换模块202,与所述标识获取模块201相连,用于将所述唯一标识提取为预设位数的数字形式中间码,并通过二进制编码的十进制BCD码法或取位法将所述中间码转换为IP地址。The
为了实现端对端通信,该装置还可以进一步包括:In order to realize end-to-end communication, the device may further include:
对端获取模块203,用于获取对端设备在网络内的唯一标识;The
所述转换模块202,进一步与所述对端获取模块203相连,用于将所述对端设备的唯一标识提取为预设位数的数字形式中间码,并将所述对端设备的中间码转换为IP地址;The
通信模块204,与所述转换模块202相连,用于根据所述对端设备的IP地址与所述对端设备进行端对端通信。The
根据最终需要转换的IP地址的不同(IPv4或IPv6地址),上述装置中,所述转换模块202的具体结构也会不同。According to the difference of the IP address (IPv4 or IPv6 address) that needs to be converted finally, the specific structure of the
对于IPv4地址,所述转换模块202如图3所示包括:For IPv4 address, described
提取单元301,用于通过补位或哈希算法将所述唯一标识转换为8位或4位十进制数字形式的中间码;An extraction unit 301, configured to convert the unique identifier into an intermediate code in the form of 8-digit or 4-digit decimal numbers through complementation or a hash algorithm;
转换单元302,与所述数字转换单元301相连,用于通过BCD码法或取位法将所述8位或4位十进制数字形式的中间码转换为IPv4地址。The conversion unit 302 is connected with the digital conversion unit 301, and is used for converting the intermediate code in the form of 8-digit or 4-digit decimal numbers into an IPv4 address through the BCD code method or bit extraction method.
其中,所述转换单元302具体可以通过8421码将8位或4位十进制数字形式的中间码转换为二进制4部分形式的IPv4地址,再将每一部分的二进制数字转换为十进制数字,得到十进制,4部分形式的IPv4地址。Wherein, the conversion unit 302 can specifically convert the intermediate code in the form of 8-digit or 4-digit decimal numbers into an IPv4 address in the form of binary 4-parts through the 8421 code, and then convert each part of the binary number into a decimal number to obtain a decimal number, 4 A partial form of an IPv4 address.
或者,所述转换单元302具体可以通过取合适的位数,将8位或4位数字形式的中间码直接转换成十进制4部分形式的IPv4地址。Alternatively, the conversion unit 302 may directly convert the intermediate code in the form of 8-digit or 4-digit numbers into an IPv4 address in decimal 4-part form by taking appropriate digits.
对于IPv6地址,转换模块202的结构相似,也包括提取单元301和转换单元302,不同的是,For the IPv6 address, the structure of the
提取单元301将用于通过补位或哈希算法将所述唯一标识转换为16位或8位十进制数字形式的中间码;The extraction unit 301 will be used to convert the unique identifier into an intermediate code in the form of 16-digit or 8-digit decimal numbers through complementation or a hash algorithm;
转换单元302,与所述数字转换单元301相连,将用于通过BCD码法或取位法将所述16位或8位十进制数字形式的中间码转换为IPv6地址。The conversion unit 302 is connected with the digital conversion unit 301, and is used to convert the intermediate code in the form of 16-digit or 8-digit decimal numbers into an IPv6 address by BCD code method or bit extraction method.
其中,所述转换单元302具体可以通过8421码将16位或8位十进制数字形式的中间码转换为二进制8部分形式的IPv6地址,再将每一部分的二进制数字转换为十进制数字,得到十进制,8部分形式的IPv6地址主机号;再将所述IPv6地址主机号与预先取得的IPv6地址前缀组合为完整IPv6地址。Wherein, the conversion unit 302 can specifically convert the intermediate code in the form of 16 or 8 decimal numbers into an IPv6 address in the form of binary 8 parts through 8421 code, and then convert each part of the binary number into a decimal number to obtain decimal, 8 An IPv6 address host number in a partial form; and then combine the IPv6 address host number with a pre-acquired IPv6 address prefix to form a complete IPv6 address.
或者,所述转换单元302具体可以通过取合适的位数,将16位或8位数字形式的中间码直接转换成十进制8部分形式的IPv6地址主机号;再将所述IPv6地址主机号与预先取得的IPv6地址前缀组合为完整IPv6地址。Or, the conversion unit 302 can directly convert the intermediate code in the form of 16 or 8 digits into the IPv6 address host number in the form of decimal 8 parts by taking appropriate number of digits; The obtained IPv6 address prefix is combined into a complete IPv6 address.
上述实施例中,各模块、单元执行的具体操作可以参考上述方法实施例的转换部分,这里不再赘述。In the foregoing embodiments, for specific operations performed by each module and unit, reference may be made to the conversion part of the foregoing method embodiments, which will not be repeated here.
由上述的实施例可见,本发明的这种脱网终端的IP地址自动生成方法及装置,利用脱网终端本身在网络内的某种唯一标识,通过特定算法使之转换为IPv4或IPv6地址,以唯一标识的唯一性保证转换后的IPv4或IPv6地址的唯一性,因而无需发送唯一性检测报文。另外,脱网终端使用相同的算法即可通过对端的所述唯一标识而得到对端的IPv4或IPv6地址,从而无需DNS系统的支持,即可实现端对端通信。It can be seen from the above-mentioned embodiments that the method and device for automatically generating the IP address of the off-net terminal of the present invention utilizes a certain unique identifier of the off-net terminal itself in the network, and converts it into an IPv4 or IPv6 address through a specific algorithm, The uniqueness of the unique identifier is used to ensure the uniqueness of the converted IPv4 or IPv6 address, so there is no need to send a uniqueness detection message. In addition, the off-net terminal can use the same algorithm to obtain the IPv4 or IPv6 address of the peer end through the unique identifier of the peer end, so that end-to-end communication can be realized without the support of the DNS system.
以上所述仅为本发明的较佳实施例而已,并不用以限制本发明,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明保护的范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the present invention. within the scope of protection.
Claims (18)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2011101593392A CN102833360A (en) | 2011-06-14 | 2011-06-14 | Method and device for automatically generating Internet protocol (IP) address of off-line terminal |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2011101593392A CN102833360A (en) | 2011-06-14 | 2011-06-14 | Method and device for automatically generating Internet protocol (IP) address of off-line terminal |
Publications (1)
Publication Number | Publication Date |
---|---|
CN102833360A true CN102833360A (en) | 2012-12-19 |
Family
ID=47336327
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2011101593392A Pending CN102833360A (en) | 2011-06-14 | 2011-06-14 | Method and device for automatically generating Internet protocol (IP) address of off-line terminal |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102833360A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105959424A (en) * | 2016-04-21 | 2016-09-21 | 北京千丁互联科技有限公司 | Terminal device for intelligent community, a static IP allocation method for intelligent community, and communication method for intelligent community |
CN105959425A (en) * | 2016-04-21 | 2016-09-21 | 北京千丁互联科技有限公司 | Communication method and system for intelligent community, talkback terminal for intelligent community, and core switch for intelligent community |
CN111131527A (en) * | 2018-10-31 | 2020-05-08 | 赵建国 | A technology and method for identity-based address generation and direct addressing |
CN113556412A (en) * | 2021-07-29 | 2021-10-26 | 中车南京浦镇车辆有限公司 | Network address setting method for rail transit vehicle terminal equipment |
CN114338596A (en) * | 2021-12-23 | 2022-04-12 | 天翼视讯传媒有限公司 | IPv6 and IPv4 conversion method applied to network migration |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5812819A (en) * | 1995-06-05 | 1998-09-22 | Shiva Corporation | Remote access apparatus and method which allow dynamic internet protocol (IP) address management |
JP3279511B2 (en) * | 1997-09-09 | 2002-04-30 | 日本電信電話株式会社 | IP address setting method |
CN1400549A (en) * | 2001-08-07 | 2003-03-05 | 华为技术有限公司 | Method for searching data in data base and distributing IP address to users dial-connected with network |
CN1514593A (en) * | 2003-08-06 | 2004-07-21 | 浙江大学 | Method and system for automatically generating IPV9 addresses and searching for corresponding IP addresses |
-
2011
- 2011-06-14 CN CN2011101593392A patent/CN102833360A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US5812819A (en) * | 1995-06-05 | 1998-09-22 | Shiva Corporation | Remote access apparatus and method which allow dynamic internet protocol (IP) address management |
JP3279511B2 (en) * | 1997-09-09 | 2002-04-30 | 日本電信電話株式会社 | IP address setting method |
CN1400549A (en) * | 2001-08-07 | 2003-03-05 | 华为技术有限公司 | Method for searching data in data base and distributing IP address to users dial-connected with network |
CN1514593A (en) * | 2003-08-06 | 2004-07-21 | 浙江大学 | Method and system for automatically generating IPV9 addresses and searching for corresponding IP addresses |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105959424A (en) * | 2016-04-21 | 2016-09-21 | 北京千丁互联科技有限公司 | Terminal device for intelligent community, a static IP allocation method for intelligent community, and communication method for intelligent community |
CN105959425A (en) * | 2016-04-21 | 2016-09-21 | 北京千丁互联科技有限公司 | Communication method and system for intelligent community, talkback terminal for intelligent community, and core switch for intelligent community |
CN105959425B (en) * | 2016-04-21 | 2019-04-16 | 北京千丁互联科技有限公司 | Communication means, system and its intercommunication terminal and core switch of intelligent residential district |
CN105959424B (en) * | 2016-04-21 | 2019-04-30 | 北京千丁互联科技有限公司 | Terminal device, static IP distribution method and the communication means of intelligent residential district |
CN111131527A (en) * | 2018-10-31 | 2020-05-08 | 赵建国 | A technology and method for identity-based address generation and direct addressing |
CN113556412A (en) * | 2021-07-29 | 2021-10-26 | 中车南京浦镇车辆有限公司 | Network address setting method for rail transit vehicle terminal equipment |
CN114338596A (en) * | 2021-12-23 | 2022-04-12 | 天翼视讯传媒有限公司 | IPv6 and IPv4 conversion method applied to network migration |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102833360A (en) | Method and device for automatically generating Internet protocol (IP) address of off-line terminal | |
JP5485300B2 (en) | Communication of session specific information from access network to user equipment | |
CN102790813B (en) | Communication method as well as system and terminal equipment based on IPv6 (internet protocol version 6) network | |
EP3319272B1 (en) | Communication method, device and system based on data link layer | |
EP2553909A1 (en) | Method and apparatus for processing packets in ipv6 network | |
CN101860864A (en) | Method for registering for account for mobile phone client user automatically | |
MX2010010212A (en) | Address redirection for nodes with multiple internet protocol addresses in a wireless network. | |
CN101729500A (en) | Method, device and system for identifying IP session | |
CN101610295B (en) | Stateless IPv4/IPv6 grouping transformation method using non-specific IPv6 address | |
CN103384282B (en) | The method and BRAS of a kind of acquisition IPV6ND addresses | |
US20130225213A1 (en) | System and method for direct messaging between mobile stations using packet-based communications | |
US20170187545A1 (en) | Communication apparatus, car integrated management system, and routing table update method | |
WO2018188759A1 (en) | Configuration of an m2m device | |
CN103227842B (en) | A kind of method and apparatus obtaining sip server address | |
CN102497456A (en) | System and method for realizing automatic generation of client address on basis of dynamic host configuration protocol (DHCP) protocol | |
CN105306607A (en) | Domain name inquiry method and system | |
EP2532147B1 (en) | Method for generating a permanent public SIP address associated with a private identity on an IMS network | |
WO2014117727A1 (en) | Media transfer method, apparatus and system | |
CN101938789B (en) | Method and system for selecting packet network gateway with designated capability | |
US9635526B2 (en) | Methods, systems, and computer readable media for utilizing a diameter proxy agent to communicate short message service (SMS) messages | |
CN108401039A (en) | A kind of marker method and system of ZigBee node | |
JP2012527794A (en) | Method and system for host identity tag acquisition | |
CN108471440A (en) | Digital talkback method and system | |
CN104301450B (en) | The method and device of addressing | |
CN102238084B (en) | Method and device for forwarding cross-domain message, route equipment and client |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
ASS | Succession or assignment of patent right |
Owner name: CHINA POTEVIO CO., LTD. Free format text: FORMER OWNER: POTEVIO INFORMATION TECHNOLOGY CO., LTD. Effective date: 20150417 |
|
C41 | Transfer of patent application or patent right or utility model | ||
C53 | Correction of patent of invention or patent application | ||
CB02 | Change of applicant information |
Address after: 100080 Beijing, Haidian, North Street, No. two, No. 6, No. Applicant after: POTEVIO INFORMATION TECHNOLOGY Co.,Ltd. Address before: 100080 Beijing, Haidian, North Street, No. two, No. 6, No. Applicant before: PETEVIO INSTITUTE OF TECHNOLOGY Co.,Ltd. |
|
COR | Change of bibliographic data |
Free format text: CORRECT: APPLICANT; FROM: PUTIAN IT TECH INST CO., LTD. TO: POTEVIO INFORMATION TECHNOLOGY CO., LTD. |
|
TA01 | Transfer of patent application right |
Effective date of registration: 20150417 Address after: 100080, No. two, 2 street, Zhongguancun science and Technology Park, Beijing, Haidian District Applicant after: CHINA POTEVIO CO.,LTD. Address before: 100080 Beijing, Haidian, North Street, No. two, No. 6, No. Applicant before: POTEVIO INFORMATION TECHNOLOGY Co.,Ltd. |
|
C12 | Rejection of a patent application after its publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20121219 |