A method and apparatus for address prefix conflict detection

By detecting and marking address prefix conflicts, the problem of terminals generating the same IPv6 address during IPv6 addressing is resolved, improving network connection stability and user experience.

CN120223676BActive Publication Date: 2026-07-21NEW H3C TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
NEW H3C TECH CO LTD
Filing Date
2025-03-24
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

During the IPv6 addressing process, address prefix conflicts can occur due to multiple routers or DHCPv6 servers sending conflicting address prefixes, causing different terminals to generate the same IPv6 address, resulting in address conflicts and affecting network connection stability.

Method used

The system sends neighbor request messages via multicast, receives neighbor advertisement messages, detects address prefix conflicts, and marks conflicting address prefixes as unavailable to avoid using conflicting address prefixes and prevent different terminals from generating the same IPv6 address.

Benefits of technology

It improves network connection stability, reduces the frequency of terminal switching between multiple default gateways, and enhances the user's internet browsing experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120223676B_ABST
    Figure CN120223676B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a method and device for address prefix conflict detection, and relate to the field of communication technology. The method is applied to a first device and includes: multicasting a first neighbor request message, the first neighbor request message including a first address prefix, so that a second device holding an address prefix conflicting with the first address prefix sends a neighbor advertisement message; receiving a first neighbor advertisement message within a preset waiting response duration, the first neighbor advertisement message including a second address prefix; and marking the first address prefix as unavailable if the first address prefix conflicts with the second address prefix. The scheme can solve the problem of address conflict caused by different terminals generating the same IPv6 address according to conflicting address prefixes from different first devices, and improve the stability of network connection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a method and apparatus for detecting address prefix conflicts. Background Technology

[0002] The addressing schemes of Internet Protocol version 6 (IPv6) include stateful dynamic address configuration and stateless address autoconfiguration (SLAAC).

[0003] When using the SLAAC scheme for IPv6 addressing, multiple routers in the network may send Router Advertisement (RA) messages carrying conflicting address prefixes. Similarly, when using the Dynamic Host Configuration Protocol for IPv6 (DHCPv6) scheme for IPv6 addressing, multiple DHCPv6 servers may assign conflicting address prefixes to DHCPv6 clients. In this situation, different terminals are likely to generate the same IPv6 address based on conflicting address prefixes from different routers or DHCPv6 servers, resulting in address conflicts.

[0004] Furthermore, when routers advertise address prefixes to terminals, they also send default gateway addresses. If a terminal receives conflicting address prefixes from different devices, it will obtain multiple different default gateway addresses corresponding to those conflicting prefixes. When the terminal generates an IPv6 address based on this conflicting address prefix and accesses the network using that IPv6 address, it will frequently switch default gateways within the range of these default gateway addresses, leading to unstable network connections and impacting the user's internet experience. Summary of the Invention

[0005] The purpose of this application is to provide an address prefix conflict detection method and apparatus to solve the problem of address conflicts caused by different terminals generating the same IPv6 address based on conflicting address prefixes from different devices, and to improve network connection stability. The specific technical solution is as follows:

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

[0007] Multicast sends a first neighbor request message, which 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;

[0008] Within a preset response waiting time, a first neighbor advertisement message is received, the first neighbor advertisement message including a second address prefix;

[0009] If the first address prefix conflicts with the second address prefix, the first address prefix is ​​marked as unavailable.

[0010] In some embodiments, the first neighbor request 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 the first address and the first prefix length, and the first address prefix is ​​determined in the first address by the first prefix length;

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

[0013] In some embodiments, the first neighbor request 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 target address field is used to carry the first address;

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

[0016] The second target address field is used to carry a third address, which is the target address carried in the neighbor request message received by the second device;

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

[0018] In some embodiments, marking the first address prefix as unavailable if it conflicts with the second address prefix includes:

[0019] If the length of the first prefix is ​​greater than the length of the second prefix, and the first detection prefix is ​​the same as the second address prefix, then the first address prefix is ​​marked as unavailable. The first detection prefix is ​​determined in the first address by the length of the second prefix; 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, then the first address prefix is ​​marked as unavailable, and the second detection prefix is ​​determined in the second address by 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, then the first address prefix is ​​marked as unavailable.

[0022] In some embodiments, marking the first address prefix as unavailable if it 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, then the first address prefix is ​​marked as unavailable.

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

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

[0026] The step of marking the first address prefix as unavailable if it 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, then the first address prefix is ​​marked as unavailable.

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

[0029] Before multicasting the first neighbor request message, the first address prefix is ​​marked as paused;

[0030] If no neighbor message carrying an address prefix that conflicts with the first address prefix is ​​received after the preset waiting response time, the first address prefix is ​​marked as available.

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

[0032] Send a first route advertisement message, which includes the first address prefix.

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

[0034] A DHCPv6 rejection message is sent to the DHCPv6 server. The DHCPv6 rejection message includes an Identity Association for Prefix Delegation (IAPD) option. The IAPD option is used to carry the first address prefix so that the DHCPv6 server marks the first address prefix as unavailable based on the DHCPv6 rejection message.

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

[0036] Divide the first address prefix into multiple sub-address prefixes and send multiple second route advertisement messages, each second route advertisement message including one sub-address prefix; or,

[0037] The third access device is assigned a non-temporary Identity Association for Non-temporary Addresses (IANA) address based on the first address prefix; or,

[0038] The IPv6 address of the DHCPv6 client is generated based on the first address prefix.

[0039] Secondly, embodiments of this application provide an address prefix conflict detection method, applied to a first device, the method comprising:

[0040] Receive a second neighbor request message, which includes a third address prefix;

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

[0042] In some embodiments, the second neighbor request message includes a first option field; the second neighbor announcement message includes a second option field.

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

[0044] The second option field is used to carry the fourth address and the fourth prefix length, wherein the bits preceding the fourth prefix length 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 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.

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

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

[0049] The second target 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 bits before the fourth prefix length of the fourth address are the fourth address prefix.

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

[0052] If the length of the third prefix is ​​greater than the length of the fourth prefix, and the third detection prefix is ​​the same as the fourth address prefix, then a second neighbor advertisement message is sent, wherein the third detection prefix is ​​determined in the third address by the length of the fourth prefix; or,

[0053] If the length of the third prefix is ​​less than the length of the fourth prefix, and the third address prefix is ​​the same as the fourth detection prefix, then a second neighbor advertisement message is sent, wherein the fourth detection prefix is ​​determined in the fourth address based on the length of the third prefix; or,

[0054] If the length of the third prefix is ​​equal to the length of the fourth prefix, and the third address prefix is ​​the same as the fourth address prefix, then a second neighbor announcement message is sent.

[0055] Thirdly, embodiments of this application provide an address prefix conflict detection device, applied to a first device, the device comprising:

[0056] The first sending module is used to multicast a first neighbor request message, the first neighbor request message including a first address prefix, so that a second device holding an address prefix that conflicts with the first address prefix can send a neighbor advertisement message;

[0057] The first receiving module is configured to receive a first neighbor announcement message within a preset waiting response time, wherein the first neighbor announcement message includes a second address prefix;

[0058] The marking module is used to mark the first address prefix as unavailable if the first address prefix conflicts with the second address prefix.

[0059] Fourthly, embodiments of this application provide an address prefix conflict detection device, applied to a first device, the device comprising:

[0060] The second receiving module is used to receive a second neighbor request message, which includes a third address prefix.

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

[0062] Fifthly, embodiments of this application also provide a first device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other through the communication bus;

[0063] Memory, used to store computer programs;

[0064] The processor, when executing a program stored in memory, implements any of the above address prefix conflict detection methods.

[0065] Sixthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements any of the above-described address prefix conflict detection methods.

[0066] In a seventh aspect, embodiments of this application also provide a computer program product containing instructions that, when run on a computer, cause the computer to execute any of the above-described address prefix conflict detection methods.

[0067] Beneficial effects of the embodiments in this application:

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

[0069] Furthermore, different devices announce different address prefixes. A terminal will not receive conflicting address prefixes from different devices, and each address prefix corresponds to only one default gateway address. Without multiple default gateway addresses, the terminal will not frequently switch default gateways, improving network connection stability and enhancing the user's internet experience.

[0070] Of course, implementing any product or method of this application does not necessarily require achieving all of the advantages described above at the same time. Attached Figure Description

[0071] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other embodiments can be obtained based on these drawings.

[0072] Figure 1a A schematic diagram of the four-step interactive allocation process of DHCPv6;

[0073] Figure 1b A schematic diagram of the two-step interactive allocation process in DHCPv6;

[0074] Figure 2 A schematic diagram illustrating the working principle of a DAD;

[0075] Figure 3 This is a schematic diagram of the first flowchart of the address prefix conflict detection method provided in the embodiments of this application;

[0076] Figure 4a A first schematic diagram illustrating the format of the option 251 field provided in an embodiment of this application;

[0077] Figure 4b A first schematic diagram illustrating the format of the option 252 field provided in an embodiment of this application;

[0078] Figure 5a A second schematic diagram illustrating the format of the option 251 field provided in an embodiment of this application;

[0079] Figure 5b A second schematic diagram illustrating the format of the option 252 field provided in an embodiment of this application;

[0080] Figure 6 This is a second flowchart illustrating the address prefix conflict detection method provided in the embodiments of this application;

[0081] Figure 7 This is a schematic diagram of the third type of address prefix conflict detection method provided in the embodiments of this application;

[0082] Figure 8 A signaling diagram for routers performing address prefix conflict detection provided in this application embodiment;

[0083] Figure 9 A signaling diagram for DHCPv6 client performing address prefix conflict detection provided in this application embodiment;

[0084] Figure 10 A schematic diagram of a first structure of the address prefix conflict detection device provided in an embodiment of this application;

[0085] Figure 11 This is a schematic diagram of a second structure of the address prefix conflict detection device provided in the embodiments of this application;

[0086] Figure 12 This is a schematic diagram of the structure of a first device provided in an embodiment of this application. Detailed Implementation

[0087] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.

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

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

[0090] The process of a DHCPv6 server assigning an address / prefix to a DHCPv6 client can be divided into two categories: (1) the four-step interactive allocation process of DHCPv6, such as... Figure 1a As shown; (2) The two-step interactive allocation process of DHCPv6, as follows: Figure 1b As shown;

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

[0092] 1) The DHCPv6 client multicasts a Solicit message, which 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] A typical network configuration includes multiple DHCPv6 servers. Each DHCPv6 server returns an Advertise message to the DHCPv6 client. In other words, the DHCPv6 client can receive multiple Advertise messages and obtain the IPv6 address prefix, IPv6 address, and other network configuration parameters assigned to it by multiple DHCPv6 servers.

[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 from the Request message.

[0097] After receiving the Reply message, the DHCPv6 client 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 to locate available DHCPv6 servers. The Solicit message includes a Rapid Commit option to indicate that the DHCPv6 client supports the Rapid Commit mechanism.

[0100] 2) After receiving the Solicit message, if the DHCPv6 server also supports the fast 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 assigned to the DHCPv6 client.

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

[0102] SLAAC is a mechanism for automatically configuring IPv6 addresses. SLAAC allows devices to automatically generate IPv6 addresses by receiving Router Advertisement (RA) messages from routers, even without a DHCPv6 server. The specific process is as follows:

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

[0104] 2) After receiving the RA message, the device generates an IPv6 address based on the address prefix in the RA message and its own interface identifier. The interface identifier can be the device's own MAC address or can be randomly generated by the device.

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

[0106] 1) Stateless, meaning it does not require a DHCPv6 server; devices can configure their addresses independently.

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

[0108] 3) Flexibility: The device can dynamically adjust the address configuration based on the information in the RA message.

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

[0110] 1) Terminal (e.g.) Figure 2 When host A obtains a new IPv6 address, it marks the IPv6 address as a tentative state.

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

[0112] 2) The terminal multicasts a Neighbor Solicitation (NS) message to inquire whether there are other terminals in the network (e.g., ...). Figure 2 Host B shown is using the new IPv6 address mentioned above.

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

[0114] When other terminals receive an 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 will send a Neighbor Advertisement (NA) message via multicast. 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 packet is the IPv6 address of the other terminal (i.e., the IPv6 address to be detected), the destination address (Dst) of the NA packet is the multicast address of all nodes on the link locality (i.e., FF02::1), and the destination address of the NA packet is the IPv6 address to be detected (i.e., 2000::1). This NA packet may not include the Source Link-Layer Address option field.

[0116] 3) If the terminal receives an NA packet with the target IPv6 address to be detected (e.g., 2000::1), it determines that the IPv6 address to be detected is already in use and abandons the use of the IPv6 address to be detected. Afterwards, the terminal can regenerate a new IPv6 address and re-execute the DAD process.

[0117] If the terminal does not receive an NA packet with the target IPv6 address (e.g., 2000::1) as the destination address, it determines that the IPv6 address to be detected is unique on the link and marks it as valid. The terminal can then use this IPv6 address for communication.

[0118] When using the SLAAC scheme for IPv6 addressing, multiple routers in the network may send RA messages carrying conflicting address prefixes. Similarly, when using the DHCPv6 dynamic address configuration scheme for IPv6 addressing, multiple DHCPv6 servers may assign conflicting address prefixes to DHCPv6 clients. In this situation, different terminals are likely to generate the same IPv6 address based on conflicting address prefixes from different primary devices, resulting in address conflicts.

[0119] Furthermore, when routers advertise address prefixes to terminals (including DHCPv6 clients), they also send default gateway addresses to those terminals. If a terminal receives conflicting address prefixes from different devices, it will obtain multiple different default gateway addresses corresponding to those conflicting prefixes. When the terminal generates an IPv6 address based on this conflicting address prefix and accesses the network using that IPv6 address, it will frequently switch default gateways within the range of these default gateway addresses, leading to network instability and impacting the user's internet experience.

[0120] To address the above problems, embodiments of this application provide an address prefix conflict detection method, such as... Figure 3 As shown. This address prefix conflict detection method is applied to a first device, which can be a router in the SLAAC scheme or a DHCPv6 client in the DHCPv6 dynamic address configuration scheme; there is no limitation on which.

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

[0122] Step S301: Multicast a first NS message, the first NS message including a first address prefix, so that a second device holding an address prefix that conflicts with the first address prefix can send an NA message;

[0123] Step S302: Within a preset waiting response time, receive a first NA message, wherein the first NA includes a second address prefix;

[0124] Step S303: If the first address prefix conflicts with the second address prefix, then the first address prefix is ​​marked as unavailable.

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

[0126] Furthermore, different devices announce different address prefixes. A terminal will not receive conflicting address prefixes from different devices, and each address prefix corresponds to only one default gateway address. Without multiple default gateway addresses, the terminal will not frequently switch default gateways, improving network connection stability and enhancing the user's internet experience.

[0127] In step S301 above, the first NS message is any NS message used to detect 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. The address prefix is ​​an IPv6 address prefix. The second device can be a router in the SLAAC scheme, or a DHCPv6 client in the DHCPv6 dynamic address configuration scheme; there is no limitation in this regard.

[0128] When detecting conflicting address prefixes, the first device obtains the first address prefix to be detected, fills the first address prefix into the NS message, and obtains the first NS message; then multicasts and sends the first NS message.

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

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

[0131] Case 1: The two addresses have the same prefix. For example, both addresses have the prefix 1001:: / 16.

[0132] Scenario 2: One address prefix belongs to another address prefix. For example, one address prefix 1 is 1001:: / 16, and another address prefix 2 is 1001:1001:: / 32. In this case, address prefix 2 belongs to address prefix 1.

[0133] In step S302 above, the preset waiting response duration is a pre-set duration for waiting for the second device to reply with the first NS message, and the start time 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 that the second device detects as conflicting. The preset waiting response duration can be set according to actual needs; for example, the preset waiting response duration can be 1s, 2s, or 3s, etc.

[0134] Within a preset response waiting time, 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 between the first address prefix being used for conflict detection and the second address prefix obtained in step S302. If a conflict is detected between the first address prefix and the second address prefix, the first device can determine that the first NA packet is the NA packet corresponding to the first NS packet, and that the first address prefix conflicts with the second address prefix held by the second device. Therefore, the first address prefix is ​​marked as unusable, such as in a duplicate state. Subsequently, the first device will no longer use the first address prefix.

[0136] If the first address prefix and the second address prefix are not detected to conflict, the first device will continue to receive NA messages sent by the second device within the preset waiting response time.

[0137] To facilitate determining whether the first NA message is the NA message corresponding to the first NS message and to accurately determine the conflicting address prefix, in this embodiment of the 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, the first address prefix being 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, the second address prefix being determined in the second address by the second prefix length.

[0139] In this embodiment of the application, the first option field and the second option field can be options not assigned 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 this embodiment, the source address of the first NS message may not be specified, such as (::). The source address of the first NS message may 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. In this case, the source address of the first NS message may be the router's IPv6 address, or it 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. The DHCPv6 client does not yet have an IPv6 address. In this case, the source address of the first NS message may not be specified.

[0141] The destination address of the first NS message can be the multicast address of all nodes on the link, such as FF02::1. The destination address of the first NS message can be left unspecified, such as (::). Furthermore, the first NS message can also include a first option field, such as option 251, which carries the first address and the first prefix length. Taking a first address prefix of 1001:: / 16 as an example, the first address can be 1001::, the first prefix length is 16, and {1001::, 16} is filled into the first option field. The message format of the first NS message in this case is shown in Table 1.

[0142] Table 1

[0143] Message Fields 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] The format of field 251 can be found in [reference needed]. Figure 4a As shown. Option 251 field includes a Type (T) subfield, a Length (L) subfield, and a Value (V) subfield.

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

[0146] The L subfield carries the length of the V subfield, such as Figure 4a The value 17 in the L subfield indicates that the length of the V subfield is 17 bytes and the length of the L subfield is 1 byte.

[0147] The V subfield carries the first address and the first prefix length. The V subfield is 17 bytes long, with the first 16 bytes carrying the first address and the last byte carrying the first prefix length.

[0148] In this embodiment, the source address of the first NA packet can be the IPv6 address of the second device that sent the first NA packet. The destination address of the first NA packet is determined based on the source address of the NS packet. For example, if the source address of the NS packet is the IPv6 address of the first device, then the destination address of the first NA packet can be the IPv6 address of the first device, or it can be a link-local multicast address, such as FF02::1; if the source address of the NS packet is not specified (e.g., ::), then the destination address of the first NA packet is a link-local multicast address, such as FF02::1.

[0149] The destination address of the first NA message is determined based on the destination address of the NS message. For example, if the destination address of the NS message is not specified (e.g., ::), then the destination address of the first NA message is not specified, such as (::).

[0150] In addition, the first NA message may also include a second option field, such as option 252. The second option field carries the second address and the second prefix length. For example, with the second address prefix being 1001:1001:: / 32, the second address can be 1001:1001::, the second prefix length is 32, and {1001:1001::, 32} is filled into the second option field. The message format of the first NA message in this case is shown in Table 2.

[0151] Table 2

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

[0153] The format of field 252 can be found in [reference needed]. Figure 4b As shown. Option 252 includes the T subfield, L subfield, and V subfield.

[0154] The T subfield carries 252, indicating that the current option field carries a conflicting address prefix. The T subfield is 1 byte long.

[0155] The L subfield carries the length of the V subfield, such as Figure 4b The value 17 in the L subfield indicates that the length of the V subfield is 17 bytes and the length of the L subfield is 1 byte.

[0156] The V subfield carries the second address and the second prefix length. The V subfield is 17 bytes long, with the first 16 bytes carrying the second address and the last byte carrying the second prefix length.

[0157] In this embodiment, 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 one of the following conditions 1 to 3 is met, the first device can determine 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 the first address prefix is ​​marked as unavailable.

[0158] Condition 1: The length of the first prefix is ​​greater than the length of the second prefix, and the first detection prefix is ​​the same as the second address prefix. The first detection prefix is ​​determined in the first address by the length of the second prefix. If condition 1 is satisfied, it means that the second address prefix belongs to the first address prefix.

[0159] Condition 2: 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. The second detection prefix is ​​determined in the second address by the length of the first prefix. If condition 2 is satisfied, it means that the first address prefix belongs to the second address prefix.

[0160] Condition 3: 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. Satisfying condition 3 means that the first address prefix and the second address prefix are the same.

[0161] In this embodiment, the first device can determine whether the first address suffix and the second address prefix conflict using the first option field and the second option field, reducing the complexity of address prefix conflict detection. Furthermore, the first device can obtain the conflicting first and second address prefixes, facilitating subsequent analysis and elimination of the cause of the conflict.

[0162] Method 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 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 by the first prefix length; the second destination address field is used to carry the third address, and the third address is the destination address carried in the neighbor request message received by the second device; the fourth option field is used to carry the second address and the second prefix length, and the second address prefix is ​​determined in the second address by the second prefix length.

[0163] In this embodiment, the third option field and the fourth option field can be options not assigned by the RFC standard, such as options 145 to 252. In one example, the third option field can be option 251 and the fourth option field can be option 252.

[0164] In this embodiment, the source address of the first NS message may not be specified, such as (::). 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 multicast address of all nodes on the link locality, 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 also include a third option field, such as option 251, which carries the length of the first prefix. Taking the first address prefix as 1001:: / 16 as an example, the first address can 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 point, the message format of the first NS message can be found in Table 3.

[0167] Table 3

[0168] Message Fields 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] The format of field 251 can be found in [reference needed]. Figure 5a As shown. Option 251 includes the T subfield, L subfield, and V subfield.

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

[0171] The L subfield carries the length of the V subfield, such as Figure 5a The value of 1 in the L subfield indicates that the length of the V subfield is 1 byte and the length of the L subfield is 1 byte.

[0172] The V subfield carries the length of the first prefix. The length of the V subfield is 1 byte.

[0173] In this embodiment, the source address of the first NA packet can be the IPv6 address of the second device that sent the first NA packet. The destination address of the first NA packet is determined based on the source address of the NS packet.

[0174] The destination address of the first NA message can be determined based on 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 also include a fourth option field, such as option 252. This fourth option field carries the second address and the second prefix length. For example, with a second address prefix of 1001:1001:: / 32, the second address can be 1001:1001::, the second prefix length is 32, and {1001:1001::, 32} is filled into the fourth option field. The message format of the first NA message in this case can be seen in Table 2 above.

[0176] In this embodiment, 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 fourth option field, and then determine whether the first address prefix and the second address prefix conflict. Specifically, if any of the above conditions 1 to 3 are met, the first device can determine 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 the first address prefix is ​​marked as unavailable.

[0177] In this embodiment of the application, the first device may also determine whether the first address prefix and the second address prefix conflict based on the first target address field and the second target address field. Specifically, if the value of the first target address field is the same as the value of the second target address field, then 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 the first address prefix is ​​marked as unavailable.

[0178] In this embodiment, the first device only needs to compare the first target address field and the second target address field to determine whether the first address prefix and the second address prefix conflict, and to determine whether the first NA packet is the NA packet corresponding to the first NS packet. This is the same as the operation in the prior art when detecting conflict addresses. Therefore, the implementation of this embodiment makes little change to the prior art, is easy to implement, and reduces the complexity of conflict detection.

[0179] In this embodiment, the first device reuses the destination address field in the NS message, reducing the length of the third option field, thereby reducing the length of the NS message and lowering network overhead. Furthermore, the first device can obtain the conflicting first and second address prefixes, facilitating subsequent analysis and elimination of the cause of the conflict.

[0180] Method 3: 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 sixth option field; the first destination 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 by the first prefix length; the second destination address field is used to carry the second address; the sixth option field is used to carry the second prefix length, and the second address prefix is ​​determined in the second address by the second prefix length.

[0181] In this embodiment, the third option field and the sixth option field can be options not assigned 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 this embodiment, the source address of the first NS message may not be specified, and it may also be the IPv6 address of the first device. The destination address of the first NS message may be the multicast address of all nodes on the link locality. The destination address of the first NS message may be the first address. Furthermore, the first NS message may also include a third option field, such as option 251, which carries the first prefix length. In this case, the message format of the first NS message can be found in Table 3 above.

[0183] In this embodiment, the source address of the first NA packet can be the IPv6 address of the second device that sent the first NA packet. The destination address of the first NA packet is determined based on the source address of the NS packet.

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

[0185] In addition, the first NA message may also include a sixth option field, such as option 252, which 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 destination address field, and {32} is filled into the sixth option field. The message format of the first NA message in this case can be seen in Table 4.

[0186] Table 4

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

[0188] The format of field 252 can be found in [reference needed]. Figure 5b As shown. Option 252 includes the T subfield, L subfield, and V subfield.

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

[0190] The L subfield carries the length of the V subfield, such as Figure 5b The value of 1 in the L subfield indicates that the length of the V subfield is 1 byte and the length of the L subfield is 1 byte.

[0191] The V subfield carries the length of the second prefix. The length of the V subfield is 1 byte.

[0192] In this embodiment, 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 of the above conditions 1 to 3 are met, the first device can determine 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 the first address prefix is ​​marked as unavailable.

[0193] In this embodiment, the first device reuses the destination address field in the NS and NA packets, reducing the length of the third and sixth option fields, thereby reducing the length of the NS and NA packets and lowering network overhead. Furthermore, the first device can obtain the conflicting first and second address prefixes, facilitating subsequent analysis and elimination of the cause of the conflict.

[0194] Method 4: 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 sixth option field; the first destination 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 by the first prefix length; the second destination 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 by the second prefix length.

[0195] In this embodiment, the third option field and the sixth option field can be options not assigned 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 this embodiment of the application, the message format of the first NS message can be found in the relevant description of the first NS message in Method 2 above, and will not be repeated here.

[0197] In this embodiment, the source address of the first NA packet can be the IPv6 address of the second device that sent the first NA packet. The destination address of the first NA packet is determined based on the source address of the NS packet.

[0198] The destination address of the first NA message can be determined based on 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 second destination address field in the first NA message is filled with the first address.

[0199] In addition, the first NA message may also include a sixth option field, such as option 252, which carries the second prefix length. The message format of the first NA message in this case is shown in Table 5.

[0200] Table 5

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

[0202] The format of field 252 can be found in [reference needed]. Figure 5b As shown.

[0203] In this embodiment of the application, the first device can perform conflict detection between the value of the first target address field and the value of the second target address field; if it is determined that the value of the first target address field is the same as the value of the second target address field, that is, the first address in the first target address field is the same as the second address in the second target address field, then it can be 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 the first address prefix is ​​marked as unavailable.

[0204] In this embodiment, the first device only needs to compare the first target address field and the second target address field to determine whether the first address prefix and the second address prefix conflict, and to determine whether the first NA packet is the NA packet corresponding to the first NS packet. This is the same as the operation in the prior art when detecting conflict addresses. Therefore, the implementation of this embodiment makes little change to the prior art, is easy to implement, and reduces the complexity of conflict detection.

[0205] Method 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 the first address and the first prefix length, the first address prefix being determined in the first address by the first prefix length; the second option field is used to carry the second address and the second prefix length, the second address prefix being determined in the second address by the second prefix length; the fifth option field is used to carry the first address and the first prefix length.

[0206] In this embodiment, the first option field, the second option field, and the fifth option field can be options not assigned by the RFC standard, such as options 145 to 252. In one example, the first option field and the fifth option field can be option 251, and the second option field can be option 252.

[0207] In this embodiment of the application, the message format of the first NS message can be found in the relevant description of the first NS message in Method 1 above, and will not be repeated here.

[0208] In this embodiment, the source address of the first NA packet can be the IPv6 address of the second device that sent the first NA packet. The destination address of the first NA packet is determined based on the source address of the NS packet. The destination address of the first NA packet is determined based on the destination address of the NS packet.

[0209] In addition, the first NA message may also include a second option field and a fifth option field. For example, the second option field can be option 252, carrying the second address and the second prefix length. The fifth option field can be option 251, carrying the first address and the first prefix length. The fifth option field can be the first option field extracted from the NS message by the second device. Taking a first address prefix of 1001:: / 16 and a second address prefix of 1001:1001:: / 32 as an example, the first address can be 1001:: with a first prefix length of 16, and the second address can be 1001:1001:: with a second prefix length of 32. The second device fills the second option field with {1001:1001::, 32}, and the first device fills the first option field with {1001::, 16}. When the second device responds to the NS message, it adds the first option field {1001::, 16} as the fifth option field to the first NA message. The message format of the first NA message in this case can be seen in Table 6.

[0210] Table 6

[0211] Message Fields NA message Source address The IPv6 address of the second device Destination address The 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] The format of field 252 can be found in [reference needed]. Figure 4a As shown, the format of field 252 can be found in [reference needed]. Figure 4b As shown.

[0213] In this embodiment of the application, the first device can perform conflict detection on the value of the first option field and the value of 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 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 unavailable.

[0214] In this embodiment, the first device can determine whether the first address suffix and the second address prefix conflict using the first option field and the fifth option field, without needing to extract multiple fields to determine the first address suffix and the second address prefix, thus reducing the complexity of address prefix conflict detection. Furthermore, the first device can obtain the conflicting first address prefix and second address prefix, facilitating subsequent analysis and elimination of the cause of the conflict.

[0215] In some embodiments, such as Figure 6 As shown, an address prefix conflict detection method is also provided, applied to a first device, which may include the following steps:

[0216] Step S601: Mark the first address prefix as paused;

[0217] Before sending the first NS message via multicast, the first device can mark the first address prefix as paused (e.g., Tentative state).

[0218] If the address prefix being detected as conflicting is not an address prefix held by the first device, in this embodiment, the first device marks the first address prefix being detected as conflicting as Tentative, enabling the first device to accurately determine that the first address prefix is ​​not held by the first device. When receiving an NS message from the second device, this first address prefix will not be considered; that is, if the NS message sent by the second device carries an address prefix that conflicts with the first address prefix, the first device will not send the corresponding NA message. This effectively avoids the problem of an address prefix not being used by all devices in the network.

[0219] Step S602: Multicast a first NS message, the first NS message including a first address prefix, so that a second device holding an address prefix that conflicts with the first address prefix can send a neighbor advertisement message; the same as step S301 above.

[0220] Step S603: Within a preset response waiting time, receive a first NA message, the first NA including a second address prefix; the same as step S302 above.

[0221] Step S604: If the first address prefix conflicts with the second address prefix, then the first address prefix is ​​marked as unavailable; the same as step S303 above.

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

[0223] Step S606: After a preset response waiting time, if no NA message carrying an address prefix that conflicts with the first address prefix is ​​received, the first address prefix is ​​marked as available.

[0224] In this embodiment of the application, after sending a first NS message, the first device waits for a response from the second device for the first NS message. Within a preset response waiting time, for any received NA message, such as the first NA message, the first device determines whether the first NA message is a response to the first NS message (i.e., the NA message corresponding to the first NS message).

[0225] If the first NA message is determined to be a response to the first NS message, meaning the first address prefix conflicts with the second address prefix, then the first address prefix is ​​marked as unavailable. If the first NA message is determined not to be a response to the first NS message, meaning the first address prefix does not conflict with the second address prefix, then the system continues to wait for a response from the second device to the first NS message until the preset response waiting time expires.

[0226] If, after the preset response waiting timeout, the first device still does not receive an NA message carrying an address prefix that conflicts with the first address prefix, it indicates that the first address prefix does not conflict with any address prefix held by the second device, and the first address prefix is ​​marked as available (e.g., Valid state). Subsequently, the first device can use the first address prefix.

[0227] In this application embodiment, the first device is of different types, and the first device uses different processing methods for the first address prefix in the available state, 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 message, which includes the first address prefix.

[0230] In this embodiment of the application, the router performs the above-mentioned steps before sending the first RA message. Figure 3 or Figure 6 The address prefix conflict detection method shown performs conflict detection on the router's own first address prefix. Only after detecting that the first address prefix does not conflict with the address prefix held by the second device will the router advertise the first address prefix to other devices, such as the aforementioned host and other terminals.

[0231] After detecting a conflict between the first address prefix and the address prefix held by the second device, the router may choose not to advertise the first address prefix to other devices, ensuring that the address prefixes advertised by the router are not duplicated, thereby preventing other devices from generating conflicting IPv6 addresses.

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

[0233] After marking the first address prefix as available, the DHCPv6 client uses that first address prefix. After marking the first address prefix as unavailable, the client sends a DHCPv6 Decline message to the DHCPv6 server. The DHCPv6 Decline message includes the Identity Association for Prefix Delegation (IAPD) option, which carries the first address prefix so that the DHCPv6 server marks the first address prefix as unavailable based on the DHCPv6 Decline message.

[0234] In this embodiment of the application, after the DHCPv6 client obtains the IAPD (i.e., the first address prefix) from the DHCPv6 server, it performs the above-mentioned... Figure 3 or Figure 6 The address prefix conflict detection method shown performs conflict detection on the requested IAPD (i.e., the first address prefix). The IAPD requested by the DHCPv6 client can 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 DHCPv6 allocation process; or the IAPD requested by the DHCPv6 client can be: the IAP carried in the Reply message sent by the DHCPv6 server to the DHCPv6 client after receiving the Solicit message during the two-step DHCPv6 allocation process.

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

[0236] A. The DHCPv6 client acts as a router, dividing the first address prefix into multiple sub-address prefixes and sending multiple second RA messages, each of which includes a sub-address prefix;

[0237] B. This DHCPv6 client acts as a DHCPv6 server, assigning IANA addresses to the connected third-party devices based on the first address prefix. That is, this DHCPv6 client uses a four-step or two-step interactive allocation process to assign IPv6 addresses to other DHCPv6 clients connected to it.

[0238] C. The DHCPv6 client acts as a terminal (such as a host) and generates the IPv6 address of the DHCPv6 client based on the first address prefix, that is, it generates the global unicast address of the DHCPv6 client.

[0239] After detecting a conflict between the first address prefix and the address prefix held by the second device, the DHCPv6 client can choose not to use the first address prefix, ensuring that the address prefix requested by the DHCPv6 client is not duplicated, thereby avoiding the generation of conflicting IPv6 addresses by different devices.

[0240] Furthermore, the DHCPv6 client constructs a DHCPv6 Decline message, encapsulating the IAPD option within it, and sends this IAPD-encapsulated DHCPv6 Decline message to the DHCPv6 server. Upon receiving this IAPD-encapsulated DHCPv6 Decline message, the DHCPv6 server can extract the first address prefix from the IAPD option and mark it as unavailable. The DHCPv6 server records collision events involving the first address prefix, facilitating subsequent analysis and troubleshooting of collision causes and identifying conflicting devices.

[0241] In the DHCPv6 dynamic address configuration scheme, DHCPv6 relays can also exist in the network. After receiving a DHCPv6 Decline message encapsulated with IAPD options, the DHCPv6 relay can forward the DHCPv6 Decline message directly to the DHCPv6 server without processing it.

[0242] In the embodiments of this application, such as Figure 7 As shown, an address prefix conflict detection method is also provided, applied to a first device, which may include the following steps:

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

[0244] In this embodiment, the second NS message is any NS message used to detect address prefix conflicts. 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 checks whether its address prefix conflicts with the address prefix of the second device, the second device also checks whether its address prefix conflicts with the address prefix of the first device. When detecting conflicting address prefixes, the second device obtains the third address prefix to be detected, fills it into the NS message, and obtains the second NS message; then, it multicasts and sends the second NS message. The message format of the second NS message is the same as that of the first NS message described above, and will not be repeated here.

[0246] After sending the second NS message, the second device waits for a response to receive the second NS message. The waiting time for the response can be found in the preset waiting time mentioned above.

[0247] In step S702, if the third address prefix conflicts with the fourth address prefix held by the first device, a second NA message is sent, which includes the fourth address prefix.

[0248] After receiving the second NS message, the first device extracts the third address prefix from it and checks whether it conflicts with any address prefixes it holds. If one of its address prefixes (such as the fourth address prefix) conflicts with the third address prefix, the first device sends a response to the second NS message, i.e., a second NA message, which carries the fourth address prefix. If none of the address prefixes held by the first device conflict with the third address prefix, the first device does not respond to the second NS message, i.e., it does not reply to the second NS message.

[0249] For details on the operation of the second device waiting to receive the response to the second NS message, please refer to the operation of the first device waiting to receive the response to the first NS message described above, which will not be repeated 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 unavailable. 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 with an NA message.

[0251] In this embodiment, the fifth address prefix can be understood as an address prefix in a paused state, i.e., an address prefix that is currently undergoing conflict detection. When the first device determines that the third address prefix conflicts with the fifth address prefix that is currently undergoing conflict detection in the first device, it directly marks the fifth address prefix as unavailable. This further resolves the problem of different terminals generating the same IPv6 address based on conflicting address prefixes from different devices, thus causing address conflicts and improving network connection stability.

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

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

[0254] The second option field is used to carry the fourth address and the fourth prefix length. 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 the third address and the third prefix length.

[0256] In some embodiments, a second neighbor request message includes a first destination address field and a third option field; a 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 the third address;

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

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

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

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

[0262] If the length of the third prefix is ​​greater than the length of the fourth prefix, and the third detection prefix is ​​the same as the fourth address prefix, then a second neighbor advertisement message is sent, and the third detection prefix is ​​determined in the third address by the length of the fourth prefix; or,

[0263] If the length of the third prefix is ​​less than the length of the fourth prefix, and the third address prefix is ​​the same as the fourth detection prefix, then a second neighbor advertisement message is sent, and the fourth detection prefix is ​​determined in the fourth address using the length of the third prefix; or,

[0264] If the length of the third prefix is ​​equal to the length of the fourth prefix, and the third address prefix is ​​the same as the fourth address prefix, then a second neighbor advertisement message is sent.

[0265] In this embodiment of the application, the first device implements address prefix conflict detection by responding to the NS message that detects address prefix conflicts, avoids announcing conflicting address prefixes, or enables conflicting address prefixes to generate IPv6 addresses, thereby reducing conflicting addresses in the network and improving the stability of network connections.

[0266] The following is combined Figures 8-9 The signaling diagram for address prefix conflict detection shown illustrates the address prefix conflict detection method provided in this application embodiment. The preset response waiting time is 1 second.

[0267] Figure 8 This is a signaling diagram for routers performing address prefix conflict detection. Router A has an IP address of 1:1:1::1 / 48, and router B has an IP address of 2:2:2::2 / 64. Router A needs to detect a conflict with address prefix 1, which is 1:2:: / 32 and has a length of 32. Router B holds address prefix 2, which is 1:2:3:: / 48 and has a length of 48.

[0268] In step S801, router A marks prefix 1 as paused.

[0269] In step S802, router A constructs NS message 1 and sends NS message 1. The message format of NS message 1 is shown in Table 7 below.

[0270] Table 7

[0271] Message Fields 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 for a period of 1 second (i.e., the preset response waiting time).

[0273] In 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, i.e., 1:2:: / 32.

[0274] In step S804, router B checks 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 conflicting with prefix 2 held by router B, then step S805 is executed.

[0275] In step S805, router B constructs and sends NA message 1. The message format of NA message 1 is shown in Table 8 below.

[0276] Table 8

[0277]

[0278]

[0279] In this context, NA message 1 is the response to NS message 1.

[0280] In this embodiment of the application, router B can also detect whether prefix 1 conflicts with the prefix that router B is currently detecting; if there is a conflict, such as prefix 1 conflicting with prefix 3 that router B is currently detecting, then router B can mark prefix 3 as unavailable and does not need to reply to router A with an NA message.

[0281] In step S806, router A receives an NA message before the waiting time expires and extracts the prefix from the option 252 field of the NA message.

[0282] In step S807, router A checks whether prefix 1 conflicts with the extracted prefix; if there is no conflict, it continues to execute step S806 before the waiting time expires, and executes step S809 after the waiting time expires; if there is a conflict, such as the received NA packet being NA packet 1 and the extracted prefix being prefix 2, i.e., 1:2:3:: / 48, it executes step S808.

[0283] In step S808, router A marks prefix 1 as unavailable.

[0284] Router A can record prefix 1 and prefix 2 conflicts, which facilitates subsequent analysis and troubleshooting of the cause of the conflict and the conflicting devices.

[0285] In step S809, if router A does not receive NA packet 1 after the waiting time expires, it marks prefix 1 as available. Then, step S810 is executed.

[0286] In step S810, router A sends RA message 1, which includes prefix 1.

[0287] Figure 9 This is a signaling diagram for DHCPv6 client performing address prefix conflict detection. DHCPv6 client A communicates with the DHCPv6 server via a DHCPv6 relay. DHCPv6 client B's IP address is 1:2:3::2 / 48, and its address prefix 2 is 1:2:3:: / 48, with a prefix length of 48.

[0288] Step S901: DHCPv6 client A obtains prefix 1. Prefix 1 is the address prefix to be checked for conflicts; its length is 32, and its format is 1:2:: / 32.

[0289] DHCPv6 client A can obtain prefix 1, i.e., IAPD, by using the Reply message in the four-step interactive allocation process of DHCPv6 or the Reply message in the two-step interactive allocation process of DHCPv6.

[0290] In step S902, DHCPv6 client A marks prefix 1 as paused.

[0291] In step S903, DHCPv6 client A constructs and sends NS message 2. The message format of NS message 2 is shown in Table 9 below.

[0292] Table 9

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

[0294] After sending the NS2 message, DHCPv6 client A waits for other devices to respond to the NS2 message for 1 second (i.e., the default response waiting time).

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

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

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

[0298] In step S906, DHCPv6 client B constructs and sends NA message 2. The message format of NA message 2 is shown in Table 10 below.

[0299] Table 10

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

[0301] In this context, NA message 2 is the response to NS message 2.

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

[0303] In step S907, DHCPv6 client A receives an NA message before the waiting time expires and extracts the prefix from the option 252 field of the NA message.

[0304] In step S908, DHCPv6 client A checks whether prefix 1 conflicts with the extracted prefix; if there is no conflict, it continues to execute step S907 before the waiting time expires, and executes step S913 after the waiting time expires; if there is a conflict, such as the received NA packet being NA packet 2 and the extracted prefix being prefix 2, i.e., 1:2:3:: / 48, it executes step S909.

[0305] In step S909, DHCPv6 client A marks prefix 1 as unavailable.

[0306] DHCPv6 client A can record prefix 1 and prefix 2 conflicts, which facilitates subsequent analysis and troubleshooting of the cause of the conflict and the conflicting devices.

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

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

[0309] In step S912, the DHCPv6 server marks prefix 1 as unavailable.

[0310] DHCPv6 servers can record conflicts between prefix 1 and other prefixes, which facilitates subsequent analysis and troubleshooting of the cause of the conflict and the conflicting devices.

[0311] In step S913, if DHCPv6 client A does not receive NA message 2 after the waiting time expires, it marks prefix 1 as available. Then, step S914 is executed.

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

[0313] In the technical solution provided in this application embodiment, the first device uses the address prefix carried in the NS message and NA message to realize the conflict detection of address prefix, reduce the duplicate prefix in the network, solve the problem of address conflict caused by different terminals generating the same IPv6 address based on conflicting address prefixes from different first devices, and can ensure that there is only one default gateway address corresponding to an address prefix, thereby improving the stability of network connection.

[0314] Corresponding to the address prefix conflict detection method described above, this application also provides an address prefix conflict detection device, applied to the first device, such as... Figure 10As shown, the device includes:

[0315] The first sending module 1001 is used to multicast a first neighbor request message, the first neighbor request message including a first address prefix, so that a second device holding an address prefix that conflicts with the first address prefix can send a neighbor advertisement message;

[0316] The first receiving module 1002 is used to receive a first neighbor announcement message within a preset waiting response time. The first neighbor announcement message includes a second address prefix.

[0317] The marking module 1003 is used to mark the first address prefix as unavailable if the first address prefix conflicts with the second address prefix.

[0318] In some embodiments, a first neighbor request message includes a first option field; a first neighbor announcement message includes a second option field.

[0319] The first option field is used to carry the first address and the first prefix length. The first address prefix is ​​determined in the first address by the first prefix length.

[0320] The second option field is used to carry the second address and the second prefix length. The second address prefix is ​​determined in the second address by the second prefix length.

[0321] In some embodiments, a first neighbor request message includes a first destination address field and a third option field; a 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 the first address;

[0323] The third option field is used to carry the length of the first prefix, and the first address prefix is ​​determined in the first address by the length of the first prefix.

[0324] The second destination address field is used to carry the third address, which is the destination address carried in the neighbor request message received by the second device.

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

[0326] In some embodiments, the marking module 1003 may be specifically used for:

[0327] If the length of the first prefix is ​​greater than the length of the second prefix, and the first detection prefix is ​​the same as the second address prefix, then the first address prefix is ​​marked as unavailable. The first detection prefix is ​​determined from the first address by the length of the second prefix; 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 the first address prefix is ​​marked as unavailable, and the second detection prefix is ​​determined from the second address using 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 the first address prefix is ​​marked as unavailable.

[0330] In some embodiments, the marking module 1003 may 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 first prefix length;

[0332] The marking module 1003 can be 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 sending the first neighbor request message via multicast, mark the first address prefix as paused;

[0335] If no neighbor message carrying an address prefix that conflicts with the first address prefix is ​​received after a preset response waiting time, the first address prefix is ​​marked as available.

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

[0337] The second sending module is used to send a first route advertisement message, which includes a first address prefix.

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

[0339] The third sending module is used to send a DHCPv6 rejection message to the DHCPv6 server when the first address prefix is ​​marked as unavailable. The DHCPv6 rejection message includes the IAPD option, which carries the first address prefix so that the DHCPv6 server marks the first address prefix as unavailable according to the DHCPv6 rejection message.

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

[0341] The generation module is used to divide the first address prefix into multiple sub-address prefixes and send multiple second route advertisement messages when the first address prefix is ​​marked as unavailable, with each second route advertisement message including a sub-address prefix; or, to assign an IANA address to the accessing third device based on the first address prefix; or, to generate an IPv6 address for a DHCPv6 client based on the first address prefix.

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

[0343] Furthermore, different devices announce different address prefixes. A terminal will not receive conflicting address prefixes from different devices, and each address prefix corresponds to only one default gateway address. Without multiple default gateway addresses, the terminal will not frequently switch default gateways, improving network connection stability and enhancing the user's internet experience.

[0344] Corresponding to the address prefix conflict detection method described above, this application also provides an address prefix conflict detection device, applied to the first device, such as... Figure 11 As shown, the device includes:

[0345] The second receiving module 1101 is used to receive a second neighbor request message, which includes a third address prefix.

[0346] The fourth sending module 1102 is used to send a second neighbor advertisement message if the third address prefix conflicts with the fourth address prefix held by the first device. The second neighbor advertisement message includes the fourth address prefix.

[0347] In some embodiments, a second neighbor request message includes a first option field; a second neighbor announcement message includes a second option field.

[0348] The first option field is used to carry the third address and the third prefix length. The third address prefix is ​​determined by the third prefix length in the third address.

[0349] The second option field is used to carry the fourth address and the fourth prefix length. 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, a second neighbor request message includes a first destination address field and a third option field; a 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 length of the third prefix, and the third address prefix is ​​determined in the third address by the length of the third prefix;

[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. 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 be specifically used for:

[0357] If the length of the third prefix is ​​greater than the length of the fourth prefix, and the third detection prefix is ​​the same as the fourth address prefix, then a second neighbor advertisement message is sent, and the third detection prefix is ​​determined in the third address by the length of the fourth prefix; or,

[0358] If the length of the third prefix is ​​less than the length of the fourth prefix, and the third address prefix is ​​the same as the fourth detection prefix, then a second neighbor advertisement message is sent, and the fourth detection prefix is ​​determined in the fourth address using the length of the third prefix; or,

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

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

[0361] Furthermore, different devices announce different address prefixes. A terminal will not receive conflicting address prefixes from different devices, and each address prefix corresponds to only one default gateway address. Without multiple default gateway addresses, the terminal will not frequently switch default gateways, improving network connection stability and enhancing the user's internet experience.

[0362] Corresponding to the address prefix conflict detection method described above, this application embodiment also provides a first device, such as... Figure 12 As shown, it includes a processor 1201, a communication interface 1202, a memory 1203, and a communication bus 1204, wherein the processor 1201, the communication interface 1202, and the memory 1203 communicate with each other through the communication bus 1204.

[0363] Memory 1203 is used to store computer programs;

[0364] The processor 1201, when executing a program stored in 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 address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this 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 random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.

[0368] The processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can 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, or discrete hardware components.

[0369] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements any of the above-described address prefix conflict detection methods.

[0370] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the above-described address prefix conflict detection methods.

[0371] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially 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, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid state disk (SSD)).

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

[0373] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments for the apparatus, first device, storage medium, and computer program product are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0374] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.

Claims

1. A method for detecting address prefix conflicts, characterized in that, Applied to a first device, the method includes: Multicast sends a first neighbor request message, which 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 response waiting time, a first neighbor advertisement message is received, the first neighbor advertisement message including a second address prefix; If the first address prefix conflicts with the second address prefix, the first address prefix is ​​marked as unavailable, and the unavailable state indicates that the corresponding address prefix is ​​not routed.

2. The method according to claim 1, characterized in that, The first neighbor request message includes a first option field; the first neighbor announcement message includes a second option field. The first option field is used to carry the first address and the 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 the second address and the second prefix length, the second address prefix being determined in the second address by the second prefix length.

3. The method according to claim 1, characterized in that, The first neighbor request 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. 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 by the first prefix length; The second target address field is used to carry a third address, which is the target address carried in the neighbor request message received by the second device; The fourth option field is used to carry the second address and the second prefix length, wherein 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, The step of marking the first address prefix as unavailable if it conflicts with the second address prefix includes: If the length of the first prefix is ​​greater than the length of the second prefix, and the first detection prefix is ​​the same as the second address prefix, then the first address prefix is ​​marked as unavailable. The first detection prefix is ​​determined in the first address by the length of the second prefix; or... 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 the first address prefix is ​​marked as unavailable, and the second detection prefix is ​​determined in the second address by the length of the first prefix; or, 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 the first address prefix is ​​marked as unavailable.

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

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

7. The method according to claim 1, characterized in that, The method further includes: Before multicasting the first neighbor request message, the first address prefix is ​​marked as paused; If no neighbor message carrying an address prefix that conflicts with the first address prefix is ​​received after the preset response waiting time, 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: Send a first route advertisement message, which 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 rejection message is sent to the DHCPv6 server. The DHCPv6 rejection message includes an IAPD option, which carries the first address prefix so that the DHCPv6 server marks the first address prefix as unavailable based on the DHCPv6 rejection 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 available, the method further includes: Divide the first address prefix into multiple sub-address prefixes and send multiple second route advertisement messages, each second route advertisement message including one sub-address prefix; or, Assign an IANA address to the third device accessing the network based on the first address prefix; or, The IPv6 address of the DHCPv6 client is generated based on the first address prefix.

11. A method for detecting address prefix conflicts, characterized in that, Applied to a first device, the method includes: Receive a second neighbor request message, which 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, which includes the fourth address prefix, so that other devices mark the third address prefix as unavailable, and the unavailable state indicates that the address prefix corresponding to the advertisement is not routed.

12. The method according to claim 11, characterized in that, The second neighbor request message includes a first option field; the second neighbor announcement message includes a second option field. The first option field is used to carry the third address and the third prefix length, wherein the third address prefix is ​​determined in the third address by the third prefix length; The second option field is used to carry the fourth address and the fourth prefix length, wherein 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 announcement 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 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. The first target address field is used to carry the third address; 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; The second target address field is used to carry the third address; The fourth option field is used to carry the fourth address and the fourth prefix length, wherein the fourth address prefix is ​​determined in the fourth address by the fourth prefix length.

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

16. An address prefix conflict detection device, characterized in that, Applied to a first device, the device includes: The first sending module is used to multicast a first neighbor request message, the first neighbor request message including a first address prefix, so that a second device holding an address prefix that conflicts with the first address prefix can send a neighbor advertisement message; The first receiving module is used to receive a first neighbor announcement message within a preset waiting response time, wherein the first neighbor announcement message includes a second address prefix; The marking module is used to mark the first address prefix as unavailable if the first address prefix conflicts with the second address prefix, wherein the unavailable state indicates that the address prefix corresponding to the routing advertisement is not used.

17. An address prefix conflict detection device, characterized in that, Applied to a first device, the device includes: The second receiving module is used to receive a second neighbor request message, which includes a third address prefix. The fourth sending module is configured to send a second neighbor advertisement message if the third address prefix conflicts with the fourth address prefix held by the first device. The second neighbor advertisement message includes the fourth address prefix so that other devices mark the third address prefix as unavailable. The unavailable state indicates that the address prefix corresponding to the route advertisement is not routed.