Address prefix conflict detection method and device

By detecting and marking conflicting address prefixes in IPv6 networks, the problem of multiple routers or DHCPv6 servers sending conflicting address prefixes is solved, achieving a more stable network connection and a better user experience.

CN120223676AActive Publication Date: 2025-06-27NEW H3C TECH CO LTD

Patent Information

Application Number
CN202510350568.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-06-27
Estimated Expiration
2045-03-24

AI Technical Summary

Technical Problem

In IPv6 addressing, multiple routers or DHCPv6 servers may send conflicting address prefixes, causing different terminals to generate the same IPv6 address, resulting in address conflicts, and affecting the stability of network connections.

Method used

Send neighbor request messages through multicast, receive and detect address prefix conflicts in neighbor notification messages, and mark conflicts in conflicts as unavailable states, thereby avoiding their use.

Benefits of technology

It effectively solves the problem of different terminals generating the same IPv6 address based on the conflicting address prefix of different devices, reducing address conflicts and improving network connection stability and user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120223676A_ABST
    Figure CN120223676A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an address prefix conflict detection method and device, and relates to the technical field of communication, the method is applied to a first device, and the method comprises the following steps: multicast sending a first neighbor request message, the first neighbor request message comprising a first address prefix, sending a neighbor notification message by a second device holding an address prefix conflicting with the first address prefix; within a preset waiting response duration, a first neighbor notification message is received, and the first neighbor notification message comprises a second address prefix; and if the first address prefix conflicts with the second address prefix, marking the first address prefix as an unavailable state. According to the scheme, the problem that different terminals generate the same IPv6 address according to conflicting address prefixes from different first devices, and address conflicts are generated can be solved, and the stability of network connection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technologies, and in particular, to an address prefix conflict detection method and apparatus. Background Art

[0002] The Internet Protocol version 6 (IPv6) addressing scheme includes a stateful dynamic address configuration scheme and a Stateless Address Autoconfiguration (SLAAC) scheme.

[0003] When the SLAAC scheme is used for IPv6 addressing, there may be multiple routers in the network sending Router Advertisement (RA) messages carrying conflicting address prefixes. When the dynamic address configuration scheme of the Dynamic Host Configuration Protocol for IPv6 (DHCPv6) is used for IPv6 addressing, there may be multiple DHCPv6 servers in the network allocating conflicting address prefixes to DHCPv6 clients. In this case, different terminals are very likely to generate the same IPv6 address based on the conflicting address prefixes from different routers or DHCPv6 servers, resulting in address conflicts.

[0004] In addition, when a router publishes an address prefix to a terminal, it also sends a default gateway address to the terminal. When a terminal receives conflicting address prefixes from different devices, it will obtain multiple different default gateway addresses corresponding to the conflicting address prefixes. At this time, when the terminal generates an IPv6 address based on the conflicting address prefix and accesses the network based on the IPv6 address, it will frequently switch the default gateway within the range of the default gateways corresponding to these default gateway addresses, resulting in unstable network connections and affecting the user's Internet experience. Summary of the Invention

[0005] The purpose of the embodiments of this application is to provide an address prefix conflict detection method and apparatus to solve the problem that different terminals generate the same IPv6 address based on conflicting address prefixes from different devices, resulting in address conflicts, and to improve the stability of network connections. The specific technical solutions are as follows:

[0006] In a first aspect, the embodiments of this application provide an address prefix conflict detection method, which is applied to a first device, and the method includes:

[0007] Multicast a first neighbor solicitation message, where the first neighbor solicitation message includes a first address prefix, so that a second device holding an address prefix conflicting with the first address prefix sends a neighbor advertisement message;

[0008] Within a preset waiting response duration, receive a first neighbor advertisement message, where the first neighbor advertisement message includes a second address prefix;

[0009] If the first address prefix conflicts with the second address prefix, mark the first address prefix as an unavailable state.

[0010] In some embodiments, the first neighbor solicitation message includes a first option field; the first neighbor advertisement message includes a second option field;

[0011] The first option field is used to carry a first address and a first prefix length, and the first address prefix is determined in the first address through the first prefix length;

[0012] The second option field is used to carry a second address and a second prefix length, and the second address prefix is determined in the second address through the second prefix length.

[0013] In some embodiments, the first neighbor solicitation message includes a first destination address field and a third option field; the first neighbor advertisement message includes a second destination address field and a fourth option field;

[0014] The first destination address field is used to carry a first address;

[0015] The third option field is used to carry a first prefix length, and the first address prefix is determined in the first address through the first prefix length;

[0016] The second destination address field is used to carry a third address, where the third address is the destination address carried in the neighbor solicitation message received by the second device;

[0017] The fourth option field is used to carry a second address and a second prefix length, and the second address prefix is determined in the second address through the second prefix length.

[0018] In some embodiments, the step of if the first address prefix conflicts with the second address prefix, then marking the first address prefix as an unavailable state includes:

[0019] If the first prefix length is greater than the second prefix length, and a first detected prefix is the same as the second address prefix, then mark the first address prefix as an unavailable state, where the first detected prefix is determined in the first address through the second prefix length; or,

[0020] If the length of the first prefix is less than the length of the second prefix, and the first address prefix is the same as the second detection prefix, mark the first address prefix as unavailable. The second detection prefix is determined in the second address through the length of the first prefix; or,

[0021] If the length of the first prefix is equal to the length of the second prefix, and the first address prefix is the same as the second address prefix, mark the first address prefix as unavailable.

[0022] In some embodiments, the step of marking the first address prefix as unavailable if the first address prefix conflicts with the second address prefix includes:

[0023] If the value of the first target address field is the same as the value of the second target address field, mark the first address prefix as unavailable.

[0024] In some embodiments, the first neighbor advertisement message further includes a fifth option field;

[0025] The fifth option field is used to carry the first address and the length of the first prefix;

[0026] The step of marking the first address prefix as unavailable if the first address prefix conflicts with the second address prefix includes:

[0027] If the value of the first option field is the same as the value of the fifth option field, mark the first address prefix as unavailable.

[0028] In some embodiments, the method further includes:

[0029] Before multicasting the first neighbor solicitation message, mark the first address prefix as paused;

[0030] After the preset waiting response duration, if a neighbor advertisement message carrying an address prefix conflicting with the first address prefix is not received, mark the first address prefix as available.

[0031] In some embodiments, the first device is a router; the method further includes:

[0032] Send a first routing advertisement message, where the first routing advertisement message includes the first address prefix.

[0033] In some embodiments, the first device is a DHCPv6 client; when marking the first address prefix as unavailable, the method further includes:

[0034] Send a DHCPv6 reject message to the DHCPv6 server, where the DHCPv6 reject message includes an Identity Association for Prefix Delegation (IAPD) option for carrying the first address prefix, so that the DHCPv6 server marks the first address prefix as unavailable according to the DHCPv6 reject message.

[0035] In some embodiments, the first device is a DHCPv6 client; when marking the first address prefix as unavailable, the method further includes:

[0036] Divide the first address prefix into multiple sub-address prefixes and send multiple second router advertisement messages, each of which includes a sub-address prefix; or,

[0037] Allocate an Identity Association for Non-temporary Addresses (IANA) address for the accessed third device according to the first address prefix; or,

[0038] Generate an IPv6 address of the DHCPv6 client according to the first address prefix.

[0039] In a second aspect, an embodiment of the present application provides an address prefix conflict detection method applied to a first device. The method includes:

[0040] Receive a second neighbor solicitation message, where the second neighbor solicitation message includes a third address prefix;

[0041] If the third address prefix conflicts with a fourth address prefix held by the first device, send a second neighbor advertisement message, where the second neighbor advertisement message includes the fourth address prefix.

[0042] In some embodiments, the second neighbor solicitation message includes a first option field; the second neighbor advertisement message includes a second option field;

[0043] The first option field is used to carry a third address and a third prefix length, and the first third prefix length bits of the third address are the third address prefix;

[0044] The second option field is used to carry a fourth address and a fourth prefix length, and the first fourth prefix length bits of the fourth address are the fourth address prefix.

[0045] In some embodiments, the second neighbor advertisement message further includes a fifth option field; the fifth option field is used to carry the third address and the third prefix length.

[0046] In some embodiments, the second neighbor solicitation message includes a first destination address field and a third option field; the second neighbor advertisement message includes a second destination address field and a fourth option field;

[0047] The first destination address field is used to carry the third address;

[0048] The third option field is used to carry the third prefix length, and the first [third] prefix length bits of the third address are the third address prefix;

[0049] The second destination address field is used to carry the fourth address;

[0050] The fourth option field is used to carry the fourth address and the fourth prefix length, and the first [fourth] prefix length bits of the fourth address are the fourth address prefix.

[0051] In some embodiments, if the third address prefix conflicts with the fourth address prefix held by the first device, sending the second neighbor advertisement message includes:

[0052] If the third prefix length is greater than the fourth prefix length, and the third detection prefix is the same as the fourth address prefix, send the second neighbor advertisement message, where the third detection prefix is determined in the third address by the fourth prefix length; or,

[0053] If the third prefix length is less than the fourth prefix length, and the third address prefix is the same as the fourth detection prefix, send the second neighbor advertisement message, where the fourth detection prefix is determined in the fourth address by the third prefix length; or,

[0054] If the third prefix length is equal to the fourth prefix length, and the third address prefix is the same as the fourth address prefix, send the second neighbor advertisement message.

[0055] In a third aspect, an embodiment of the present application provides an address prefix conflict detection device, which is applied to a first device, and the device includes:

[0056] A first sending module, configured to multicast a first neighbor solicitation message, where the first neighbor solicitation message includes a first address prefix, so that a second device holding an address prefix conflicting with the first address prefix sends a neighbor advertisement message;

[0057] Note: There seems to be a typo in the original text where it says "the first [third] prefix length bits" and "the first [fourth] prefix length bits" in and . It should probably be just "third" and "fourth" respectively. This has been translated as is but noted for clarity.A first receiving module, configured to receive a first neighbor advertisement message within a preset waiting response duration, where the first neighbor advertisement message includes a second address prefix;

[0058] A marking module, configured to mark the first address prefix as an unavailable state if the first address prefix conflicts with the second address prefix.

[0059] In a fourth aspect, an embodiment of the present application provides an address prefix conflict detection device, which is applied to a first device. The device includes:

[0060] A second receiving module, configured to receive a second neighbor request message, where the second neighbor request message includes a third address prefix;

[0061] A fourth sending module, configured to send a second neighbor advertisement message if the third address prefix conflicts with a fourth address prefix held by the first device, where the second neighbor advertisement message includes the fourth address prefix.

[0062] In a fifth aspect, an embodiment of the present application further provides a first device, including a processor, a communication interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus;

[0063] The memory is used to store a computer program;

[0064] The processor is configured to implement any of the above address prefix conflict detection methods when executing the program stored on the memory.

[0065] In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored in the computer-readable storage medium, and the computer program implements any of the above address prefix conflict detection methods when executed by a processor.

[0066] In a seventh aspect, an embodiment of the present application further provides a computer program product including instructions, which causes a computer to execute any of the above address prefix conflict detection methods when running on the computer.

[0067] Beneficial effects of the embodiments of the present application:

[0068] In the technical solution provided by the embodiment of the present application, the first device uses the address prefixes carried in the NS message and the NA message to detect the address prefix (such as the first address prefix) in the first device that conflicts with the address prefix held by the second device, and marks the conflicting address prefix as unavailable. In this way, the first device will not use the conflicting address prefix, such as not advertising the conflicting address prefix, and thus different terminals will not receive the conflicting address prefixes advertised by different devices, and different terminals will not generate the same IPv6 address based on the conflicting address prefixes from different devices, solving the problem of address conflicts caused by different terminals generating the same IPv6 address based on the conflicting address prefixes from different devices.

[0069] In addition, the address prefixes advertised by different devices are different. A terminal will not receive conflicting address prefixes from different devices, and there is only one default gateway address corresponding to one address prefix. In the absence of multiple default gateway addresses, the terminal will not frequently switch the default gateway, improving the stability of the network connection and the user's Internet experience.

[0070] Of course, implementing any product or method of the present application does not necessarily require achieving all the above-mentioned advantages simultaneously. BRIEF DESCRIPTION OF THE DRAWINGS

[0071] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only some embodiments of the present application, and those of ordinary skill in the art can also obtain other embodiments based on these drawings.

[0072] Figure 1a It is a schematic diagram of a DHCPv6 four-step interaction allocation process;

[0073] Figure 1b It is a schematic diagram of a DHCPv6 two-step interaction allocation process;

[0074] Figure 2 It is a schematic diagram of the working principle of DAD;

[0075] Figure 3 It is the first schematic flow diagram of the address prefix conflict detection method provided by the embodiment of the present application;

[0076] Figure 4a It is the first schematic diagram of the format of the option 251 field provided by the embodiment of the present application;

[0077] Figure 4b It is the first schematic diagram of the format of the option 252 field provided by the embodiment of the present application;

[0078] Figure 5a The second schematic diagram of the format of the option 251 field provided by the embodiment of the present application;

[0079] Figure 5b The second schematic diagram of the format of the option 252 field provided by the embodiment of the present application;

[0080] Figure 6 The second flowchart of the address prefix conflict detection method provided by the embodiment of the present application;

[0081] Figure 7 The third flowchart of the address prefix conflict detection method provided by the embodiment of the present application;

[0082] Figure 8 A signaling diagram of the router performing address prefix conflict detection provided by the embodiment of the present application;

[0083] Figure 9 A signaling diagram of the DHCPv6 client performing address prefix conflict detection provided by the embodiment of the present application;

[0084] Figure 10 The first structural schematic diagram of the address prefix conflict detection device provided by the embodiment of the present application;

[0085] Figure 11 The second structural schematic diagram of the address prefix conflict detection device provided by the embodiment of the present application;

[0086] Figure 12 A structural schematic diagram of the first device provided by the embodiment of the present application. Detailed implementation manners

[0087] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art based on the present application belong to the scope of protection of the present application.

[0088] In a network, the Internet Protocol version 6 (IPv6) addressing scheme includes a stateful dynamic address configuration scheme and a stateless address autoconfiguration (SLAAC) scheme.

[0089] The Dynamic Host Configuration Protocol for IPv6 (DHCPv6) is a stateful dynamic address configuration solution designed for the IPv6 addressing scheme, used to assign IPv6 address prefixes, IPv6 addresses, and other network configuration parameters to hosts.

[0090] The process by which a DHCPv6 server assigns an address / prefix to a DHCPv6 client is divided into two categories: (1) the DHCPv6 four-step interaction assignment process, as Figure 1a shown; (2) the DHCPv6 two-step interaction assignment process, as Figure 1b shown;

[0091] Figure 1a The DHCPv6 four-step interaction assignment process shown is as follows:

[0092] 1) The DHCPv6 client multicasts a Solicit message. The Solicit message is used to locate available DHCPv6 servers.

[0093] 2) After receiving the Solicit message, the DHCPv6 server returns an Advertise message to the DHCPv6 client. The Advertise message includes the IPv6 address prefix, IPv6 address, and other network configuration parameters assigned by the DHCPv6 server to the DHCPv6 client.

[0094] In a network, there are usually multiple DHCPv6 servers. Each DHCPv6 server will return an Advertise message to the DHCPv6 client. That is, the DHCPv6 client can receive multiple Advertise messages and obtain the IPv6 address prefix, IPv6 address, and other network configuration parameters assigned by multiple DHCPv6 servers for it.

[0095] 3) The DHCPv6 client selects a DHCPv6 server and sends a Request message. The Request message includes the IPv6 address prefix, IPv6 address, and other network configuration parameters assigned by the selected DHCPv6 server.

[0096] 4) After receiving the Request message, the selected DHCPv6 server sends a Reply message to the DHCPv6 client. The Reply message includes the IPv6 address prefix, IPv6 address, and other network configuration parameters in the Request message.

[0097] After the DHCPv6 client receives a Reply message, it applies the IPv6 address prefix, IPv6 address, and other network configuration parameters, and the address allocation process is completed.

[0098] Figure 1b The two-step interactive allocation process of DHCPv6 shown is as follows:

[0099] 1) The DHCPv6 client multicasts a Solicit message. The Solicit message is used to locate available DHCPv6 servers, and the Solicit message includes a Rapid Commit option to indicate that the DHCPv6 client supports the rapid allocation mechanism.

[0100] 2) After the DHCPv6 server receives the Solicit message, if the DHCPv6 server also supports the rapid allocation mechanism, it will directly send a Reply message to the DHCPv6 client. The Reply message includes the IPv6 address prefix, IPv6 address, and other network configuration parameters allocated to the DHCPv6 client.

[0101] After the DHCPv6 client receives the Reply message, it applies the IPv6 address prefix, IPv6 address, and other network configuration parameters, and the address allocation process is completed.

[0102] The SLAAC scheme is a mechanism for automatically configuring IPv6 addresses. In the SLAAC scheme, devices are allowed to automatically generate IPv6 addresses by receiving Router Advertisement (RA) messages sent by routers in the absence of a DHCPv6 server. The specific process is as follows:

[0103] 1) The router periodically sends RA messages, and the RA messages contain address prefixes and other network configuration parameters;

[0104] 2) After the device receives the RA message, it generates an IPv6 address based on the address prefix in the RA message and combines it with the device's own interface identifier. Among them, the interface identifier can be the device's own MAC address or randomly generated by the device.

[0105] Compared with the dynamic address configuration scheme of DHCPv6, the SLAAC scheme has the following characteristics:

[0106] 1) Stateless, that is, no DHCPv6 server is required, and devices can configure addresses independently;

[0107] 2) Simple and efficient, suitable for large-scale networks, reducing the dependence on servers;

[0108] 3) Flexibility. The device can dynamically adjust the address configuration according to the information in the RA message.

[0109] In the dynamic address configuration scheme of DHCPv6 and the SLAAC scheme, after the device or the DHCPv6 client generates an IPv6 address, to ensure the uniqueness of the IPv6 address and avoid address conflicts, the device or the DHCPv6 client can perform Duplicate Address Detection (DAD) to verify the uniqueness of the IPv6 address. The working principle of DAD is as Figure 2 shown as follows:

[0110] 1) When a terminal (such as Figure 2 host A shown) obtains a new IPv6 address, mark the IPv6 address as the Tentative state.

[0111] In the Tentative state, the terminal will not use the IPv6 address for communication until it passes the DAD detection. The terminal here can be the device in the above SLAAC scheme or the DHCPv6 client in the dynamic address configuration scheme of DHCPv6.

[0112] 2) The terminal multicasts a Neighbor Solicitation (NS) message to inquire whether there is any other terminal (such as Figure 2 host B shown) in the network that is using the above new IPv6 address.

[0113] The source address (Src) of the NS message is (::) because, at this time, the IPv6 address obtained by the terminal (i.e., the IPv6 address to be detected) is in the Tentative state, and it has not been confirmed whether the IPv6 address is available. The destination address (Dst) of the NS message is determined according to the IPv6 address to be detected. For example, the destination address of the NS message can be FF02::1:FFXX:XXXX, where FF02::1 is the multicast address of all nodes on the link-local, and XX:XXXX is the last 24 bits (bit) of the IPv6 address to be detected. For example, Figure 2 the destination address (Dst) FF02::1:FF00:1 on the host A side in 00:1. The target address of the NS message is the IPv6 address to be detected, such as Figure 2 2000::1 in. The NS message may not include the Source Link-Layer Address option field.

[0114] After other terminals receive the NS message, if they determine that their own IPv6 address is the same as the destination address of the NS message, that is, other terminals have already used the IPv6 address to be detected, they multicast a Neighbor Advertisement (NA) message; if they determine that their own IPv6 address is different from the destination address of the NS message, that is, other terminals have not used the IPv6 address to be detected, they will not respond to the NS message.

[0115] The source address (Src) of the NA message is the IPv6 address of the other terminal (i.e., the IPv6 address to be detected), the destination address (Dst) of the NA message is the multicast address of all nodes on the link local (i.e., FF02::1), and the target address of the NA message is the IPv6 address to be detected (i.e., 2000::1). This NA message may not contain the Source Link-Layer Address option field.

[0116] 3) If a terminal receives an NA message with the destination address being the IPv6 address to be detected (such as 2000::1), it determines that the IPv6 address to be detected has been occupied and abandons using the IPv6 address to be detected. After that, the terminal can generate a new IPv6 address and re-execute the DAD process.

[0117] If a terminal does not receive an NA message with the destination address being the IPv6 address to be detected (such as 2000::1), it determines that the IPv6 address to be detected is unique on the link, and then marks the IPv6 address to be detected as the Valid state. After that, the terminal can use this IPv6 address for communication.

[0118] When using the SLAAC scheme for IPv6 addressing, there may be multiple routers in the network sending RA messages carrying conflicting address prefixes. When using the DHCPv6 dynamic address configuration scheme for IPv6 addressing, there may be multiple DHCPv6 servers in the network allocating conflicting address prefixes to DHCPv6 clients. In this case, different terminals are very likely to generate the same IPv6 address based on the conflicting address prefixes from different first devices, resulting in address conflicts.

[0119] In addition, when a router publishes an address prefix to a terminal (including a DHCPv6 client), it also sends the default gateway address to the terminal. When a terminal receives conflicting address prefixes from different devices, it will obtain multiple different default gateway addresses corresponding to the conflicting address prefixes. At this time, when the terminal generates an IPv6 address based on the conflicting address prefix and accesses the network based on this IPv6 address, it will frequently switch the default gateway within the scope of the default gateways corresponding to these default gateway addresses, resulting in unstable network connections and affecting the user's Internet experience.

[0120] To solve the above problems, an embodiment of the present application provides an address prefix conflict detection method, as Figure 3 shown. The address prefix conflict detection method is applied to a first device, which may be a router in the SLAAC solution or a DHCPv6 client in the DHCPv6 dynamic address configuration solution, and is not limited thereto.

[0121] The above address prefix conflict detection method includes the following steps:

[0122] Step S301: Multicast and send a first NS message, where the first NS message includes a first address prefix, so that a second device holding an address prefix conflicting with the first address prefix sends a NA message;

[0123] Step S302: Receive a first NA message within a preset waiting response time, where the first NA includes a second address prefix;

[0124] Step S303: If the first address prefix conflicts with the second address prefix, mark the first address prefix as an unavailable state.

[0125] In the technical solution provided by the embodiment of the present application, the first device uses the address prefix carried in the NS message and the NA message to detect the address prefix (such as the first address prefix) conflicting with the address prefix held by the second device in the first device, and marks the conflicting address prefix as an unavailable state. In this way, the first device will not use the conflicting address prefix, such as not advertising the conflicting address prefix, and thus different terminals will not receive conflicting address prefixes advertised by different devices, and different terminals will not generate the same IPv6 address based on the conflicting address prefixes from different devices, solving the problem of address conflicts caused by different terminals generating the same IPv6 address based on the conflicting address prefixes from different devices.

[0126] In addition, the address prefixes advertised by different devices are different. A terminal will not receive conflicting address prefixes from different devices, and there is only one default gateway address corresponding to one address prefix. In the absence of multiple default gateway addresses, the terminal will not frequently switch the default gateway, improving the stability of the network connection and the user's Internet experience.

[0127] In the above step S301, the first NS message is any NS message for detecting address prefix conflicts. The first address prefix is any address prefix to be detected. The first device may include one or more address prefixes to be detected. Among them, the address prefix is an IPv6 address prefix. The second device may be a router in the SLAAC solution or a DHCPv6 client in the DHCPv6 dynamic address configuration solution, and is not limited thereto.

[0128] When detecting a conflicting address prefix, the first device obtains a first address prefix to be detected, fills the first address prefix in an NS message to obtain a first NS message, and then multicasts the first NS message.

[0129] After receiving the first NS message, a second device in the network extracts the first address prefix from the first NS message and detects whether the first address prefix conflicts with the address prefixes held by the second device. If one of the address prefixes held by the second device (such as address prefix X) conflicts with the first address prefix, the second device sends a NA message carrying address prefix X.

[0130] Among them, the address prefixes held by the second device can be the address prefixes in the available states (such as the Valid state) included in the second device. The conflict between two address prefixes can be divided into the following two cases:

[0131] Case 1: The two address prefixes are the same. For example, both address prefixes are 1001:: / 16.

[0132] Case 2: One address prefix belongs to the other address prefix. For example, one address prefix 1 is 1001:: / 16, and the other address prefix 2 is 1001:1001:: / 32. At this time, address prefix 2 belongs to address prefix 1.

[0133] In step S302 above, the preset waiting response duration is the duration preset for waiting for the second device to reply to the first NS message, and the starting timing moment of the preset waiting response duration is the moment when the first device sends the first NS message. The first NA message can be any NA message sent by the second device. The second address prefix is any address prefix detected as conflicting by the second device. The size of the preset waiting response duration can be set according to actual needs. For example, the preset waiting response duration can be 1 s, 2 s, 3 s, etc.

[0134] Within the preset waiting response duration, the first device receives the NA message sent by the second device as the first NA message and extracts the second address prefix from the first NA message.

[0135] In step S303 above, the first device performs conflict detection on the first address prefix being conflict-detected and the second address prefix obtained in step S302. If it is detected that the first address prefix conflicts with the second address prefix, the first device can determine that the first NA message is the NA message corresponding to the first NS message, and the first address prefix conflicts with the second address prefix held by the second device. Then, the first address prefix is marked as an unavailable state, such as the Duplicate state. Subsequently, the first device will no longer use the first address prefix.

[0136] If it is detected that the first address prefix does not conflict with the second address prefix, within the preset waiting response duration, the first device continues to receive the NA message sent by the second device.

[0137] To facilitate determining whether the first NA message is the NA message corresponding to the first NS message and accurately determine the conflicting address prefix, in the embodiments of the present application, the first address prefix and the second address prefix can be carried in the first NS message and the first NA message in any of the following ways.

[0138] Method 1: The first NS message includes a first option field; the first NA message includes a second option field; the first option field is used to carry a first address and a first prefix length, and the first address prefix is determined in the first address through the first prefix length; the second option field is used to carry a second address and a second prefix length, and the second address prefix is determined in the second address through the second prefix length.

[0139] In the embodiments of the present application, the first option field and the second option field can be options not allocated by the Request For Comments (RFC) standard, such as options 145 to 252. In one example, the first option field can be option 251, and the second option field can be option 252.

[0140] In the embodiments of the present application, the source address of the first NS message may not be specified, such as the source address of the first NS message is (::). The source address of the first NS message can also be the IPv6 address of the first device. For example, when the first device is a router, the router itself has an IPv6 address, and the first address prefix is the address prefix that the router needs to pass through. At this time, the source address of the first NS message can be the IPv6 address of the router or may not be specified; when the first device is a DHCPv6 client, the first address prefix is the address prefix used by the DHCPv6 client to generate an IPv6 address, and the DHCPv6 client does not yet have an IPv6 address. At this time, the source address of the first NS message may not be specified.

[0141] The destination address of the first NS message can be the all-nodes multicast address of the link local, such as FF02::1. The target address of the first NS message may not be specified, such as the target address of the first NS message is (::). In addition, the first NS message may further include a first option field, such as option 251, and the first option field carries a first address and a first prefix length. Taking the first address prefix as 1001:: / 16 as an example, the first address can be 1001::, and the first prefix length is 16. {1001::, 16} is filled into the first option field. At this time, the message format of the first NS message can be seen in Table 1 shown below.

[0142] Table 1

[0143] Message field NS message Source address :: or the IPv6 address of the first device Destination address FF02::1 Target address :: Option 251 field First address and first prefix length

[0144] Among them, the format of the Option 251 field can be seen in Figure 4a as shown. The Option 251 field includes a Type (T) sub-field, a Length (L) sub-field, and a Value (V) sub-field.

[0145] The T sub-field carries 251, and 251 indicates that the current option field carries the address prefix to be detected. The length of the T sub-field is 1 byte.

[0146] The L sub-field carries the length of the V sub-field. For example, Figure 4a the value 17 of the L sub-field in [] indicates that the length of the V sub-field is 17 bytes, and the length of the L sub-field is 1 byte.

[0147] The V sub-field carries the first address and the first prefix length. The length of the V sub-field is 17 bytes. Among them, the first 16 bytes carry the first address, and the last 1 byte carries the first prefix length.

[0148] In the embodiment of the present application, the source address of the first NA message can be the IPv6 address of the second device that sends the first NA message. The destination address of the first NA message is determined according to the source address of the NS message. For example, if the source address of the NS message is the IPv6 address of the first device, the destination address of the first NA message can be the IPv6 address of the first device or the all-nodes multicast address of the link-local, such as FF02::1; if the source address of the NS message is not specified (such as ::), the destination address of the first NA message is the all-nodes multicast address of the link-local, such as FF02::1.

[0149] The destination address of the first NA message is determined according to the destination address of the NS message. For example, if the destination address of the NS message is not specified (such as ::), the destination address of the first NA message is not specified, such as the destination address of the first NA message is (::).

[0150] In addition, the first NA message may further include a second option field, such as Option 252. The second option field carries the second address and the second prefix length. Taking the second address prefix as 1001:1001:: / 32 as an example, the second address can be 1001:1001::, and the second prefix length is 32. {1001:1001::, 32} is filled into the second option field. At this time, the message format of the first NA message can be seen in Table 2 as shown.

[0151] Table 2

[0152] Message field NA message Source address IPv6 address of the second device Destination address IPv6 address of the first device or FF02::1 Target address :: Option 252 field Second address and second prefix length

[0153] Among them, the format of the Option 252 field can be seen inFigure 4b As shown. The option 252 field includes a T sub-field, an L sub-field, and a V sub-field.

[0154] The T sub-field carries 252, which indicates that the current option field carries a conflicting address prefix. The length of the T sub-field is 1 byte.

[0155] The L sub-field carries the length of the V sub-field. For example, Figure 4b the value 17 of the L sub-field in [reference] indicates that the length of the V sub-field is 17 bytes. The length of the L sub-field is 1 byte.

[0156] The V sub-field carries the second address and the second prefix length. The length of the V sub-field is 17 bytes, where the first 16 bytes carry the second address and the last 1 byte carries the second prefix length.

[0157] In an embodiment of the present application, the first device can extract the first address prefix and the second address prefix from the first option field and the second option field, and then determine whether the first address prefix and the second address prefix conflict. Specifically, if any of the following conditions 1 to 3 is satisfied, the first device can determine that the first address prefix conflicts with the second address prefix, the first NA message is the NA message corresponding to the first NS message, and the first address prefix is marked as an unavailable state.

[0158] Condition 1: The first prefix length is greater than the second prefix length, and the first detected prefix is the same as the second address prefix. The first detected prefix is determined in the first address by the second prefix length. Satisfying Condition 1 indicates that the second address prefix belongs to the first address prefix.

[0159] Condition 2: The first prefix length is less than the second prefix length, and the first address prefix is the same as the second detected prefix. The second detected prefix is determined in the second address by the first prefix length. Satisfying Condition 2 indicates that the first address prefix belongs to the second address prefix.

[0160] Condition 3: The first prefix length is equal to the second prefix length, and the first address prefix is the same as the second address prefix. Satisfying Condition 3 indicates that the first address prefix is the same as the second address prefix.

[0161] In an embodiment of the present application, the first device can determine whether the first address prefix conflicts with the second address prefix through the first option field and the second option field, reducing the complexity of conflict detection for the address prefix. In addition, the first device can obtain the conflicting first address prefix and the second address prefix, facilitating subsequent analysis and elimination of the reasons for the conflict.

[0162] In Mode 2, the first NS message includes a first destination address field and a third option field; the first NA message includes a second destination address field and a fourth option field; the first destination address field is used to carry a first address; the third option field is used to carry a first prefix length, and a first address prefix is determined from the first address according to the first prefix length; the second destination address field is used to carry a third address, where the third address is the destination address carried in the neighbor solicitation message received by the second device; the fourth option field is used to carry a second address and a second prefix length, and a second address prefix is determined from the second address according to the second prefix length.

[0163] In the embodiments of the present application, the third option field and the fourth option field may be options not allocated by the RFC standard, such as options 145 to 252. In one example, the third option field may be option 251, and the fourth option field may be option 252.

[0164] In the embodiments of the present application, the source address of the first NS message may not be specified. For example, the source address of the first NS message is (::). The source address of the first NS message may also be the IPv6 address of the first device. The destination address of the first NS message may be the all-nodes multicast address of the link local, such as FF02::1. The destination address of the first NS message may be the first address, that is, the first destination address field in the first NS message is filled with the first address.

[0165] In addition, the first NS message may further include a third option field, such as option 251, and the third option field carries the first prefix length. Taking the first address prefix as 1001:: / 16 as an example, the first address may be 1001::, the first prefix length is 16, {1001::} is filled into the first destination address field, and {16} is filled into the third option field.

[0166] At this time, the message format of the first NS message can be seen in Table 3.

[0167] Table 3

[0168] Message field NS message Source address :: or the IPv6 address of the first device Destination address FF02::1 Target address First address Option 251 field First prefix length

[0169] Among them, the format of the option 251 field can be seen in Figure 5a as shown. The option 251 field includes a T sub-field, an L sub-field, and a V sub-field.

[0170] The T sub-field carries 251, and 251 indicates that the current option field carries the length of the address prefix to be detected. The length of the T sub-field is 1 byte.

[0171] The L sub-field carries the length of the V sub-field. For example, Figure 5a the value 1 of the L sub-field in indicates that the length of the V sub-field is 1 byte, and the length of the L sub-field is 1 byte.

[0172] The V sub - field carries the first prefix length. The length of the V sub - field is 1 byte.

[0173] In the embodiments of the present application, the source address of the first NA message can be the IPv6 address of the second device that sends the first NA message. The destination address of the first NA message is determined according to the source address of the NS message.

[0174] The destination address of the first NA message can be determined according to the destination address carried in the NS message. For example, if the destination address of the NS message is 1001::, then the destination address of the first NA message is also 1001::.

[0175] In addition, the first NA message may further include a fourth option field, such as option 252. The fourth option field carries the second address and the second prefix length. Taking the second address prefix as 1001:1001:: / 32 as an example, the second address can be 1001:1001::, the second prefix length is 32, and {1001:1001::, 32} is filled into the fourth option field. At this time, the message format of the first NA message can be seen in Table 2 shown above.

[0176] In the embodiments of the present application, the first device can determine the first address prefix and the second address prefix based on the first destination address field, the second destination address field, the third option field, and the fourth option field, and then determine whether the first address prefix and the second address prefix conflict. Specifically, if any one of the above - mentioned conditions 1 to 3 is satisfied, the first device can determine that the first address prefix conflicts with the second address prefix, the first NA message is the NA message corresponding to the first NS message, and mark the first address prefix as an unavailable state.

[0177] In the embodiments of the present application, the first device can also determine whether the first address prefix and the second address prefix conflict based on the first destination address field and the second destination address field. Specifically, if the value of the first destination address field is the same as the value of the second destination address field, it is determined that the first address prefix and the second address prefix conflict, the first NA message is the NA message corresponding to the first NS message, and mark the first address prefix as an unavailable state.

[0178] In the embodiments of the present application, the first device only needs to compare the first destination address field and the second destination address field to determine whether the first address prefix conflicts with the second address prefix, and determine whether the first NA message is the NA message corresponding to the first NS message. This is the same as the operation in the prior art when detecting conflicting addresses. Therefore, the implementation of the embodiments of the present application has less impact on the prior art, is easy to implement, and reduces the complexity of conflict detection.

[0179] In the embodiments of the present application, the first device reuses the target address field in the NS message, reducing the length of the third option field, thereby reducing the length of the NS message and lowering the network overhead. In addition, the first device can obtain the conflicting first address prefix and second address prefix, facilitating subsequent analysis and troubleshooting of the conflict reasons.

[0180] In Method 3, the first NS message includes a first target address field and a third option field; the first NA message includes a second target address field and a sixth option field; the first target address field is used to carry a first address; the third option field is used to carry a first prefix length, and the first address prefix is determined in the first address through the first prefix length; the second target address field is used to carry a second address; the sixth option field is used to carry a second prefix length, and the second address prefix is determined in the second address through the second prefix length.

[0181] In the embodiments of the present application, the third option field and the sixth option field can be options not allocated by the RFC standard, such as options 145 to 252. In one example, the third option field can be option 251, and the sixth option field can be option 252.

[0182] In the embodiments of the present application, the source address of the first NS message may not be specified, or the source address of the first NS message may also be the IPv6 address of the first device. The destination address of the first NS message can be the all-nodes multicast address of the link-local. The target address of the first NS message can be the first address. In addition, the first NS message may further include a third option field, such as option 251, and the third option field carries the first prefix length. At this time, the message format of the first NS message can be seen in Table 3 above.

[0183] In the embodiments of the present application, the source address of the first NA message can be the IPv6 address of the second device that sends the first NA message. The destination address of the first NA message is determined according to the source address of the NS message.

[0184] The target address of the first NA message can be determined by the second address prefix, that is, the second address prefix is split into a second address and a second prefix length, and the second address is used as the target address of the NS message and filled in the second target address field.

[0185] In addition, the first NA message may further include a sixth option field, such as option 252, and the sixth option field carries the second prefix length. Taking the second address prefix as 1001:1001:: / 32 as an example, the second address can be 1001:1001::, the second prefix length is 32, {1001:1001::} is filled into the second target address field, and {32} is filled into the sixth option field. At this time, the message format of the first NA message can be seen in Table 4.

[0186] Table 4

[0187] Message field NA message Source address IPv6 address of the second device Destination address IPv6 address of the first device or FF02::1 Target address Second address Option 252 field Second prefix length

[0188] Among them, for the format of the option 252 field, refer to Figure 5b as shown. The option 252 field includes a T sub-field, an L sub-field, and a V sub-field.

[0189] The T sub-field carries 252, and 252 indicates the length of the conflicting address prefix carried by the current option field. The length of the T sub-field is 1 byte.

[0190] The L sub-field carries the length of the V sub-field. For example, Figure 5b the value 1 of the L sub-field in it indicates that the length of the V sub-field is 1 byte, and the length of the L sub-field is 1 byte.

[0191] The V sub-field carries the second prefix length. The length of the V sub-field is 1 byte.

[0192] In the embodiments of the present application, the first device can determine the first address prefix and the second address prefix based on the first target address field, the second target address field, the third option field, and the sixth option field, and then determine whether the first address prefix and the second address prefix conflict. Specifically, if any one of the above conditions 1 to 3 is satisfied, the first device can determine that the first address prefix conflicts with the second address prefix, the first NA message is the NA message corresponding to the first NS message, and the first address prefix is marked as an unavailable state.

[0193] In the embodiments of the present application, the first device multiplexes the target address fields in the NS message and the NA message, reduces the lengths of the third option field and the sixth option field, and further reduces the lengths of the NS message and the NA message, thereby reducing the network overhead. In addition, the first device can obtain the conflicting first address prefix and the second address prefix, which is convenient for subsequent analysis and elimination of the reasons for the conflict.

[0194] Method 4: The first NS message includes a first target address field and a third option field; the first NA message includes a second target address field and a sixth option field; the first target address field is used to carry the first address; the third option field is used to carry the first prefix length, and the first address prefix is determined in the first address through the first prefix length; the second target address field is used to carry the first address; the sixth option field is used to carry the second prefix length, and the second address prefix is determined in the second address through the second prefix length.

[0195] In the embodiments of the present application, the third option field and the sixth option field can be options not allocated by the RFC standard, such as options 145 to 252. In one example, the third option field can be option 251, and the sixth option field can be option 252.

[0196] In the embodiment of the present application, the message format of the first NS message can refer to the relevant description of the first NS message in the above-mentioned method 2, which will not be elaborated here.

[0197] In the embodiment of the present application, the source address of the first NA message can be the IPv6 address of the second device that sends the first NA message. The destination address of the first NA message is determined according to the source address of the NS message.

[0198] The destination address of the first NA message can be determined according to the destination address of the NS message. For example, if the destination address of the NS message is the first address, then the destination address of the first NA message is the first address, that is, the first address is used as the second address, and the first address is filled in the second destination address field in the first NA message.

[0199] In addition, the first NA message may further include a sixth option field, such as option 252, and the sixth option field carries the second prefix length. At this time, the message format of the first NA message can refer to Table 5 shown below.

[0200] Table 5

[0201] Message field NA message Source address IPv6 address of the second device Destination address IPv6 address of the first device or FF02::1 Target address First address Option 252 field Second prefix length

[0202] Among them, the format of the option 252 field can refer to Figure 5b as shown below.

[0203] In the embodiment of the present application, the first device can perform conflict detection on the values of the first destination address field and the second destination address field; if it is determined that the values of the first destination address field and the second destination address field are the same, that is, the first address in the first destination address field is the same as the second address in the second destination address field, it can be determined that the first address prefix conflicts with the second address prefix, the first NA message is the NA message corresponding to the first NS message, and the first address prefix is marked as an unavailable state.

[0204] In the embodiment of the present application, the first device only needs to compare the first destination address field and the second destination address field to determine whether the first address prefix conflicts with the second address prefix and determine whether the first NA message is the NA message corresponding to the first NS message. This is the same as the operation in the prior art when detecting conflict addresses. Therefore, the implementation of the embodiment of the present application has less impact on the prior art, is easy to implement, and reduces the complexity of conflict detection.

[0205] In Mode 5, the first NS message includes a first option field; the first NA message includes a second option field and a fifth option field; the first option field is used to carry a first address and a first prefix length, and a first address prefix is determined in the first address through the first prefix length; the second option field is used to carry a second address and a second prefix length, and a second address prefix is determined in the second address through the second prefix length, and the fifth option field is used to carry the first address and the first prefix length.

[0206] In the embodiments of the present application, the first option field, the second option field, and the fifth option field may be options not allocated by the RFC standard, such as options 145 to 252. In one example, the first option field and the fifth option field may be option 251, and the second option field may be option 252.

[0207] In the embodiments of the present application, for the message format of the first NS message, reference may be made to the relevant description of the first NS message in the above-mentioned Mode 1, which will not be elaborated here.

[0208] In the embodiments of the present application, the source address of the first NA message may be the IPv6 address of the second device that sends the first NA message. The destination address of the first NA message is determined according to the source address of the NS message. The target address of the first NA message is determined according to the target address of the NS message.

[0209] In addition, the first NA message may further include a second option field and a fifth option field. For example, the second option field may be option 252, and the second option field carries a second address and a second prefix length. The fifth option field may be option 251, and the fifth option field carries a first address and a first prefix length. The fifth option field may be the first option field in the NS message extracted by the second device. Taking the first address prefix as 1001:: / 16 and the second address prefix as 1001:1001:: / 32 as an example, the first address may be 1001::, the first prefix length is 16, the second address may be 1001:1001::, and the second prefix length is 32. The second device fills {1001:1001::, 32} into the second option field, and the first device fills {1001::, 16} into the first option field. When the second device responds to the NS message, it takes the first option field {1001::, 16} as the fifth option field and adds it to the first NA message. At this time, for the message format of the first NA message, reference may be made to Table 6 shown below.

[0210] Table 6

[0211] Message field NA message Source address IPv6 address of the second device Destination address IPv6 address of the first device or FF02::1 Target address :: Option 251 field First address and first prefix length Option 252 field Second address and second prefix length

[0212] Among them, for the format of the option 252 field, reference may be made to Figure 4a shown below. For the format of the option 252 field, reference may be made toFigure 4b as shown

[0213] In an embodiment of the present application, the first device may perform conflict detection on the values of the first option field and the fifth option field. If the value of the first option field is the same as the value of the fifth option field, the first device may determine that the first address prefix conflicts with the second address prefix, the first NA message is the NA message corresponding to the first NS message, and mark the first address prefix as an unavailable state.

[0214] In an embodiment of the present application, through the first option field and the fifth option field, the first device can determine whether the first address prefix conflicts with the second address prefix, without extracting multiple fields to determine the first address prefix and the second address prefix, reducing the complexity of conflict detection of the address prefix. In addition, the first device can obtain the conflicting first address prefix and the second address prefix, facilitating subsequent analysis and elimination of the reasons for the conflict.

[0215] In some embodiments, as Figure 6 shown, a method for detecting address prefix conflict is further provided, which is applied to the first device. The method may include the following steps:

[0216] Step S601, mark the first address prefix as a suspended state;

[0217] Before multicasting the first NS message, the first device may mark the first address prefix as a suspended state (such as the Tentative state).

[0218] For the address prefix whose conflict is being detected, it is not the address prefix held by the first device. In an embodiment of the present application, the first device marking the first address prefix whose conflict is being detected as the Tentative state can enable the first device to accurately know that the first address prefix is not the address prefix held by the first device. When receiving the NS message sent by the second device, the first device will not consider the first address prefix. That is, when the NS message sent by the second device carries an address prefix conflicting with the first address prefix, the first device will not send the corresponding NA message. This can effectively avoid the problem that an address prefix is not used by all devices in the network.

[0219] Step S602, multicast the first NS message, where the first NS message includes the first address prefix, so that the second device holding an address prefix conflicting with the first address prefix sends a neighbor advertisement message; the same as step S301 above.

[0220] Step S603, within a preset waiting response duration, receive the first NA message, where the first NA includes the second address prefix; the same as step S302 above.

[0221] Step S604, if the first address prefix conflicts with the second address prefix, mark the first address prefix as unavailable; the same as step S303 above.

[0222] Step S605, if the first address prefix does not conflict with the second address prefix, return to execute step S603.

[0223] Step S606, after the preset waiting response duration, if no NA packet carrying an address prefix conflicting with the first address prefix is received, mark the first address prefix as available.

[0224] In the embodiment of the present application, after the first device sends the first NS packet, it waits for the response of the second device to the first NS packet. Within the preset waiting response duration, for any received NA packet, such as the first NA packet, the first device determines whether the first NA packet is a response to the first NS packet (i.e., the NA packet corresponding to the first NS packet).

[0225] If it is determined that the first NA packet is a response to the first NS packet, that is, the first address prefix conflicts with the second address prefix, mark the first address prefix as unavailable. If it is determined that the first NA packet is not a response to the first NS packet, that is, the first address prefix does not conflict with the second address prefix, continue to wait for the response of the second device to the first NS packet until the preset waiting response duration times out.

[0226] After the preset waiting response duration times out, if the first device still has not received an NA packet carrying an address prefix conflicting with the first address prefix, it means that the first address prefix does not conflict with the address prefix held by the second device, and mark the first address prefix as available (such as the Valid state). Subsequently, the first device can use this first address prefix.

[0227] In the embodiment of the present application, if the type of the first device is different, for the first address prefix in the available state, the first device uses the first address prefix in different processing manners as follows.

[0228] 1) The first device is a router.

[0229] After marking the first address prefix as available, the router sends a first RA packet, and the first RA packet includes the first address prefix.

[0230] In the embodiment of the present application, before the router sends the first RA packet, it executes the address prefix conflict detection method shown above Figure 3 or Figure 6 to perform conflict detection on the first address prefix of the router itself. After detecting that the first address prefix does not conflict with the address prefix held by the second device, the router notifies the first address prefix to other devices, such as terminals like the above-mentioned host.

[0231] After detecting a conflict between the first address prefix and the address prefix held by the second device, the router may not advertise the first address prefix to other devices, ensuring that the address prefixes advertised by the router are not repeated, thereby avoiding the generation of conflicting IPv6 addresses by other devices.

[0232] 2) The first device is a DHCPv6 client.

[0233] After marking the first address prefix as available, the DHCPv6 client uses the first address prefix. After marking the first address prefix as unavailable, the DHCPv6 client sends a DHCPv6 Decline message to the DHCPv6 server. The DHCPv6 Decline message includes an Identity Association for Prefix Delegation (IAPD) option, and the IAPD option is used to carry the first address prefix so that the DHCPv6 server marks the first address prefix as unavailable according to the DHCPv6 Decline message.

[0234] In the embodiments of the present application, after the DHCPv6 client applies for an IAPD (i.e., the first address prefix) from the DHCPv6 server, the above Figure 3 or Figure 6 The address prefix conflict detection method shown is performed to detect conflicts of the applied IAPD (i.e., the first address prefix). The IAPD applied by the DHCPv6 client may be: the IAPD carried in the Reply message sent by the DHCPv6 server to the DHCPv6 client after receiving the Request message during the four-step interaction allocation process of DHCPv6; the IAPD applied by the DHCPv6 client may also be: the IAPD carried in the Reply message sent by the DHCPv6 server to the DHCPv6 client after receiving the Solicit message during the two-step interaction allocation process of DHCPv6.

[0235] After detecting that the first address prefix does not conflict with the address prefix held by the second device, the DHCPv6 client can use the first address prefix. Specifically, the first address prefix can be used in any of the following ways:

[0236] A. The DHCPv6 client, as a router, divides the first address prefix into multiple sub-address prefixes and sends multiple second Router Advertisement (RA) messages, and each second RA message includes a sub-address prefix;

[0237] B. As a DHCPv6 server, the DHCPv6 client assigns IANA addresses to the third device that accesses according to the first address prefix. That is, the DHCPv6 client adopts a four-step interaction allocation process or a two-step interaction allocation process to assign IPv6 addresses to other DHCPv6 clients connected below it;

[0238] C. As a terminal (such as a host), the DHCPv6 client generates an IPv6 address of the DHCPv6 client according to the first address prefix, that is, generates a global unicast address of the DHCPv6 client.

[0239] After detecting that the first address prefix conflicts with the address prefix held by the second device, the DHCPv6 client can not use the first address prefix, ensuring that the address prefix applied for by the DHCPv6 client is not repeated, thereby avoiding the generation of conflicting IPv6 addresses by different devices.

[0240] In addition, the DHCPv6 client constructs a DHCPv6 Decline message, encapsulates the IAPD option in the DHCPv6 Decline message, and sends the DHCPv6 Decline message encapsulated with the IAPD option to the DHCPv6 server. In this way, after receiving the DHCPv6 Decline message encapsulated with the IAPD option, the DHCPv6 server can extract the first address prefix from the IAPD option and mark the first address prefix as unavailable. The DHCPv6 server records the conflict event of the first address prefix, which is convenient for subsequent analysis and troubleshooting of the conflict cause and the conflicting device.

[0241] In the DHCPv6 dynamic address configuration scheme, there may also be a DHCPv6 relay in the network. After receiving the DHCPv6 Decline message encapsulated with the IAPD option, the DHCPv6 relay can directly forward the DHCPv6 Decline message to the DHCPv6 server without identifying and processing the DHCPv6 Decline message.

[0242] In the embodiments of the present application, as Figure 7 shown, there is also provided a method for detecting address prefix conflict, which is applied to a first device and may include the following steps:

[0243] Step S701: Receive a second NS message, where the second NS message includes a third address prefix;

[0244] In the embodiments of the present application, the second NS message is any NS message used to detect address prefix conflict. The third address prefix is any address prefix to be detected. The second device may include one or more address prefixes to be detected.

[0245] While the first device detects whether its address prefix conflicts with the address prefix of the second device, the second device also detects whether its address prefix conflicts with the address prefix of the first device. When detecting the conflicting address prefix, the second device obtains the third address prefix to be detected, fills the third address prefix in the NS message to obtain the second NS message; and then multicasts the second NS message. The message format of the second NS message can refer to the message format of the first NS message above, which will not be elaborated here.

[0246] After the second device sends the second NS message, it waits to receive the response of the second NS message. The waiting response duration can refer to the preset waiting response duration above.

[0247] Step S702, if the third address prefix conflicts with the fourth address prefix held by the first device, send the second NA message, and the second NA message includes the fourth address prefix.

[0248] After receiving the second NS message, the first device extracts the third address prefix from the second NS message and detects whether the third address prefix conflicts with the address prefix held by the first device. If one address prefix (such as the fourth address prefix) held by the first device conflicts with the third address prefix, the first device sends the response of the second NS message, that is, the second NA message, and the second NA message carries the fourth address prefix. If all the address prefixes held by the first device do not conflict with the third address prefix, the first device does not respond to the second NS message, that is, does not reply to the response of the second NS message.

[0249] The specific operation of the second device waiting to receive the response of the second NS message can refer to the operation of the first device waiting to receive the response of the first NS message above, which will not be elaborated here.

[0250] In some embodiments, if the third address prefix conflicts with the fifth address prefix in the first device, the fifth address prefix is marked as an unavailable state. The fifth address prefix is the address prefix in the third NS message sent by the first device, and the first device has not received the NA message corresponding to the third NS message. Here, the first device does not need to reply to the NA message.

[0251] In the embodiments of the present application, the fifth address prefix can be understood as an address prefix in a suspended state, that is, an address prefix being detected for conflict. When the first device determines that the third address prefix conflicts with the fifth address prefix being detected for conflict in the first device, it directly marks the fifth address prefix as an unavailable state to further solve the problem that different terminals generate the same IPv6 address according to conflicting address prefixes from different devices, resulting in address conflicts, and improve the stability of network connection.

[0252] In some embodiments, the second neighbor request message includes a first option field; the second neighbor advertisement message includes a second option field;

[0253] The first option field is used to carry a third address and a third prefix length, and the third address prefix is determined in the third address by the third prefix length;

[0254] The second option field is used to carry a fourth address and a fourth prefix length, and the fourth address prefix is determined in the fourth address by the fourth prefix length.

[0255] In some embodiments, the second neighbor advertisement message further includes a fifth option field; the fifth option field is used to carry a third address and a third prefix length.

[0256] In some embodiments, the second neighbor request message includes a first destination address field and a third option field; the second neighbor advertisement message includes a second destination address field and a fourth option field;

[0257] The first destination address field is used to carry a third address;

[0258] The third option field is used to carry a third prefix length, and the third address prefix is determined in the third address by the third prefix length;

[0259] The second destination address field is used to carry a third address;

[0260] The fourth option field is used to carry a fourth address and a fourth prefix length, and the fourth address prefix is determined in the fourth address by the fourth prefix length.

[0261] In some embodiments, if the third address prefix conflicts with the fourth address prefix held by the first device, sending the second neighbor advertisement message may include:

[0262] If the third prefix length is greater than the fourth prefix length, and the third detected prefix is the same as the fourth address prefix, send the second neighbor advertisement message, where the third detected prefix is determined in the third address by the fourth prefix length; or,

[0263] If the third prefix length is less than the fourth prefix length, and the third address prefix is the same as the fourth detected prefix, send the second neighbor advertisement message, where the fourth detected prefix is determined in the fourth address by the third prefix length; or,

[0264] If the third prefix length is equal to the fourth prefix length, and the third address prefix is the same as the fourth address prefix, send the second neighbor advertisement message.

[0265] In the embodiments of the present application, the first device realizes address prefix conflict detection by responding to NS messages for detecting address prefix conflicts, avoids advertising conflicting address prefixes, or producing IPv6 addresses with conflicting address prefixes, reduces conflicting addresses in the network, and improves the stability of network connections.

[0266] The following combines Figures 8 - 9 The signaling diagram of address prefix conflict detection shown below to illustrate the address prefix conflict detection method provided by the embodiments of the present application. Among them, the preset waiting response duration is 1 s.

[0267] Figure 8 It is the signaling diagram for the router to perform address prefix conflict detection. Among them, the IP address of router A is 1:1:1::1 / 48, and the IP address of router B is 2:2:2::2 / 64. Router A needs to detect that the conflicting address prefix 1 is 1:2:: / 32, and the length of prefix 1 is 32. The address prefix 2 held by router B is 1:2:3:: / 48, and the length of prefix 2 is 48.

[0268] Step S801, router A marks prefix 1 as the paused state.

[0269] Step S802, router A constructs NS message 1 and sends NS message 1. Among them, the message format of NS message 1 is as shown in Table 7 below.

[0270] Table 7

[0271] Message field S message 1 Source address 1:1:1::1 / 48 Destination address FF02::1 Target address :: Option 251 field 1:2::,32

[0272] After sending the NS1 message, router A waits for other devices to respond to the NS1 message, and the waiting duration is 1 s (i.e., the preset waiting response duration).

[0273] Step S803, after receiving NS message 1, router B extracts {1:2::, 32} from the option 251 field of NS message 1 to obtain prefix 1, that is, 1:2:: / 32.

[0274] Step S804, router B detects whether prefix 1 conflicts with the prefix held by router B; if there is no conflict, it does not reply to router A; if there is a conflict, such as prefix 1 conflicts with prefix 2 held by router B, then execute step S805.

[0275] Step S805, router B constructs NA message 1 and sends NA message 1. Among them, the message format of NA message 1 is as shown in Table 8 below.

[0276] Table 8

[0277]

[0278]

[0279] Among them, the NA message 1 is the response to the NS message 1.

[0280] In the embodiment of the present application, the router B can also detect whether the prefix 1 conflicts with the prefix that the router B is currently performing conflict detection on; if there is a conflict, for example, if the prefix 1 conflicts with the prefix 3 that the router B is currently performing conflict detection on, the router B can mark the prefix 3 as an unavailable state and does not need to reply to the router A with a NA message.

[0281] Step S806, the router A receives a NA message before the waiting duration times out, and extracts the prefix from the option 252 field of the NA message.

[0282] Step S807, the router A detects whether the prefix 1 conflicts with the extracted prefix; if there is no conflict, it continues to execute step S806 before the waiting duration times out, and executes step S809 after the waiting duration times out; if there is a conflict, for example, if the received NA message is the NA message 1 and the extracted prefix is the prefix 2, that is, 1:2:3:: / 48, then step S808 is executed.

[0283] Step S808, the router A marks the prefix 1 as an unavailable state.

[0284] The router A can record that the prefix 1 and the prefix 2 conflict, which is convenient for subsequent analysis and troubleshooting of the conflict cause and the conflicting device.

[0285] Step S809, if the router A still has not received the NA message 1 after the waiting duration times out, it marks the prefix 1 as an available state. Then step S810 is executed.

[0286] Step S810, the router A sends a RA message 1, and the RA message 1 includes the prefix 1.

[0287] Figure 9 It is a signaling diagram for the DHCPv6 client to perform address prefix conflict detection. The DHCPv6 client A is communicatively connected to the DHCPv6 server through the DHCPv6 relay. The IP address of the DHCPv6 client B is 1:2:3::2 / 48, its address prefix 2 is 1:2:3:: / 48, and the length of the prefix 2 is 48.

[0288] Step S901, the DHCPv6 client A obtains the prefix 1. Among them, the prefix 1 is the address prefix for which conflict needs to be detected, the prefix 1 is 1:2:: / 32, and the length of the prefix 1 is 32.

[0289] The DHCPv6 client A can obtain the prefix 1, that is, the IAPD, by using the Reply message in the DHCPv6 four-step interaction allocation process or the Reply message in the DHCPv6 two-step interaction allocation process.

[0290] Step S902, the DHCPv6 client A marks prefix 1 as the paused state.

[0291] Step S903, the DHCPv6 client A constructs NS message 2 and sends NS message 2. Among them, the message format of NS message 2 is as shown in Table 9 below.

[0292] Table 9

[0293] Message field NS message 2 Source address :: Destination address FF02::1 Target address :: Option 251 field 1:2::,32

[0294] After sending the NS2 message, the DHCPv6 client A waits for other devices to respond to the NS2 message, and the waiting duration is 1 s (i.e., the preset waiting response duration).

[0295] Step S904, after receiving NS message 2, the DHCPv6 client B extracts {1:2::, 32} from the option 251 field of NS message 2 to obtain prefix 1, that is, 1:2:: / 32.

[0296] Step S905, the DHCPv6 client B detects whether prefix 1 conflicts with the prefix held by the DHCPv6 client B; if there is no conflict, it does not reply to the DHCPv6 client A; if there is a conflict, such as prefix 1 conflicts with prefix 2 held by the DHCPv6 client B, then step S906 is executed.

[0297] Here, the prefix held by the DHCPv6 client B can be understood as the prefix of the IPv6 address of the DHCPv6 client B.

[0298] Step S906, the DHCPv6 client B constructs NA message 2 and sends NA message 2. Among them, the message format of NA message 2 is as shown in Table 10 below.

[0299] Table 10

[0300] Message field NA message 2 Source address 1:2:3::2 / 48 Destination address :: Target address :: Option 252 field 1:2:3::,48

[0301] Among them, NA message 2 is the response to NS message 2.

[0302] In the embodiment of the present application, the DHCPv6 client B can also detect whether prefix 1 conflicts with the prefix that the DHCPv6 client B is detecting for conflicts; if there is a conflict, such as prefix 1 conflicts with prefix 3 that the DHCPv6 client B is detecting for conflicts, then the DHCPv6 client B can mark prefix 3 as the unavailable state and does not need to reply to the DHCPv6 client A with an NA message.

[0303] Step S907, the DHCPv6 client A receives the NA message before the waiting duration times out and extracts the prefix from the option 252 field of the NA message.

[0304] Step S908, the DHCPv6 client A detects whether the prefix 1 conflicts with the extracted prefix; if there is no conflict, it continues to execute Step S907 before the waiting duration times out and executes Step S913 after the waiting duration times out; if there is a conflict, such as the received NA message is NA message 2 and the extracted prefix is prefix 2, that is, 1:2:3:: / 48, then execute Step S909.

[0305] Step S909, the DHCPv6 client A marks prefix 1 as an unavailable state.

[0306] The DHCPv6 client A can record the conflict between prefix 1 and prefix 2, which is convenient for subsequent analysis and troubleshooting of the conflict cause and the conflicting device.

[0307] Step S910, the DHCPv6 client A constructs a DHCPv6 Decline message 1 and sends the DHCPv6 Decline message 1 to the DHCPv6 server. The IAPD option field in the DHCPv6 Decline message 1 is filled with prefix 1.

[0308] Step S911, the DHCPv6 relay forwards the DHCPv6 Decline message 1 to the DHCPv6 server.

[0309] Step S912, the DHCPv6 server marks prefix 1 as an unavailable state.

[0310] The DHCPv6 server can record the conflict between prefix 1 and other prefixes, which is convenient for subsequent analysis and troubleshooting of the conflict cause and the conflicting device.

[0311] Step S913, if the DHCPv6 client A still has not received the NA message 2 after the waiting duration times out, it marks prefix 1 as an available state. Then execute Step S914.

[0312] Step S914, the DHCPv6 client A uses prefix 1.

[0313] In the technical solution provided by the embodiment of the present application, the first device uses the address prefixes carried in the NS message and the NA message to implement the conflict detection of the address prefixes, reduce the duplicate prefixes in the network, solve the problem that different terminals generate the same IPv6 address according to the conflicting address prefixes from different first devices, resulting in address conflicts, and can implement that there is only one default gateway address corresponding to one address prefix, improving the stability of the network connection.

[0314] Corresponding to the above address prefix conflict detection method, the embodiment of the present application also provides an address prefix conflict detection device, which is applied to the first device, such as Figure 10As shown, the device includes:

[0315] A first sending module 1001, configured to multicast a first neighbor solicitation message, where the first neighbor solicitation message includes a first address prefix, so that a second device holding an address prefix conflicting with the first address prefix sends a neighbor advertisement message;

[0316] A first receiving module 1002, configured to receive a first neighbor advertisement message within a preset waiting response duration, where the first neighbor advertisement message includes a second address prefix;

[0317] A marking module 1003, configured to mark the first address prefix as an unavailable state if the first address prefix conflicts with the second address prefix.

[0318] In some embodiments, the first neighbor solicitation message includes a first option field; the first neighbor advertisement message includes a second option field;

[0319] The first option field is used to carry a first address and a first prefix length, and the first address prefix is determined in the first address through the first prefix length;

[0320] The second option field is used to carry a second address and a second prefix length, and the second address prefix is determined in the second address through the second prefix length.

[0321] In some embodiments, the first neighbor solicitation message includes a first destination address field and a third option field; the first neighbor advertisement message includes a second destination address field and a fourth option field;

[0322] The first destination address field is used to carry a first address;

[0323] The third option field is used to carry a first prefix length, and the first address prefix is determined in the first address through the first prefix length;

[0324] The second destination address field is used to carry a third address, where the third address is the destination address carried in the neighbor solicitation message received by the second device;

[0325] The fourth option field is used to carry a second address and a second prefix length, and the second address prefix is determined in the second address through the second prefix length.

[0326] In some embodiments, the marking module 1003 may specifically be configured to:

[0327] If the first prefix length is greater than the second prefix length, and the first detected prefix is the same as the second address prefix, mark the first address prefix as an unavailable state, where the first detected prefix is determined in the first address through the second prefix length; or,

[0328] If the length of the first prefix is less than the length of the second prefix, and the first address prefix is the same as the second detection prefix, then mark the first address prefix as unavailable, and determine the second detection prefix in the second address through the length of the first prefix; or,

[0329] If the length of the first prefix is equal to the length of the second prefix, and the first address prefix is the same as the second address prefix, then mark the first address prefix as unavailable.

[0330] In some embodiments, the marking module 1003 can be specifically used to mark the first address prefix as unavailable if the value of the first target address field is the same as the value of the second target address field.

[0331] In some embodiments, the first neighbor advertisement message further includes a fifth option field; the fifth option field is used to carry the first address and the length of the first prefix;

[0332] The marking module 1003 can be specifically used to mark the first address prefix as unavailable if the value of the first option field is the same as the value of the fifth option field.

[0333] In some embodiments, the marking module 1003 can also be used for:

[0334] Before multicasting the first neighbor solicitation message, mark the first address prefix as suspended;

[0335] After a preset waiting response duration, if a neighbor advertisement message carrying an address prefix conflicting with the first address prefix is not received, mark the first address prefix as available.

[0336] In some embodiments, the first device is a router; the above address prefix conflict detection device may further include:

[0337] A second sending module, configured to send a first routing advertisement message, and the first routing advertisement message includes the first address prefix.

[0338] In some embodiments, the first device is a DHCPv6 client; the above address prefix conflict detection device may further include:

[0339] A third sending module, configured to send a DHCPv6 reject message to the DHCPv6 server when the first address prefix is marked as unavailable, where the DHCPv6 reject message includes an IAPD option, and the IAPD option is used to carry the first address prefix, so that the DHCPv6 server marks the first address prefix as unavailable according to the DHCPv6 reject message.

[0340] In some embodiments, the first device is a DHCPv6 client; the above address prefix conflict detection device may further include:

[0341] A generation module, configured to, when marking a first address prefix as unavailable, divide the first address prefix into multiple sub-address prefixes, and send multiple second router advertisement messages, each second router advertisement message including a sub-address prefix; or, allocate an IANA address for an accessed third device according to the first address prefix; or, generate an IPv6 address of a DHCPv6 client according to the first address prefix.

[0342] In the technical solution provided by the embodiment of the present application, the first device uses the address prefix carried in the NS message and the NA message to detect the address prefix (such as the first address prefix) conflicting with the address prefix held by the second device in the first device, and marks the conflicting address prefix as unavailable. In this way, the first device will not use the conflicting address prefix, such as not advertising the conflicting address prefix, and thus different terminals will not receive the conflicting address prefixes advertised by different devices, and different terminals will not generate the same IPv6 address according to the conflicting address prefixes from different devices, solving the problem of address conflict caused by different terminals generating the same IPv6 address according to the conflicting address prefixes from different devices.

[0343] In addition, the address prefixes advertised by different devices are different. A terminal will not receive conflicting address prefixes from different devices, and there is only one default gateway address corresponding to one address prefix. In the absence of multiple default gateway addresses, the terminal will not frequently switch the default gateway, improving the stability of the network connection and the user's Internet experience.

[0344] Corresponding to the above address prefix conflict detection method, the embodiment of the present application further provides an address prefix conflict detection device, which is applied to the first device, such as Figure 11 shown, the device includes:

[0345] A second receiving module 1101, configured to receive a second neighbor solicitation message, the second neighbor solicitation message including a third address prefix;

[0346] A fourth sending module 1102, configured to send a second neighbor advertisement message if the third address prefix conflicts with a fourth address prefix held by the first device, the second neighbor advertisement message including the fourth address prefix.

[0347] In some embodiments, the second neighbor solicitation message includes a first option field; the second neighbor advertisement message includes a second option field;

[0348] The first option field is used to carry a third address and a third prefix length, and the third address prefix is determined in the third address through the third prefix length;

[0349] The second option field is used to carry the fourth address and the fourth prefix length, and the fourth address prefix is determined in the fourth address by the fourth prefix length.

[0350] In some embodiments, the second neighbor advertisement message further includes a fifth option field; the fifth option field is used to carry the third address and the third prefix length.

[0351] In some embodiments, the second neighbor solicitation message includes a first destination address field and a third option field; the second neighbor advertisement message includes a second destination address field and a fourth option field;

[0352] The first destination address field is used to carry the third address;

[0353] The third option field is used to carry the third prefix length, and the third address prefix is determined in the third address by the third prefix length;

[0354] The second destination address field is used to carry the third address;

[0355] The fourth option field is used to carry the fourth address and the fourth prefix length, and the fourth address prefix is determined in the fourth address by the fourth prefix length.

[0356] In some embodiments, the fourth sending module 1102 may specifically be used for:

[0357] If the third prefix length is greater than the fourth prefix length, and the third detected prefix is the same as the fourth address prefix, then send the second neighbor advertisement message, where the third detected prefix is determined in the third address by the fourth prefix length; or,

[0358] If the third prefix length is less than the fourth prefix length, and the third address prefix is the same as the fourth detected prefix, then send the second neighbor advertisement message, where the fourth detected prefix is determined in the fourth address by the third prefix length; or,

[0359] If the third prefix length is equal to the fourth prefix length, and the third address prefix is the same as the fourth address prefix, then send the second neighbor advertisement message.

[0360] In the technical solution provided by the embodiments of the present application, the first device uses the address prefixes carried in the NS message and the NA message to detect the address prefix (such as the first address prefix) that conflicts with the address prefix held by the second device in the first device, and marks the conflicting address prefix as an unavailable state. In this way, the first device will not use the conflicting address prefix, such as not advertising the conflicting address prefix, and thus different terminals will not receive conflicting address prefixes advertised by different devices, and different terminals will not generate the same IPv6 address based on the conflicting address prefixes from different devices, solving the problem of address conflicts caused by different terminals generating the same IPv6 address based on the conflicting address prefixes from different devices.

[0361] In addition, the address prefixes announced by different devices are different. A terminal will not receive conflicting address prefixes from different devices, and there is only one default gateway address corresponding to an address prefix. In the absence of multiple default gateway addresses, the terminal will not frequently switch the default gateway, improving the stability of the network connection and the user's Internet experience.

[0362] Corresponding to the above address prefix conflict detection method, an embodiment of the present application further provides a first device, such as Figure 12 shown, including a processor 1201, a communication interface 1202, a memory 1203, and a communication bus 1204. Among them, the processor 1201, the communication interface 1202, and the memory 1203 complete mutual communication through the communication bus 1204.

[0363] The memory 1203 is used to store computer programs;

[0364] The processor 1201, when executing the programs stored on the memory 1203, implements any of the above address prefix conflict detection methods.

[0365] The communication bus can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity, only a thick line is shown in the figure, but it does not mean that there is only one bus or one type of bus.

[0366] The communication interface is used for communication between the first device and other devices.

[0367] The memory may include a Random Access Memory (RAM), or may also include a Non-Volatile Memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.

[0368] The processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0369] In another embodiment provided by the present application, a computer-readable storage medium is further provided. A computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, the above-mentioned any address prefix conflict detection method is implemented.

[0370] In another embodiment provided by the present application, a computer program product including instructions is further provided. When it runs on a computer, the computer is caused to execute the above-mentioned any address prefix conflict detection method.

[0371] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, a computer, a server, or a data center to another website, a computer, a server, or a data center in a wired manner (such as coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or a wireless manner (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer, or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium (for example, a Solid State Disk (SSD)).

[0372] It should be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprising", "including" or any other variant thereof are intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising the said element.

[0373] Each embodiment in this specification is described in a related manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the apparatus, the first device, the storage medium, and the computer program product, since they are basically similar to the method embodiments, the description is relatively simple, and reference can be made to the relevant parts of the method embodiments for the relevant content.

[0374] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A method for detecting an address prefix conflict, characterized in that: Applied to a first device, the method includes: Multicast sending a first neighbor solicitation message, wherein the first neighbor solicitation message includes a first address prefix, so that a second device holding an address prefix that conflicts with the first address prefix sends a neighbor advertisement message; Within a preset waiting response time, receiving a first neighbor advertisement message, wherein the first neighbor advertisement message includes a second address prefix; If the first address prefix conflicts with the second address prefix, the first address prefix is ​​marked as unavailable.

2. The method according to claim 1, characterized in that The first neighbor solicitation message includes a first option field; the first neighbor advertisement message includes a second option field; The first option field is used to carry a first address and a first prefix length, and the first address prefix is ​​determined in the first address by the first prefix length; The second option field is used to carry a second address and a second prefix length, and the second address prefix is ​​determined in the second address by the second prefix length.

3. The method according to claim 1, characterized in that The first neighbor solicitation message includes a first target address field and a third option field; the first neighbor advertisement message includes a second target address field and a fourth option field; The first target address field is used to carry the first address; The third option field is used to carry a first prefix length, and the first address prefix is ​​determined in the first address by the first prefix length; The second target address field is used to carry a third address, where the third address is a target address carried in the neighbor request message received by the second device; The fourth option field is used to carry a second address and a second prefix length, and the second address prefix is ​​determined in the second address by the second prefix length.

4. The method according to claim 2 or 3, characterized in that: If the first address prefix conflicts with the second address prefix, marking the first address prefix as unavailable includes: If the first prefix length is greater than the second prefix length, and the first detection prefix is ​​the same as the second address prefix, marking the first address prefix as unavailable, and the first detection prefix is ​​determined in the first address by the second prefix length; or, If the first prefix length is less than the second prefix length, and the first address prefix is ​​the same as the second detection prefix, the first address prefix is ​​marked as unavailable, and the second detection prefix is ​​determined in the second address by the first prefix length; or, If the first prefix length is equal to the second prefix length, and the first address prefix is ​​the same as the second address prefix, the first address prefix is ​​marked as unavailable.

5. The method according to claim 3, characterized in that: If the first address prefix conflicts with the second address prefix, marking the first address prefix as unavailable includes: If the value of the first target address field is the same as the value of the second target address field, the first address prefix is ​​marked as unavailable.

6. The method according to claim 2, characterized in that The first neighbor advertisement message also includes a fifth option field; The fifth option field is used to carry the first address and the first prefix length; If the first address prefix conflicts with the second address prefix, marking the first address prefix as unavailable includes: If the value of the first option field is the same as the value of the fifth option field, the first address prefix is ​​marked as unavailable.

7. The method according to claim 1, characterized in that The method further comprises: Before sending the first neighbor solicitation message by multicast, marking the first address prefix as a paused state; After the preset waiting response time, if no neighbor passing message carrying an address prefix that conflicts with the first address prefix is ​​received, the first address prefix is ​​marked as available.

8. The method according to claim 7, characterized in that The first device is a router; the method further includes: A first routing advertisement message is sent, where the first routing advertisement message includes the first address prefix.

9. The method according to claim 7, characterized in that: The first device is a DHCPv6 client; when the first address prefix is ​​marked as unavailable, the method further includes: A DHCPv6 reject message is sent to the DHCPv6 server, where the DHCPv6 reject message includes an IAPD option, where the IAPD option is used to carry the first address prefix, so that the DHCPv6 server marks the first address prefix as unavailable according to the DHCPv6 reject message.

10. The method according to claim 7, characterized in that The first device is a DHCPv6 client; when the first address prefix is ​​marked as an available state, the method further includes: Divide the first address prefix into multiple sub-address prefixes, and send multiple second route advertisement messages, each of which includes one sub-address prefix; or, allocating an IANA address to a third device connected thereto according to the first address prefix; or, Generate an IPv6 address of the DHCPv6 client according to the first address prefix.

11. A method for detecting an address prefix conflict, characterized in that: Applied to a first device, the method includes: receiving a second neighbor solicitation message, wherein the second neighbor solicitation message includes a third address prefix; If the third address prefix conflicts with the fourth address prefix held by the first device, a second neighbor advertisement message is sent, where the second neighbor advertisement message includes the fourth address prefix.

12. The method according to claim 11, characterized in that The second neighbor solicitation message includes a first option field; the second neighbor advertisement message includes a second option field; The first option field is used to carry a third address and a third prefix length, and the third address prefix is ​​determined in the third address by the third prefix length; The second option field is used to carry a fourth address and a fourth prefix length, and the fourth address prefix is ​​determined in the fourth address by the fourth prefix length.

13. The method according to claim 12, characterized in that The second neighbor advertisement message also includes a fifth option field; the fifth option field is used to carry the third address and the third prefix length.

14. The method according to claim 11, characterized in that The second neighbor solicitation message includes a first target address field and a third option field; the second neighbor advertisement message includes a second target address field and a fourth option field; The first target address field is used to carry a third address; The third option field is used to carry a third prefix length, and the third address prefix is ​​determined in the third address by the third prefix length; The second target address field is used to carry a third address; The fourth option field is used to carry the fourth address and a fourth prefix length, and the fourth address prefix is ​​determined in the fourth address by the fourth prefix length.

15. The method according to any one of claims 11 to 14, characterized in that: If the third address prefix conflicts with the fourth address prefix held by the first device, sending a second neighbor advertisement message includes: If the third prefix length is greater than the fourth prefix length, and the third detection prefix is ​​the same as the fourth address prefix, sending a second neighbor advertisement message, the third detection prefix being determined in the third address by the fourth prefix length; or, If the third prefix length is less than the fourth prefix length, and the third address prefix is ​​the same as the fourth detection prefix, sending a second neighbor advertisement message, the fourth detection prefix being determined in the fourth address by the third prefix length; or, If the third prefix length is equal to the fourth prefix length, and the third address prefix is ​​the same as the fourth address prefix, a second neighbor advertisement message is sent.

16. An address prefix conflict detection device, characterized in that: Applied to a first device, the apparatus comprises: A first sending module, configured to multicast and send a first neighbor request message, wherein the first neighbor request message includes a first address prefix, so that a second device holding an address prefix that conflicts with the first address prefix sends a neighbor advertisement message; A first receiving module, configured to receive a first neighbor advertisement message within a preset waiting response time, wherein the first neighbor advertisement message includes a second address prefix; A marking module is used to mark the first address prefix as unavailable if the first address prefix conflicts with the second address prefix.

17. An address prefix conflict detection device, characterized in that: Applied to a first device, the apparatus comprises: A second receiving module, configured to receive a second neighbor request message, wherein the second neighbor request message includes a third address prefix; The fourth sending module is used to send a second neighbor advertisement message if the third address prefix conflicts with a fourth address prefix held by the first device, wherein the second neighbor advertisement message includes the fourth address prefix.

Citation Information

Patent Citations

  • Address violation detection method, customer premises equipment and host

    CN101909091A

  • Address prefix processing method, device, system and network equipment

    CN102025797A

  • Method, device and system for detecting medium access control (MAC) address conflicts

    CN102333013A

  • Method and system for managing internet protocol version 6 (IPV6) address conflicts automatically

    CN102984288A

  • Address prefix acquisition method and device

    CN114765601A

Cited By

  • IPv6 stateless address dynamic planning method and system based on elastic prefix

    CN120729837A