A method for realizing automatic identification of upper-level server priority using ipv6
By analyzing and filtering the option information in the RA packet and selecting a better ipv6 server for dialing, it solves the problems of routers constantly dialing and network instability caused by multiple ipv6 servers, and achieves higher network stability and dialing ease of use.
Patent Information
- Application Number
- CN202211422720.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-14
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2042-11-14
AI Technical Summary
In the presence of multiple ipv6 servers, the router receives multiple RA messages, resulting in constant dial-up, address and DNS information changes, resulting in network instability, and even problems such as unavailability to access the Internet.
By analyzing and filtering the option information in the RA packet, detecting its legitimacy, and selecting a better ipv6 server based on the priority information to re-dial. The specific steps include receiving RA data packets, analyzing and filtering illegal packets, judging and selecting a better server based on priority, and selecting a dhcp6s server based on the source mac information of the selected RA data packet for re-dial.
By optimizing the processing and dialing policy of RA packets, unnecessary dialing operations are reduced, network stability and dialing ease of use are improved, and dialing-up problems caused by multiple servers are avoided.
Smart Images

Figure CN115766597B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of network connection, and in particular to a method for realizing automatic identification of the priority of an upper-level server by IPv6. Background Art
[0002] With the continuous updating of network equipment, there may be a variety of complex environments in real life. For example, when there are multiple IPv6 servers at the upper level, the device needs to be more intelligent to select a server that can be used and give priority to the corresponding server, which becomes a problem that needs to be solved.
[0003] RA (Router Advertisment) is a type of ICMPV6, the basic protocol in IPv6 messages. Routers periodically send Router Advertisement messages, and Router Advertisement messages can also be sent as responses to Router Request messages received from hosts. Each RA message may contain prefix information, link configuration, DNS, and IPv6 protocol parameters. Router Advertisement messages indicate the existence of routers and that the routers are willing to forward packets. Thus, RA messages also contain information about the transmitting router itself.
[0004] At present, the most direct and effective solution is to implement the corresponding dial-up strategy according to the RA message priority of the server. In real life, there are still problems:
[0005] When there are multiple IPv6 servers above the router, each server will send its own RA message to the router. If the router receives multiple RA packets, it will cause the router to dial continuously, change the address and DNS information, and cause network instability. If the information in the RA sent by the upper IPv6 server is illegal, there may even be a problem that IPv6 cannot access the Internet. Due to this phenomenon, some methods are urgently needed to optimize and improve the stability and market competitiveness of the product. Summary of the invention
[0006] The invention provides a method for realizing automatic identification of the priority of an upper-level server by IPv6, aiming to solve the problems existing in the prior art.
[0007] The present invention provides a method for realizing automatic identification of the priority of an upper-level server by IPv6, comprising the following steps:
[0008] S1. The router receives RA packets from multiple IPv6 servers, parses the option information in the RA packets, performs legitimacy detection, and filters out illegal RA packets;
[0009] S2. According to the priority information of the legitimate RA data packet, the priority is determined and the RA data packet of the ipv6 server with higher priority is selected;
[0010] S3. According to the source mac information of the selected RA data packet, select the dhcp6s server for redialing.
[0011] As a further improvement of the present invention, in step S1, the process of parsing the RA data packet and checking the legitimacy specifically includes:
[0012] S11. Check the legitimacy of the source address of the received RA packet. If it is not a link-local address, filter the RA packet.
[0013] S12 receives the RA data packet after preliminary filtering and obtains the message information, and parses the option field information in the RA data packet;
[0014] S13. Check the legitimacy of the parsed option information and filter out illegal RA packets.
[0015] As a further improvement of the present invention, the step S11 further includes: filtering the RA data packets in the lan side direction with the device name being br0.
[0016] As a further improvement of the present invention, the process of determining the legality of the option information in step S13 specifically includes:
[0017] If the M flag of the RA data packet is 0 and does not contain prefix address information, the RA data packet is filtered; if the RA data packet contains prefix information, the length of the prefix information and the length of the prefix address are judged to be legal. If the length is too short, the RA data packet is filtered.
[0018] As a further improvement of the present invention, in step S2, the process of priority determination specifically includes:
[0019] S21 determines whether the RA packets of multiple ipv6 servers come from the same superior server, if so, execute step S3; if not, execute step S22;
[0020] S22. Compare the priority information field of the option information in the RA data packet. If the received priority information field level is lower than or equal to the existing priority information field level in the router, filter the RA data packet; if the received priority information field level is higher than the existing priority information field level in the router, select the information in the high-priority RA data packet as the dial-up information.
[0021] As a further improvement of the present invention, in step S22, there is a priority information field AdvDefaultPreference in the RA data packet, and the higher the priority of the RA data packet, the smaller the value of AdvDefaultPreference.
[0022] As a further improvement of the present invention, step S3 specifically includes:
[0023] S31. The router deletes the old address and routing information, and configures the address and routing information based on the RA packet of the preferred ipv6 server;
[0024] S32. Send the option information of the RA data packet to the upper layer process through the socket, and re-pull the dhcp6c process;
[0025] S33 determines whether the M mark in the RA packet is 1 or 0. If the M mark is 1, dhcp6c obtains the address and configures other information; if the M mark is 0, dhcp6c configures other information;
[0026] S34. The router receives the dhcp6c message and determines whether its source mac information is the same as the source mac information in the RA data. If not, the router filters the dhcp6c message; if they are the same, the router interacts with the dhcp6c message and obtains the address and routing information in dhcpv6, restarts the dhcp6s process, and dials on the LAN side.
[0027] As a further improvement of the present invention, in step S33, the router performs stateful or stateless dialing according to the M and O tags in the RA data packet.
[0028] As a further improvement of the present invention, the execution process of steps S1 to S3 also includes the following execution conditions:
[0029] If the router receives RA packets of multiple priorities from the same IPv6 server, the router will parse and dial the RA packet received first, and then replace the RA packet with a higher priority based on the priority.
[0030] The beneficial effects of the present invention are as follows: through the priority in the RA routing advertisement message, illegal and low-priority RA data packets are filtered, so that the server and RA data packets can be better selected, and the problem of repeated dialing and abnormal Internet access caused by the home router in the case of multiple IPv6 servers and a single server sending multiple RAs is solved. The Internet access stability and dial-up usability are improved, and there is no need to worry about a series of dial-up Internet access problems caused by multiple servers. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 This is the main flow chart of the priority of the ipv6 automatic identification of the upper server in the present invention
[0032] Figure 2 It is a priority determination flow chart of the ipv6 automatic identification of the upper-level server in the present invention;
[0033] Figure 3 It is a dialing flow chart of the ipv6 automatic identification of the upper server in the present invention. DETAILED DESCRIPTION
[0034] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.
[0035] Network stability has always been the most important feature to be considered when designing a home router. The present invention is mainly to solve the problem of multiple IPv6 servers, so that the router can dial up to the Internet normally. By identifying the priority of the upper server, a server with a high priority is selected, such as Figure 1 As shown; the main steps are:
[0036] S1. The router receives RA packets from multiple upstream IPv6 servers, parses the option information in the RA packets, performs legitimacy checks, and filters out illegal RA packets.
[0037] In step S1, the process of parsing the RA data packet and checking the legitimacy specifically includes:
[0038] S11. The legitimacy of the source address of the received RA data packet is judged. If it is not a local link address, the RA data packet is filtered; the RA data packet with the device name br0 and the LAN side direction is filtered.
[0039] S12 receives the RA data packet after preliminary filtering and obtains the message information, and parses the option field information in the RA data packet;
[0040] S13. Check the legality of the parsed option information and filter out illegal RA packets. Specifically, if the M flag of the RA packet is 0 and does not contain prefix address information, filter the RA packet; if the RA packet contains prefix information, check whether the length of the prefix information and the length of the prefix address are legal. If the length is too short, filter the RA packet. The length of the prefix information must include the first 2 bytes of the address. If it is less than 16 bytes, it is judged to be too short.
[0041] S2. According to the priority information of the legitimate RA data packet, a priority judgment is made and a higher priority IPv6 server RA data packet is selected.
[0042] In step S2, the priority determination process specifically includes:
[0043] S21 determines whether the RA packets of multiple ipv6 servers come from the same superior server, if so, execute step S3; if not, execute step S22;
[0044] S22. Compare the priority information field of the option information in the RA data packet. If the received priority information field level is lower than or equal to the existing priority information field level in the router, filter the RA data packet; if the received priority information field level is higher than the existing priority information field level in the router, select the information in the high-priority RA data packet as the dial-up information.
[0045] There is a priority information field AdvDefaultPreference in the RA data packet. The higher the priority of the RA data packet, the smaller the value of AdvDefaultPreference.
[0046] Assume that the superior now has four ipv6 servers with priorities of low, medium, high, and high respectively.
[0047] like Figure 2 As shown, in the RA message, there is a priority information field AdvDefaultPreference, which are low, invalid, medium and high (0x3, 0x2, 0x0 and 0x1), respectively. For the invalid priority, it will be set to medium. For the first dialing, if the RA messages sent by the four upper servers have passed the legitimacy judgment, it is assumed that the priority AdvDefaultPreference in the option information of the RA message is medium. At this time, the server is dialed. Later, RA messages with low and high priorities are received from other servers. At this time, the source mac of RA is judged to see if it is consistent with the mac in the server with medium priority. If they come from the same server, the priority is compared. The higher the priority, the smaller the value of AdvDefaultPreference (except the value of medium), and the smaller the value, the higher the priority. The information in the RA data packet with high priority is used for dialing, and the old address and routing information are deleted. If there is another high priority server behind, it will be filtered because it has the same priority as the current RA.
[0048] S3. According to the source mac information of the selected RA data packet, select the dhcp6s server for redialing.
[0049] Step S3 specifically includes:
[0050] S31. The router deletes the old address and routing information, and configures the address and routing information based on the RA packet of the preferred ipv6 server;
[0051] S32. Send the option information of the RA data packet to the upper layer process through the socket, and re-pull the dhcp6c process;
[0052] S33 determines whether the M mark in the RA packet is 1 or 0. If the M mark is 1, dhcp6c obtains the address and configures other information; if the M mark is 0, dhcp6c configures other information, mainly dns information;
[0053] S34. The router receives the dhcp6c message and determines whether its source mac information is the same as the source mac information in the RA data. If not, the router filters the dhcp6c message; if they are the same, the router interacts with the dhcp6c message and obtains the address and routing information in dhcpv6, restarts the dhcp6s process, and dials on the LAN side.
[0054] Specific as Figure 3 As shown, after receiving the new high-priority server RA, redial, at this time the old address and routing information are deleted, the prefix information in the new RA is used to generate an ipv6 address, and the routing information is re-adapted; at the same time, the option information of the RA is sent to the upper-layer process through the socket, and the dhcp6c process is re-pulled to perform stateful or stateless dialing according to the M and O marks in the RA. Of course, there are dhcpv6 servers for multiple ipv6 servers. At this time, dhcp6c also needs to interact with the messages sent by multiple dhcp6s. The option information in the RA packet is sent to the upper layer before, so at this time dhcp6c ensures that the interactive dhcpv6 messages and RA packets come from the same server based on the provided RA source mac information, and multiple dhcp6s servers are resolved; at this time, the address, dns and other information in dhcpv6 are obtained, and then the dhcp6s and radvd processes are re-pulled to dial the lan side.
[0055] The execution process of steps S1 to S3 also includes the following execution conditions:
[0056] If the router receives RA packets of multiple priorities from the same IPv6 server, the router will parse and dial the first received RA packet, and then replace the RA packet with a higher priority based on the priority judgment. That is, the RA packet with the priority received first will be used.
[0057] Compared with the prior art, the method of the present invention has the following three improvements:
[0058] ① The legitimacy of the option information in the RA data packet is checked;
[0059] ② Select a better server based on the priority information of the RA data packet;
[0060] ③ According to the source mac information of the RA data packet, select the dhcp6s server to prevent confusion caused by dhcp6c dialing, and further improve the stability of multi-ipv6 server dialing.
[0061] The above contents are further detailed descriptions of the present invention in combination with specific preferred embodiments, and it cannot be determined that the specific implementation of the present invention is limited to these descriptions. For ordinary technicians in the technical field to which the present invention belongs, several simple deductions or substitutions can be made without departing from the concept of the present invention, which should be regarded as falling within the protection scope of the present invention.
Claims
1. A method for realizing automatic identification of upper-level server priority by ipv6, characterized in that: The following steps are involved: S1. The router receives RA packets from multiple IPv6 servers, parses the option information in the RA packets, performs legitimacy detection, and filters out illegal RA packets; S2. According to the priority information of the legitimate RA data packet, the priority is determined and the RA data packet of the ipv6 server with higher priority is selected; S3. Select the dhcp6s server to redial based on the source mac information of the selected RA packet; In step S1, the process of parsing the RA data packet and checking the legitimacy specifically includes: S11. Check the legitimacy of the source address of the received RA packet. If it is not a link-local address, filter the RA packet. S12 receives the RA data packet after preliminary filtering and obtains the message information, and parses the option field information in the RA data packet; S13. Check the legitimacy of the parsed option information and filter out illegal RA packets; The process of determining the legality of option information in step S13 specifically includes: If the M flag of the RA data packet is 0 and does not contain prefix address information, the RA data packet is filtered; if the RA data packet contains prefix information, the length of the prefix information and the length of the prefix address are judged to be legal, and if the length is too short, the RA data packet is filtered; In step S2, the priority determination process specifically includes: S21 determines whether the RA packets of multiple ipv6 servers come from the same superior server, if so, execute step S3; if not, execute step S22; S22 compares the priority information field of the option information in the RA packet. If the received priority information field level is lower than or equal to the priority information field level already in the router, the RA packet is filtered; if the received priority information field level is higher than the priority information field level already in the router, the information in the high priority RA packet is selected as the dial-up information; The step S3 specifically includes: S31. The router deletes the old address and routing information, and selects a more preferred ipv6 server RA packet for address and routing information configuration; S32. Send the option information of the RA data packet to the upper layer process through the socket, and re-pull the dhcp6c process; S33 determines whether the M mark in the RA packet is 1 or 0. If the M mark is 1, dhcp6c obtains the address and configures other information; if the M mark is 0, dhcp6c configures other information; S34. The router receives the dhcp6c message and determines whether its source mac information is the same as the source mac information in the RA data. If they are different, the router filters the dhcp6c message; if they are the same, the router interacts with the dhcp6c message and obtains the address and routing information in dhcpv6, restarts the dhcp6s process, and dials on the LAN side.
2. The method for realizing automatic identification of the priority of the upper-level server by ipv6 according to claim 1 is characterized in that: The step S11 further includes: filtering RA data packets in the lan direction with the device name being br0.
3. The method for realizing automatic identification of the priority of the upper-level server by ipv6 according to claim 1 is characterized in that: In step S22, there is a priority information field AdvDefaultPreference in the RA data packet. The higher the priority of the RA data packet, the smaller the value of AdvDefaultPreference.
4. The method for realizing automatic identification of the priority of the upper-level server by ipv6 according to claim 1 is characterized in that: In step S33, the router performs stateful or stateless dialing according to the M and O tags in the RA data packet.
5. The method for realizing automatic identification of the priority of the upper-level server by ipv6 according to claim 1 is characterized in that: The execution process of steps S1 to S3 also includes the following execution conditions: If the router receives RA packets of multiple priorities from the same IPv6 server, the router will parse and dial the RA packet received first, and then replace the RA packet with a higher priority based on the priority.
Citation Information
Patent Citations
IPv6 address collocation method, IPv6 client and server
CN103561122A
Device and method for dynamic data injection in VPDN(Virtual Private Dial-up Network)
CN103685310A