Method and device for automatically allocating ULA address by router, computer equipment and storage medium
By actively sending messages, it determines the listening status and level of the router's IPV6 WAN port, which solves the problem that the router cannot automatically allocate ULA addresses, and realizes IPV6 service support for secondary or multi-level devices.
Patent Information
- Application Number
- CN202411258160.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-09
- Publication Date
- 2025-01-14
AI Technical Summary
When existing routers cannot obtain IPV6 prefixes through IA_PD, they cannot automatically allocate IPV6 addresses, resulting in the secondary or secondary routing devices being unable to use IPV6 services.
By actively sending messages to the router, determining the listening status of the IPV6 WAN port, determining the router level, and automatically assigning the ULA address according to the level.
It realizes IPV6 service support for secondary or multi-level routing devices, automatically determines the stateful and stateless listening status of the router, and automatically allocates the ULA address.
Smart Images

Figure CN119316351A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of automatic allocation of ULA addresses by routers, and in particular to automatic allocation of ULA addresses by routers. Background Art
[0002] At present, mainstream routers can obtain IPV6 addresses in a specified stateless or stateful manner. If the address cannot be obtained through IA_PD, the ULA address needs to be sent down on the LAN side manually or through ACS. Since the IPV6 prefix cannot be obtained through IA_PD, or the obtained prefix is 64, the second-level or lower routing devices cannot allocate IPV6 addresses, resulting in the inability to use IPV6 services. There is an urgent need for a stateful and stateless listening method that can automatically determine IPV6 and automatically allocate IPV6 addresses to second-level or lower routing devices according to the preset current network status. Summary of the invention
[0003] The embodiments of the present invention provide a method, an apparatus, a computer device and a storage medium for automatically allocating ULA addresses by a router, so as to solve the problem of automatically allocating ULA addresses by a router.
[0004] A method for automatically allocating a ULA address by a router, comprising: Actively send a message to the router to determine the listening state of the WAN port of IPv6, wherein the listening state includes stateful listening or stateless listening; The router level is obtained based on the listening status of the IPv6 WAN port, the prefix address of the message received by the IPv6 WAN port, and whether IA_NA can obtain the IPv6 address. The address of the router is allocated according to the obtained level of the router.
[0005] A device for automatically allocating ULA addresses by a router, comprising: The first judgment module is used to actively send a message to the router to determine the listening state of the WAN port of the IPv6, wherein the listening state includes stateful listening or stateless listening; The second judgment module is used to obtain the level of the router according to the listening state of the IPV6 WAN port, the prefix address of the message received by the IPV6 WAN port, and whether IA_NA can obtain the IPV6 address; The processing module is used to allocate the address of the router according to the obtained level of the router.
[0006] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned method for automatically allocating ULA addresses by a router when executing the computer program.
[0007] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for automatically allocating ULA addresses by a router is implemented.
[0008] The above-mentioned method, device, computer equipment and storage medium for automatically allocating ULA addresses to routers, by actively sending messages to the router, determine the listening state of the WAN port of IPV6, the listening state includes stateful listening or stateless listening; according to the listening state of the WAN port of IPV6, the prefix address of the message received by the WAN port of IPV6 and whether IA_NA can obtain the IPV6 address, the level of the router is obtained; according to the obtained level of the router, the address of the router is allocated. This application actively sends messages to the router, autonomously determines whether IPV6 is in stateful or stateless listening, determines the level of the router, and automatically allocates ULA addresses to the router, so that the secondary or multi-level routing equipment supports IPV6 services. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0010] Figure 1 1 is a schematic diagram of an application environment of a method for automatically allocating ULA addresses by a router in an embodiment of the present invention; Figure 2 is a flow chart of a method for automatically allocating ULA addresses by a router in one embodiment of the present invention; Figure 3 is another flow chart of a method for automatically allocating ULA addresses by a router in one embodiment of the present invention; Figure 4 is another flow chart of a method for automatically allocating ULA addresses by a router in one embodiment of the present invention; Figure 5 is another flow chart of a method for automatically allocating ULA addresses by a router in one embodiment of the present invention; Figure 6 is another flow chart of a method for automatically allocating ULA addresses by a router in one embodiment of the present invention; Figure 7 is another flow chart of a method for automatically allocating ULA addresses by a router in one embodiment of the present invention; Figure 8is a schematic diagram of a device for automatically allocating ULA addresses by a router in one embodiment of the present invention; Fig. 9 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0011] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0012] The method for automatically allocating ULA addresses by a router provided in an embodiment of the present invention can be applied as follows: Figure 1 Specifically, the method for automatically allocating ULA addresses by a router is applied in a system for automatically allocating ULA addresses by a router, and the system for automatically allocating ULA addresses by a router includes: Figure 1 The client and server shown in the figure communicate with each other through the network to realize the automatic allocation of ULA addresses by the router. The client, also known as the user end, refers to the program corresponding to the server and providing local services to the client. The client can be installed on, but not limited to, various personal computers, laptops, smart phones, tablet computers and portable wearable devices. The server can be implemented as an independent server or a server cluster consisting of multiple servers.
[0013] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0014] It should also be understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0015] As used in the present specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]", depending on the context.
[0016] In addition, in the description of the present specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0017] References to "one embodiment" or "some embodiments" etc. described in the present specification mean that one or more embodiments of the present invention include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0018] It should be understood that the order of execution of the steps in the following embodiments does not imply a precedence of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0019] In order to illustrate the technical solution of the present invention, specific embodiments are provided below for illustration.
[0020] In one embodiment, if Figure 2 As shown, a method for automatically allocating ULA addresses by a router is provided, and the method is applied in Figure 2 Taking this as an example, the following steps are included.
[0021] S10: Actively send a message to the router to determine the listening state of the WAN port of IPv6, where the listening state includes stateful listening or stateless listening.
[0022] Specifically, when the WAN port is connected to the network cable, if the router has IPV6 enabled, the router will actively send RS messages. Therefore, at this time, you only need to listen consistently on the IPV6-enabled WAN port to see if there is any RA message reception, so you can determine whether IPV6 is stateful or stateless listening. Among them, the RS message is used by the IPv6 host to find the router on the local link. After the host sends the RS message, it will trigger the router in the same network segment to immediately reply with a RA message to obtain prefix information, MTU information, etc., without waiting for the router to periodically send RA messages.
[0023] S20: The level of the router is obtained according to the listening state of the IPv6 WAN port, the prefix address of the message received by the IPv6 WAN port, and whether IA_NA can obtain the IPv6 address.
[0024] S30: Allocate the address of the router according to the obtained level of the router.
[0025] Specifically, if the WAN port of IPV6 receives an RA message, the level of the router is obtained according to the prefix address of the RA message and whether IA_NA can obtain the IPV6 address. For example, when the prefix contained in the RA message is FC00:: / 7, it is considered a non-first-level route. If it does not contain a prefix, or the prefix address is a GUA prefix, it is considered a first-level route. If the IPV6 address is obtained through IA_NA, if the address is a GUA address, it is a first-level route. If it is a ULA address, it is considered a non-first-level route. The address is automatically assigned to the router according to whether the obtained route is a first-level route or a second-level route.
[0026] In one embodiment, a method for a router to automatically assign a ULA address is provided, such as Figure 3 As shown, in step S20, the level of the router is obtained according to the listening state of the WAN port of the IPv6 and the prefix address of the message received by the WAN port of the IPv6. Figure 3 Take this as an example to explain, including the following steps: S21: Actively send a message to the router to check whether there is any message received at the IPV6 WAN port.
[0027] S22: If the IPv6 WAN port does not receive any message for a long time, it means that the IPv6 WAN port is in stateful listening.
[0028] S23: When the WAN port of IPV6 is in stateful listening, DHCP6 sends DHCP6C with IA_NA and IA_PD parameters and sends an IPV6 address application request to actively allocate an address to the router.
[0029] Specifically, when the router enables IPV6, the router will actively send RS messages. After sending the messages, whether the WAN port with IPV6 enabled can receive RA messages, it can determine whether the WAN port of IPV6 is in stateful listening. Stateful listening can identify user clients, and IP address managers can allocate corresponding IPV6 addresses according to different clients. There is a lease and renewal relationship between the client and the server. If it is in stateful listening, it can send DHCP6C with IA_NA and IA_PD parameters and send an IPV6 address request through DHCP6 (Dynamic Host Configuration Protocol for IPv6, Dynamic Host Configuration Protocol based on IPv6), and actively allocate addresses to the router. That is, when the client host IP address is set to dynamic acquisition mode, the DHCP server will allocate IP to the client according to the DHCP protocol. dhcpcd automatically starts or stops the service by monitoring the status changes of the network interface, which makes it very suitable for embedded systems and IoT devices that need to automatically obtain IP addresses. Among them, the address field in DHCPv6 needs to be deleted from the fixed message header of DHCP, and the entire address parameter and related time parameters are encapsulated in an option called IA (Identity Association). Each DHCPv6 client is associated with an IA, and each IA can contain multiple addresses and related time information, and generate corresponding IAs according to different address types, such as IA_NA (Identity association for non-temporary addresses, the address contained in the IA is a non-temporary address). Among them, DHCPv6 assigns network prefixes, and only needs to extend the IA type to assign a prefix to the client in the form of an address. This new IA type is IA_PD (Identity Association for Prefix Delegation). Therefore, DHCP can send DHCP6C with IA_NA and IA_PD parameters and send an IPV6 address request to obtain the IP address of the route.
[0030] S24: If the IPv6 WAN port receives a message, it means that the IPv6 WAN port is in stateless listening.
[0031] S25: When the WAN port of IPV6 is in stateless listening, the level of the router is determined based on the address prefix contained in the message.
[0032] Specifically, after sending the message, the RA message can be received on the IPV6-enabled WAN port, which proves that the IPV6 WAN port is in stateless listening. Stateless listening cannot identify the client, there is no IP address manager, and the client needs to configure the address by itself according to the relevant RA message content sent by the network manager. If the IPV6 WAN port is in stateless listening, the level of the router is determined according to the address prefix contained in the message. For example, when the prefix contained in the RA message is FC00:: / 7, it is considered a non-first-level route. If it does not contain a prefix, or the prefix address is a GUA prefix, it is considered a first-level route.
[0033] In one embodiment, a method for a router to automatically assign a ULA address is provided, such as Figure 4 As shown, in step S20, whether IA_NA can obtain the IPV6 address, the level of the router is obtained, and the method is applied in Figure 4 Take this as an example to illustrate the steps below: S26: If an IPv6 address is obtained through IA_NA, the level of the router is determined according to the obtained IPv6 address.
[0034] S27: If the IPV6 address cannot be obtained through IA_NA, the level of the router is determined according to the address prefix contained in the message.
[0035] Specifically, if an IPV6 address is obtained through IA_NA under stateful listening, if the address is a GUA address, it is a first-level route. If it is a ULA address, it is considered a non-first-level route. If the IPV6 address cannot be obtained through IA_NA, it depends on whether the RA contains a prefix. If the prefix address is FC00:: / 7, it is considered a second-level route. In other cases, it is considered a first-level route.
[0036] In one embodiment, a method for a router to automatically assign a ULA address is provided, such as Figure 5 As shown, in step S20, the level of the router is obtained according to the listening state of the IPV6 WAN port, the prefix address of the message received by the IPV6 WAN port, and whether IA_NA can obtain the IPV6 address, and then the following steps are included: S21`: storing the identified router level in the corresponding routing cascade mark.
[0037] S22` When the routing cascade flag is managed and the managed value is 1, the WAN port sends an IPV6 address request via DHCP6C with IA_NA.
[0038] S23`: When the routing cascade flag is managed and the managed value is 0, the WAN port does not send the IPV6 address request through the DHCP6C with IA_NA.
[0039] S24`: When the routing cascade flag is other and the other value is 0, the WAN needs to obtain the IPV6DNS address through a DHCP6C request.
[0040] S25`: When the routing cascade flag is other and the other value is 1, the IPV6DNS address is obtained through the other field in the message.
[0041] Specifically, after obtaining the level of the router according to the listening state of the WAN port of IPV6, the prefix address of the message received by the WAN port of IPV6, and whether IA_NA can obtain the IPV6 address, the identified router level needs to be stored in the corresponding routing cascade mark, wherein the routing cascade is a method of connecting two or more routers to form a larger network. Through cascading, the coverage of the network can be expanded, the number of network ports can be increased, and mutual access between different networks can be achieved. When the routing cascade mark is managed and the managed value is 1, the WAN port will send the IPV6 address request with IA_NA through DHCP6C, and when the routing cascade mark is managed and the managed value is 0, the WAN port will not send the IPV6 address request with IA_NA through DHCP6C. Among them, dhcpcd is a software package for managing IP address allocation, which is a service in the Linux operating system. Its main function is to automatically detect and configure network interfaces so that the device can dynamically obtain or configure IP addresses and other network settings. When the flag of the routing cascade is other, and the value of other is 0, the WAN needs to obtain the IPV6DNS address through a DHCP6C request; when the flag of the routing cascade is other, and the value of other is 1, the IPV6DNS address is obtained through the other field in the message. Among them, the managed flag is the managed address configuration flag, also known as the M flag. When set to 1, this flag instructs the host to use the configuration protocol to obtain a stateful address, and the other flag is another stateful configuration flag, also known as the O flag. When set to 1, this flag instructs the host to use the configuration protocol to obtain other configuration settings.
[0042] In one embodiment, a method for automatically allocating a ULA address by a router is provided. In step S30, the address of the router is allocated according to the level of the router, including the following steps: S31: Obtain the WAN address on the WAN side, write the obtained WAN address into the WAN side interface, and allocate the router LAN side address.
[0043] Specifically, according to the different levels of the router, it is necessary to automatically allocate addresses to the WAN side and LAN side of the router. Therefore, it is necessary to obtain the WAN address of the WAN side of the router, write the obtained WAN address into the WAN side interface, and allocate the address of the LAN side of the router.
[0044] In one embodiment, a method for a router to automatically assign a ULA address is provided, such as Figure 6 As shown, in step S31, the WAN address of the WAN side is obtained, and the obtained WAN address is written into the WAN side interface. Figure 6 Take this as an example to illustrate the steps below: S311: According to the managed value of the message received by the IPV6 WAN port, DHCP6C is called to obtain the corresponding IPV6 address or prefix.
[0045] S312: If the IPV6 address is obtained through the IA_NA of the message response, a WAN address is generated on the WAN side, and the generated WAN side address is written into the WAN side interface.
[0046] S313: If the IA_NA in the message response does not obtain the IPV6 address, it is necessary to enable the autoconf function in the Linux kernel to automatically generate a WAN side address according to the message prefix, and write the generated WAN side address into the WAN side interface.
[0047] Specifically, when allocating addresses on the WAN side, it is necessary to call DHCP6C to obtain the corresponding IPV6 address or prefix based on the managed value of the message received by the IPV6 WAN port. If the IPV6 address is obtained through the IA_NA of the message response, a WAN address is generated on the WAN side and the generated WAN address is written to the WAN side interface. If the IPV6 address is not obtained through the IA_NA of the message response, it is necessary to turn on the autoconf function in the Linux kernel, automatically generate the WAN address according to the message prefix, and write the generated WAN address to the WAN side interface.
[0048] In one embodiment, a method for a router to automatically assign a ULA address is provided, such as Figure 7 As shown, in step S31, the router LAN side address is allocated, and this method is applied in Figure 7 Take this as an example to illustrate the steps below: S314: When an IA_PD response is received without a prefix address and the routing cascade flag is level one, a ULA prefix address is automatically generated.
[0049] S315: When an IA_PD response is received, there is no prefix address in the message, and the routing cascade flag is non-level one, it is necessary to automatically generate a ULA prefix address that is different from the message address prefix or the prefix in IA_NA.
[0050] S316: When an IA_PD response is received, and the message contains a prefix address, and the prefix address is a GUA address, only the message needs to be broadcast periodically.
[0051] Specifically, when allocating addresses on the LAN side, if an IA_PD response is received without a prefix address and the routing cascade flag is level one, a ULA prefix address is automatically generated. When an IA_PD response is received without a prefix address and the routing cascade flag is not level one, a ULA prefix address different from the message address prefix or the prefix in IA_NA needs to be automatically generated. Based on the generated LAN side ULA prefix, ip6tables is used to add corresponding rules in the NAT tag, as follows ip6tables-tnat-APOSTROUTING-sULAprefix / 64-oWAN-jMASQUERADE, to implement NAT66 forwarding. At the same time, according to the generated address, the RADVD prefix is updated, RA messages are broadcast regularly, and the M value is set to 0 and the O value is set to 0. At this time, the LAN side can automatically generate a ULA address, and the RA automatically carries the FE80 address of the LAN side interface br0 as the DNS address, so the IPV6 service data can be forwarded normally. When an IA_PD response is received with a prefix address and the prefix address is a GUA address, only messages need to be broadcast regularly.
[0052] The above-mentioned method, device, computer equipment and storage medium for automatically allocating ULA addresses to routers, by actively sending messages to the router, determine the listening state of the WAN port of IPV6, the listening state includes stateful listening or stateless listening; according to the listening state of the WAN port of IPV6, the prefix address of the message received by the WAN port of IPV6 and whether IA_NA can obtain the IPV6 address, the level of the router is obtained; according to the obtained level of the router, the address of the router is allocated. This application actively sends messages to the router, autonomously determines whether IPV6 is in stateful or stateless listening, determines the level of the router, and automatically allocates ULA addresses to the router, so that the secondary or multi-level routing equipment supports IPV6 services.
[0053] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0054] In one embodiment, a device for automatically allocating ULA addresses by a router is provided, and the device for automatically allocating ULA addresses by a router corresponds one-to-one to the method for automatically allocating ULA addresses by a router in the above embodiment. Figure 8 As shown, the device for automatically allocating ULA addresses by a router includes: a first judgment module, a second judgment module and a processing module. The detailed description of each functional module is as follows: The first judgment module is used to actively send a message to the router to determine the listening state of the WAN port of the IPv6, wherein the listening state includes stateful listening or stateless listening; Specifically, when the WAN port is connected to the network cable, if the router has IPV6 enabled, the router will actively send RS messages. Therefore, at this time, you only need to listen consistently on the IPV6-enabled WAN port to see if there is any RA message reception, and you can determine whether IPV6 is stateful or stateless listening. Among them, the RS message is used by the IPv6 host to find the router on the local link. After the host sends the RS message, it will trigger the router in the same network segment to immediately reply with a RA message to obtain prefix information, MTU information, etc., without waiting for the router to periodically send RA messages.
[0055] The second judgment module is used to obtain the level of the router according to the listening state of the IPV6 WAN port, the prefix address of the message received by the IPV6 WAN port, and whether IA_NA can obtain the IPV6 address; The processing module is used to allocate the address of the router according to the obtained level of the router.
[0056] Specifically, if the WAN port of IPV6 receives an RA message, the level of the router is obtained according to the prefix address of the RA message and whether IA_NA can obtain the IPV6 address. For example, when the prefix contained in the RA message is FC00:: / 7, it is considered a non-first-level route. If it does not contain a prefix, or the prefix address is a GUA prefix, it is considered a first-level route. If the IPV6 address is obtained through IA_NA, if the address is a GUA address, it is a first-level route. If it is a ULA address, it is considered a non-first-level route. The address is automatically assigned to the router according to whether the obtained route is a first-level route or a second-level route.
[0057] The specific definition of the device for automatically allocating ULA addresses by routers can be found in the above definition of the method for automatically allocating ULA addresses by routers, which will not be repeated here. Each module in the above-mentioned device for automatically allocating ULA addresses by routers can be implemented in whole or in part by software, hardware, and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0058] In one embodiment, a computer device is provided, which can be a server, and its internal structure diagram can be as follows: Fig. 9 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used for the router to automatically allocate ULA addresses. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for automatically allocating ULA addresses by a router is implemented.
[0059] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the method for automatically allocating ULA addresses by a router in the above embodiment is implemented, for example Figures 2 to 7 Alternatively, when the processor executes the computer program, the functions of each module / unit in the embodiment of the device for automatically allocating ULA addresses by the router are realized, for example Figure 8 The function of the router automatically allocating the ULA address is shown and will not be described again here to avoid repetition.
[0060] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for automatically allocating ULA addresses by a router in the above embodiment is implemented. For example, Figures 2 to 7 Alternatively, when the computer program is executed by the processor, the functions of each module / unit in the embodiment of the automatic allocation of ULA addresses by the router are realized, for example Figure 8 The function of the router automatically allocating the ULA address is shown and will not be described again here to avoid repetition.
[0061] Those of ordinary skill in the art will understand that all or part of the processes in the above-mentioned embodiments can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it may include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0062] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0063] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some of the technical features can be replaced by equivalents. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for automatically allocating ULA addresses by a router, characterized in that: include: Actively send a message to the router to determine the listening state of the WAN port of IPv6, wherein the listening state includes stateful listening or stateless listening; The router level is obtained based on the listening status of the IPv6 WAN port, the prefix address of the message received by the IPv6 WAN port, and whether IA_NA can obtain the IPv6 address. The address of the router is allocated according to the level of the router.
2. The method for automatically allocating ULA addresses by a router according to claim 1, characterized in that: The step of obtaining the level of the router according to the listening state of the WAN port of the IPv6, the prefix address of the message received by the WAN port of the IPv6, and whether the IA_NA can obtain the IPv6 address includes: Actively send messages to the router to check whether there are messages received at the IPV6 WAN port; If the IPv6 WAN port does not receive any messages for a long time, it means that the IPv6 WAN port is in stateful listening; When the WAN port of IPV6 is in stateful listening, DHCP6 sends DHCP6C with IA_NA and IA_PD parameters and sends an IPV6 address request to actively allocate an address to the router; If the IPv6 WAN port receives a message, it means that the IPv6 WAN port is in stateless listening; When the WAN port of IPV6 is in stateless listening, the level of the router is determined based on the address prefix contained in the message.
3. The method for automatically allocating ULA addresses by a router according to claim 1, characterized in that: Whether IA_NA can obtain the IPV6 address and the router level, including: If an IPV6 address is obtained through IA_NA, the router level is determined based on the obtained IPV6 address; If the IPV6 address is not obtained through IA_NA, the level of the router is determined based on the address prefix contained in the message.
4. The method for automatically allocating ULA addresses by a router according to claim 1, characterized in that: The level of the router is obtained according to the listening state of the WAN port of the IPv6, the prefix address of the message received by the WAN port of the IPv6, and whether the IA_NA can obtain the IPv6 address, and then includes: Storing the router level in a corresponding routing cascade flag; When the routing cascade flag is managed and the managed value is 1, the WAN port sends an IPV6 address request through the IA_NA included in DHCP6C; When the routing cascade flag is managed and the managed value is 0, the WAN port does not send the IPV6 address request through the IA_NA included in the DHCP6C; When the routing cascade flag is other and the value of other is 0, the WAN port obtains the IPV6DNS address through a DHCP6C request; When the routing cascade flag is other and the other value is 1, the IPV6DNS address is obtained through the other field in the message.
5. The method for automatically allocating ULA addresses by a router according to claim 1, characterized in that: The step of allocating the address of the router according to the obtained level of the router includes: Get the WAN address on the WAN side, write the obtained WAN address into the WAN side interface, and assign the address to the router LAN side.
6. The method for automatically allocating ULA addresses by a router according to claim 5, characterized in that: Obtain the WAN address on the WAN side and write the obtained WAN address to the WAN side interface, including: According to the managed value of the message received by the IPV6 WAN port, DHCP6C is called to obtain the corresponding IPV6 address or prefix; If the IPV6 address is obtained through the IA_NA in the message response, a WAN address is generated on the WAN side and written into the WAN side interface; If the IA_NA in the message response does not obtain the IPV6 address, you need to enable the autoconf function in the Linux kernel to automatically generate a WAN side address based on the message prefix and write the generated WAN side address to the WAN side interface.
7. The method for automatically allocating ULA addresses by a router according to claim 5, characterized in that: The step of obtaining a WAN address on the WAN side, writing the obtained WAN address into the WAN side interface, and allocating an address on the LAN side of the router includes: When an IA_PD response is received, there is no prefix address in the message, and the routing cascade flag is level one, a ULA prefix address is automatically generated; When an IA_PD response is received, there is no prefix address in the message, and the routing cascade flag is non-level 1, a ULA prefix address different from the message address prefix or the prefix in IA_NA needs to be generated; When an IA_PD response is received and the message contains a prefix address, and the prefix address is a GUA address, the message will be broadcast periodically.
8. A device for automatically allocating ULA addresses by a router, characterized in that: include: The first judgment module is used to actively send a message to the router to determine the listening state of the WAN port of the IPv6, wherein the listening state includes stateful listening or stateless listening; The second judgment module is used to obtain the level of the router according to the listening state of the IPV6 WAN port, the prefix address of the message received by the IPV6 WAN port, and whether IA_NA can obtain the IPV6 address; The processing module is used to allocate the address of the router according to the obtained level of the router.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method for automatically allocating a ULA address by a router according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for automatically allocating a ULA address by a router according to any one of claims 1 to 7 is implemented.