CN114938347B - Router and router ipv6 self-adaption method and device - Google Patents

Router and router ipv6 self-adaption method and device Download PDF

Info

Publication number
CN114938347B
CN114938347B CN202110153628.5A CN202110153628A CN114938347B CN 114938347 B CN114938347 B CN 114938347B CN 202110153628 A CN202110153628 A CN 202110153628A CN 114938347 B CN114938347 B CN 114938347B
Authority
CN
China
Prior art keywords
router
wan
ipv6
mode
lan
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110153628.5A
Other languages
Chinese (zh)
Other versions
CN114938347A (en
Inventor
徐清华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hisense Broadband Multimedia Technology Co Ltd
Original Assignee
Hisense Broadband Multimedia Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hisense Broadband Multimedia Technology Co Ltd filed Critical Hisense Broadband Multimedia Technology Co Ltd
Priority to CN202110153628.5A priority Critical patent/CN114938347B/en
Publication of CN114938347A publication Critical patent/CN114938347A/en
Application granted granted Critical
Publication of CN114938347B publication Critical patent/CN114938347B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/741Routing in networks with a plurality of addressing schemes, e.g. with both IPv4 and IPv6
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/12Discovery or management of network topologies

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses a router and a router ipv6 self-adaptation method and device. And by setting bridge BR0 and WAN interfaces to the router and adding all LANs into the bridge ipv6 self-adapting method, creating bridge subinterfaces to connect with WAN subinterfaces and adding bridge BR0. Creating a routing sub-interface, allowing the bridge interface BR0 and the routing sub-interface to be routed to realize that the router automatically supports ipv6 forwarding.

Description

Router and router ipv6 self-adaption method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a router and an ipv6 adaptive method and apparatus for the router.
Background
The ipv6 (Internet Protocol Version, internet protocol version 6) has an integrated security function, the number of addresses is very large, and the problems like ipv4 (Internet Protocol Version, internet protocol version 4) nat (Network Address Translation, network address conversion) are avoided, so that in practical application, the ipv6 generally does not use nat technology. In contrast to ipv4, when ipv4 is used in the routing mode of the router device, the operator only needs to allocate one ipv4 segment address to access the external network, and when ipv6 is used, two segments (the segments of ipv6 shall be referred to as prefixes according to the ipv6 specification, and are described directly by prefixes hereinafter) need to be allocated for local area network and external network routing, respectively.
Currently, an operator commonly uses HGU equipment in an FTTH network as gateway equipment of a terminal connection external network, and also distributes the ipv6 prefixes of two network segments, and when user terminal equipment is directly connected to the HGU equipment, the requirement of ipv6 surfing can be met. With the development of WIFI and the improvement of the wireless capability requirement of people on terminals, the HGU devices currently laid out for a long time and before are limited in capability, and cannot meet the requirements of users, so users generally mount a router device under the HGU for improving the performance.
However, since the HGU device does not support secondary allocation of two ipv6 prefixes, when the router is directly hung on the HGU device, ipv6 is only supported in the case that the router device is in the bridge mode+the HGU device is in the routing mode, or in the case that the router device is in the bridge mode+the HGU device is in the routing mode. Because the current transition period from ipv4 to ipv6 generally needs to support both ipv4 and ipv6 dual stacks, and ipv6 and ipv4 share a route/bridge mode configuration, the configuration of ipv6 may affect the usage scenario of ipv 4.
Disclosure of Invention
The application provides a router and a router ipv6 self-adaption method to realize router ipv6 self-adaption.
In order to solve the technical problems, the embodiment of the application discloses the following technical scheme:
In a first aspect, an embodiment of the present application discloses a router ipv6 adaptive method, including:
initializing and setting the router state and the router use mode;
Sending an RS message in an SLAAC mode to a server to apply for obtaining a WAN address, and recording the WAN state of a router according to the result of obtaining the WAN address;
Sending a DHCPv6-PD request to the server to acquire the LAN prefix, and recording the LAN state of the router according to the result of acquiring the LAN prefix;
And configuring a router use mode according to the router WAN state and the router LAN state.
Compared with the prior art, the application has the beneficial effects that:
the application provides a router ipv6 self-adaption method, which is used for initializing and setting a router state and a router use mode, so that the router is initially adapted to a common routing mode. The router applies WAN address and LAN prefix to the server, updates the router state according to the acquired result, and detects the pd supporting capability of the server. And configuring the router use mode according to the current state of the router so as to adapt to different environments. The router ipv6 self-adaption method provided by the application judges whether the router ip 6 self-adaption method supports allocation of two prefixes by detecting the pd supporting capability of the server, and further selects a proper router forwarding mode, so that router ipv6 self-adaption is realized, and the performance of the router is improved.
In a second aspect, an embodiment of the present application discloses an ipv6 adaptive device, including: the initialization module is used for initializing and setting the router state and the router use mode;
The WAN address acquisition module is used for sending an RS message in an SLAAC mode to the server to apply for acquiring the WAN address, and recording the WAN state of the router according to the result of acquiring the WAN address;
the LAN prefix acquisition module is used for sending a DHCPv6-PD request to the server to acquire the LAN prefix, and recording the LAN state of the router according to the result of acquiring the LAN prefix;
And the mode configuration module is used for configuring a router use mode according to the router WAN state and the router LAN state.
Compared with the prior art, the application has the beneficial effects that:
The application also provides an ipv6 self-adapting device, comprising: and the initialization module is used for initializing and setting the router state and the router use mode. The WAN address acquisition module is used for sending an RS message in an SLAAC mode to the server to apply for acquiring the WAN address, and recording the WAN state of the router according to the result of acquiring the WAN address. And the LAN prefix acquisition module is used for sending a DHCPv6-PD request to the server for acquiring the LAN prefix and recording the LAN state of the router according to the result of acquiring the LAN prefix. And the mode configuration module is used for configuring a router use mode according to the router WAN state and the router LAN state. The ipv6 self-adaptive device provided by the application judges whether the device supports allocation of two prefixes or not by detecting the pd supporting capability of the server, and then selects a proper router forwarding mode, thereby realizing router ipv6 self-adaptation and improving the performance of the router.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application as claimed.
Drawings
In order to more clearly illustrate the technical solution of the present application, the drawings that are needed in the embodiments will be briefly described below, and it will be obvious to those skilled in the art that other drawings can be obtained from these drawings without inventive effort.
Fig. 1 is a schematic diagram of an application scenario of a router according to an embodiment of the present application;
fig. 2 is a schematic diagram of a router status acquisition flow according to an embodiment of the present application;
fig. 3 is a schematic flow chart of a router configuration usage mode according to a router state according to an embodiment of the present application;
Fig. 4 is a schematic diagram of a configuration structure of a router ipv6 and ipv4 sharing route/bridge mode according to an embodiment of the present application;
Fig. 5 is a schematic diagram of an uplink forwarding path of a message in a router according to an embodiment of the present application;
fig. 6 is a schematic diagram of a downstream forwarding path of a packet in a router according to an embodiment of the present application.
Detailed Description
In order to make the technical solution of the present application better understood by those skilled in the art, the technical solution of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are only some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
Fig. 1 is a schematic diagram of an application scenario of a router according to an embodiment of the present application. As shown in fig. 1, currently, an HGU (Home Gateway Unit ) device is commonly used by an operator in a network as a gateway device for connecting a terminal to an external network, and is also allocated with an ipv6 prefix of two network segments, where when a user terminal device is directly connected to the HGU device, an ipv6 internet surfing requirement can be satisfied. With the development of WIFI and the improvement of the wireless capability requirement of people on terminals, the HGU devices laid out in the current and previous long periods of time are limited in capability and cannot meet the requirements of users, so users generally mount a router under the HGU for improving the performance.
However, since the HGU device does not support secondary allocation of two ipv6 prefixes, when the router is directly hung on the HGU device, ipv6 is only supported in the case that the router is in the bridge mode+the HGU device is in the routing mode, or in the case that the router is in the bridge mode+the HGU device is in the routing mode. Because the current transition period from ipv4 to ipv6 generally needs to support both ipv4 and ipv6 dual stack, and ipv6 and ipv4 share a route/bridge mode configuration, the configuration of router ipv6 may affect the usage scenario of ipv 4.
There are two ways of assigning prefixes and addresses by ipv6, one is stateless configuration prefix, using icmpv (Internet Control Managemet Protocol Version, version six of the internet control information protocol) ra (Router Advertisment) message to carry prefix information, and the other is stateful configuration prefix, directly assigning addresses using dhcpv (Dynamic Host Configuration Protocol for IPv, dynamic host configuration protocol) NA option, or assigning prefixes using dhcpv6 pd. When the HGU is configured by the front operator, the HGU wan (Wide Area Network ) side is assigned an address using a stateless configuration or dhcpv na, the LAN (Local Area Network ) side is assigned a prefix using the dhcpv PD option, and the prefix is eventually assigned to the user's internet device. While the HGU only supports stateless configuration and dhcpv na when assigning prefixes to user internet surfing devices.
Fig. 2 is a schematic flow chart of obtaining a router state according to an embodiment of the present application, and fig. 3 is a schematic flow chart of configuring a usage mode of a router according to the router state according to an embodiment of the present application. As shown in fig. 2 and fig. 3, the router pattern automatic matching process provided in the embodiment of the present application includes:
S0: and detecting the current use state of the router, and detecting whether the current use mode of the router is a routing mode or not. If the current usage pattern of the router is a routing pattern, the next step is performed. If the detection result is no, the router is currently set to the [ ipv4 bridge+ipv 6 bridge ] mode.
S1: and initializing and configuring the router state. The initialization state is [ WAN ipv6 address is being acquired ], [ LAN ipv6 prefix is being acquired ], and the router is set to be in a [ ipv4 route+ipv 6 route ] mode.
S2: and simultaneously performing a WAN address acquisition process and a LAN prefix acquisition process, and recording the router state according to the acquisition result.
S20: and acquiring the WAN address, and recording the WAN state of the router according to the result of acquiring the WAN address.
S201: the router sends a stateless address auto-configuration (STATELESS ADDRESS autoconfiguration, slaac) message to the server.
S202: if the router fails to receive the response message from the server, a random delay period is used to send a request, and the router maintains the current state unchanged during the request, i.e. the WAN state is [ WAN ipv6 address is being acquired ]. The cycle time can be set according to the actual scene requirement and is generally set to be 3-6 s.
S203: if the router receives the server response message, judging whether the address needs to be acquired in a stateful mode according to the M-FLAG mark of the response message.
S2031: if M-FLAG is 0, directly obtaining WAN address prefix from the response message, automatically generating legal Ipv6 global unicast address, and recording the WAN state of the router as [ WAN Ipv6 address acquisition success ]. If the response message does not carry or carries the prefix illegally, the WAN state of the router is recorded as [ WAN ipv6 address acquisition failure ].
S2032: if M-FLAG is 1, the router sends dhcpv NA address requests to the server.
S20321: if the server does not respond to dhcpv NA requests, a 5s+ random delay period sends dhcpv NA requests, during which the current state is maintained, i.e., the router WAN state is recorded as [ WAN ipv6 address is being acquired ].
S20322: if the server responds DHCPv NA request, after the router and the server complete all interactions of DHCPv6-NA, the server issues a response message to the router, and the router obtains the address from the response message.
If the router can successfully acquire the legal ipv6 global unicast address from the response message, the WAN state of the router is recorded as [ WAN ipv6 address acquisition is successful ].
If the server response message does not support or is illegally distributed with the address, the WAN state of the router is recorded as [ WAN ipv6 address acquisition failure ].
S21: and acquiring the LAN address, and recording the router LAN state according to the result of acquiring the LAN address.
S211: the router sends a DHCPv6-PD request to the server.
S212: if the server does not respond, a DHCPv6-PD request is sent for a 5s+ random delay period, during which the current mode is unchanged, i.e., the router LAN state is recorded as [ LAN ipv6 prefix is being acquired ].
S213: if the server responds, the router continues to interact with the server with the DHCPv6-PD.
After the interaction is completed, if the router successfully acquires the legal ipv6 global unicast prefix from the server message, the router state is recorded as [ LAN ipv6 prefix acquisition is successful ].
If the prefix is not supported or distributed illegally in the response message of the server, the router state is recorded as [ LAN ipv6 prefix acquisition failure ].
S3: the router usage pattern is configured according to the router state.
If the router WAN status is [ LAN ipv6 prefix is acquiring ] or the router LAN status is [ WAN ipv6 address is acquiring ], the current mode of the router is maintained unchanged, namely the mode of the router is [ ipv4 route+ipv 6 route ].
If the router WAN status is [ WAN ipv6 address acquisition success ] and the router LAN status is [ LAN ipv6 prefix acquisition success ], the router is configured to use the [ ipv4 route+ipv 6 route ] mode.
If the router WAN status is [ WAN ipv6 address acquisition success ] and the router LAN status is [ LAN ipv6 prefix acquisition failure ], the router is configured to use [ ipv4 route+ipv 6 bridge ] mode.
If the router WAN status is [ WAN ipv6 address acquisition failure ], the router mode is maintained unchanged.
According to the embodiment of the application, the router state is initialized, the server WAN address and the LAN prefix are acquired, the current state of the router is recorded according to the acquired result, and the router mode configuration is carried out according to the current state of the router. By detecting the pd supporting capability of the server, whether the server supports allocation of two prefixes is judged, and further, which router mode is used is determined. If the router usage mode is [ ipv4 route+ipv 6 bridge ] mode, performing ipv4/ipv6 route bridge mode isolation configuration on the router.
The application provides a router ipv6 self-adaption method, which is used for initializing and setting a router state and a router use mode, so that the router is initially adapted to a common routing mode. Sending an RS message in an SLAAC mode to a server to apply for obtaining a WAN address, and recording the WAN state of a router according to the result of obtaining the WAN address; and sending a DHCPv6-PD request to the server to acquire the LAN prefix, and recording the LAN state of the router according to the result of acquiring the LAN prefix, thereby detecting the PD supporting capability of the server. And configuring the router use mode according to the current state of the router so as to adapt to different environments. The router ipv6 self-adaption method provided by the application judges whether the router ip 6 self-adaption method supports allocation of two prefixes by detecting the pd supporting capability of the server, and further selects a proper router forwarding mode, so that router ipv6 self-adaption is realized, and the performance of the router is improved.
Furthermore, the application also provides a routing bridge mode isolation configuration method of the ipv4/ipv 6. Fig. 4 is a schematic diagram of a router ipv6 and ipv4 common route/bridge mode configuration, as shown in fig. 4, according to an embodiment of the present application, in order to implement the router ipv6 and ipv4 common route/bridge mode, the embodiment of the present application provides a router configured to:
The MAIN WAN interface MAIN-WAN is characterized by that it is connected with correspondent interface of physical port of external network (WAN), and the message sent by said interface can be directly used for sending packet by means of WAN physical port, and the message received by WAN physical port can use the packet-receiving function of MAIN-WAN. The MAIN-WAN does not participate in routing and bridge forwarding.
WAN SUB-interface SUB-WAN is virtual interface of vlan (Virtual Local Area Network ) based on assigned vlan id of WAN MAIN interface MAIN-WAN. The method is characterized in that a message sent from a WAN SUB-interface SUB-WAN is added with VLAN HEADER of appointed vlan id, and then a packet sending function of a WAN MAIN interface MAIN-WAN is called to send the message. When the vlan id carried by the message sent by the WAN SUB-interface SUB-WAN and received by the WAN MAIN interface MAIN-WAN is the vlan id designated by the WAN SUB-interface SUB-WAN, the vlan in the message is stripped and the packet receiving function of the WAN SUB-interface SUB-WAN is called. Especially if the WAN side message does not need to specify VLAN id, the message sent by WAN SUB-interface SUB-WAN directly calls WAN MAIN interface MAIN-WAN to send packet, if the message received by WAN MAIN interface MAIN-WAN does not carry VLAN, then calls WAN SUB-WAN to receive packet. Parameters such as MTU of WAN SUB-interface SUB-WAN are limited by MAIN-WAN when setting. The SUB-WAN does not participate in routing and bridge forwarding.
The two sub-interfaces include: the routing WAN SUB-interface R-SUB-WAN and the bridge WAN SUB-interface B-SUB-WAN are in communication with the WAN SUB-interface SUB-WAN. The method is mainly characterized in that a message sent to a WAN side by a WAN SUB-interface R-SUB-WAN and a bridge WAN SUB-interface B-SUB-WAN is directly converted into a WAN SUB-interface SUB-WAN packet. And the router forwards the message according to the message content and the router mode.
In some embodiments, the WAN SUB-interface SUB-WAN receives a message to configure the router: if the message received by the WAN SUB-interface SUB-WAN is an ipv4 message and the router is in an ipv4 routing mode, the message is forwarded to the WAN SUB-interface R-SUB-WAN for receiving; if the message received by the WAN SUB-interface SUB-WAN is an ipv4 message and the router is currently in an ipv4 bridge mode, the message is transferred to the bridge WAN SUB-interface B-SUB-WAN for receiving; if the message received by the WAN SUB-interface SUB-WAN is an ipv6 message and the router is in an ipv6 routing mode, the message is forwarded to the WAN SUB-interface R-SUB-WAN for receiving; if the message received by the WAN SUB-interface SUB-WAN is an ipv6 message and the router is currently in an ipv6 bridge mode, the message is transferred to the WAN SUB-interface B-SUB-WAN for receiving.
In the embodiment of the application, the routing WAN subinterface R-SUB-WAN can be configured ip and can participate in routing forwarding. The bridge WAN subinterface B-SUB-WAN may participate in bridge forwarding. Parameters such as maximum transmission unit (Maximum Transmission Unit, MTU) of the routing WAN SUB-interface R-SUB-WAN and bridge WAN SUB-interface B-SUB-WAN are limited by WAN SUB-interface SUB-WAN when set.
Each physical LAN port creates a LAN interface, namely LAN1 and LAN 2-LANX, which is the interface corresponding to the physical port of the connection intranet. The message sent by the interface can be directly sent by using the LAN physical port, and the message received by the LAN physical port can use the corresponding LANX packet receiving function. The LAN interface may participate in route forwarding.
The bridge is created, and is characterized in that an interface mounted under the bridge is forwarded according to MAC, and a bridge interface BR0 is automatically generated, and the bridge interface BR0 is automatically mounted under the bridge and used as a local area network gateway, ip can be configured, and the bridge interface BR0 can also participate in route forwarding. The following BR0 refers to the bridge BR0 and the bridge interface BR0, respectively, as described.
All LAN interfaces LAN1, LAN 2-LANX are mounted under bridge BR0, and bridge WAN subinterfaces B-SUB-WAN are also mounted under bridge BR 0.
With the above configuration, the router provided by the embodiment of the present application includes: and the WAN sub-interface is configured to select a forwarding path according to the received message type of the external network and the current mode of the router. Bridge BR0, it downloads at least one intranet interface. And a bridge interface BR 0is mounted under the bridge BR0 to participate in bridge forwarding. A bridge WAN sub-interface, which is mounted under the bridge BR0 and can participate in bridge forwarding; the WAN subinterface is routed. Wherein: the bridge port BR0 and routing WAN subinterfaces may be used for route forwarding. The routing WAN sub-interface and the bridge WAN sub-interface directly convert the message sent to the WAN side into the WAN sub-interface to send a packet; and the WAN sub-interface receives the message, and selects the routing WAN sub-interface or the bridge WAN sub-interface to forward the message according to the message content and the router mode. The router provided by the embodiment of the application realizes the isolation of the router of the ipv4/ipv6 and the bridge path by configuring two virtual interface router WAN subinterfaces and bridge WAN subinterfaces to respectively perform the router forwarding and the bridge forwarding.
One side of the WAN main interface is connected with an external network physical port, and the other side of the WAN main interface is connected with a WAN sub-interface; the WAN subinterface is a virtual interface of the WAN main interface, and the message downlink path is configured as follows:
If the message received by the WAN sub-interface is an ipv4 message and the ipv4 mode of the router is an ipv4 routing mode, the message is forwarded to the WAN sub-interface for receiving;
If the message received by the WAN subinterface is an ipv4 message and the ipv4 mode of the router is an ipv4 bridge mode, the message is received by the WAN subinterface;
or alternatively, the first and second heat exchangers may be,
If the message received by the WAN subinterface is an ipv6 message and the ipv6 mode of the router is an ipv6 routing mode, the message is forwarded to the WAN subinterface for receiving;
If the message received by the WAN subinterface is an ipv6 message and the ipv6 mode of the router is an ipv6 bridge mode, the message is received by the WAN subinterface.
Further, if the WAN side message does not need to specify vlan id, the message sent by the WAN sub-interface directly calls the WAN main interface to send a packet; and if the message received by the WAN main interface does not carry VLAN, calling the WAN sub-interface to receive the packet.
Further, in the embodiment of the present application, a packet sent from the WAN subinterface is added with VLAN HEADER designating vlan id, and then the packet sending function of the WAN main interface is called to send the packet. When the vlan id carried by the message sent by the WAN sub-interface and received by the WAN main interface is the vlan id appointed by the WAN sub-interface, the vlan in the message is stripped and a packet receiving function of the WAN sub-interface is called.
The router provided by the embodiment of the application realizes the isolation of the router of the ipv4/ipv6 and the bridge path by configuring two virtual interface router WAN subinterfaces and bridge WAN subinterfaces to respectively perform the router forwarding and the bridge forwarding.
Fig. 5 is a schematic diagram of an uplink forwarding path of a packet in a router according to an embodiment of the present application. As shown in fig. 5, according to the above configuration, the uplink forwarding path of the packet in the router provided by the embodiment of the present application is as follows:
And uplink forwarding is a forwarding path for receiving packets at the LAN side. In this embodiment, LANX is taken as an example, and other LAN ports have the same processing logic.
A1: and sending a message to the LANX interface at the intranet physical port X.
A2: the LANX interface receives the message from the corresponding intranet physical port X, firstly carries out the bridge forwarding flow, firstly searches the mac table, and finds the interface to which the destination mac belongs.
A2-1: if the searched interface is a bridge WAN SUB-interface B-SUB-WAN, or the message is an unknown unicast message, or the message is a broadcast message, forwarding permission judgment is carried out.
Wherein: the forwarding permission judgment includes:
(1) If the packet received by the LANX interface is an ipv6 packet and the current mode of the router is an ipv6 bridge mode, determining that forwarding is allowed. If the packet received by the LANX interface is an ipv6 packet and the current router mode is an ipv6 routing mode, it is determined that forwarding is prohibited.
(2) If the packet received by the LANX interface is an ipv4 packet and the current mode of the router is an ipv4 bridge mode, it is determined that forwarding is allowed. If the packet received by the LANX interface is an ipv4 packet and the current router mode is an ipv4 routing mode, it is determined that forwarding is prohibited.
A2-2: for the message which is allowed to be forwarded, the destination mac is the bridge WAN subinterface B-SUB-WAN, and is directly converted into the bridge subinterface B-SUB-WAN packet; and if the message is an unknown unicast message or a broadcast message, the message is converted into a bridge SUB-interface B-SUB-WAN interface to send packets after the broadcast or unknown unicast copy message. In the bridge WAN SUB-interface B-SUB-WAN package function, the packet is transferred to WAN SUB-interface SUB-WAN package, and finally transferred to WAN MAIN interface MAIN-WAN package, and sent from WAN physical port.
For the message forbidden to be forwarded, the destination mac is the bridge SUB-interface B-SUB-WAN, and is directly discarded; broadcast or unknown unicast messages are not duplicated or forwarded to the bridge WAN subinterface B-SUB-WAN.
A2-3: if the destination mac finds that the interface is the bridge interface BR0, the packet is received by the bridge BR 0. If the message is an unknown unicast message or a broadcast message, the message is copied, and then the copied message is converted into a BR0 packet. And searching an ipv4 routing table or an ipv6 routing table according to whether the message is ipv4 or ipv 6. If the search result is the route WAN SUB-interface R-SUB-WAN, the route WAN SUB-interface R-SUB-WAN is called, and in the route WAN SUB-interface R-SUB-WAN packet-sending function, the route WAN SUB-interface R-SUB-WAN packet-sending function is converted into the WAN SUB-interface SUB-WAN packet-sending function, finally the route WAN SUB-interface MAIN-WAN packet-sending function is converted into the WAN MAIN interface MAIN-WAN packet-sending function, and the WAN SUB-interface R-SUB-WAN packet-sending function is sent from the WAN physical port.
A2-4: if the destination mac finds that the interface is another LAN interface, such as LAN2, the destination mac is converted into a packet for the found LAN interface. If the message is an unknown unicast message or the message is a broadcast message, after the message is copied, the copied message is converted into a corresponding LAN interface to send a packet, and the packet is sent out from a corresponding LAN physical port.
The router provided by the embodiment of the application is mainly used for shunting through the type of the ip message, and the non-ipv 6 message and the non-ipv 4 message are forwarded according to the ipv4 mode. And when the message enters the routing path, the forwarding is not successful even though the message is not limited because the prefix routing is absent in the bridge mode, so that the mode judgment and limitation can be omitted.
Fig. 6 is a schematic diagram of a downstream forwarding path of a packet in a router according to an embodiment of the present application. As shown in fig. 6, according to the above configuration, the downstream forwarding paths of the messages in the router provided by the embodiment of the present application are as follows:
B1: when the WAN MAIN interface MAIN-WAN receives the message from the WAN physical port, firstly resolving the vlan id of the message, if the vlan id is the designated vlan id of the WAN SUB-interface SUB-WAN, converting the vlan SUB-interface SUB-WAN to a WAN SUB-interface SUB-WAN for receiving packets.
B2: and then making a forwarding logic judgment.
B2-1: if the WAN SUB-interface SUB-WAN packet receiving message is an ipv6 message, and the current router ipv6 mode is an ipv6 bridge mode; or the WAN SUB-interface SUB-WAN packet receiving message is an ipv4 message, and the current router ipv4 mode is an ipv4 bridge mode, and then the router is converted into a bridge SUB-interface B-SUB-WAN packet receiving message, and then the bridge flow is entered.
Because bridge WAN subinterface B-SUB-WAN is under bridge BR0, bridge forwarding logic forwards per mac. Searching the mac table, if the searching structure is LANX ports, or the message is a broadcast message, or the message is an unknown unicast message, converting to LANX to send a packet, copying the message, and then sending the message from LANX. LANX in the packet-issuing function, the packet is issued from the physical port corresponding to LANX. If the mac table lookup result is the bridge port BR0, the message is directly discarded.
B2-2: if the WAN SUB-interface SUB-WAN packet receiving message is an ipv6 message, and the current router ipv6 mode is an ipv6 routing mode; or the WAN SUB-interface message is an ipv4 message, and the current router ipv4 mode is an ipv4 routing mode, and then the packet is converted into a routing WAN SUB-interface R-SUB-WAN packet. And then searching a routing table according to the destination ip of the message.
When the ip search result is the bridge interface BR0, the ip search result is sent out from the bridge interface BR0 and enters the bridge forwarding flow, and the interface is searched according to the destination mac. If the mac lookup result is bridge WAN subinterface B-SUB-WAN, the message is directly discarded. If the mac lookup result is LANX, the mobile terminal is converted to LANX interface to send out packets, and the packets are sent out from the corresponding physical port of LANX.
When the ip search result is not the bridge port BR0, the ip search result is directly discarded.
Therefore, an embodiment of the present application provides a router ipv6 adaptive method, including: detecting the router configuration state, if the router is configured in the bridge mode, the ipv4 bridge+ipv 6 bridge mode is used. If the router configuration state is the routing state, starting the detection of the ipv6 mode, and configuring the router use mode according to the detection result of the ipv6 mode.
In summary, the router provided by the embodiment of the application can automatically detect the ipv6 address allocation capability of the upper-level device to perform mode switching. And by setting up the interfaces of the bridge BR0 and WAN for the router and joining all LANs to the bridge, creating a bridge WAN sub-interface to connect with the router WAN sub-interface and joining the bridge BR0. Creating a routing WAN subinterface, allowing the bridge interface BR0 and the routing WAN subinterface to be routed so as to realize that the router automatically supports ipv6 forwarding and realize that the routing of ipv4/ipv6 is isolated from the bridge path.
The application provides a router ipv6 self-adaption method, which is used for initializing and setting a router state and a router use mode, so that the router is initially adapted to a common routing mode. Sending an RS message in an SLAAC mode to a server to apply for obtaining a WAN address, and recording the WAN state of a router according to the result of obtaining the WAN address; and sending a DHCPv6-PD request to the server to acquire the LAN prefix, and recording the LAN state of the router according to the result of acquiring the LAN prefix, thereby detecting the PD supporting capability of the server. And configuring the router use mode according to the current state of the router so as to adapt to different environments. The router ipv6 self-adaption method provided by the application judges whether the router ip 6 self-adaption method supports allocation of two prefixes by detecting the pd supporting capability of the server, and further selects a proper router forwarding mode, so that router ipv6 self-adaption is realized, and the performance of the router is improved.
The application also provides an ipv6 self-adapting device, comprising: and the mode detection module is used for detecting whether the current using mode of the router is a routing mode.
And the initialization module is used for initializing and setting the router state and the router use mode. If the mode detection module detects that the current use mode of the router is a routing mode, the initialization module performs initialization setting on the router state and the router use mode, initializes the router state to [ WAN ipv6 address is being acquired ], [ LAN ipv6 prefix is being acquired ], and sets the router initial use mode to [ ipv4 route+ipv6 route ].
The WAN address acquisition module is used for sending an RS message in an SLAAC mode to the server to apply for acquiring the WAN address, and recording the WAN state of the router according to the result of acquiring the WAN address.
And the LAN prefix acquisition module is used for sending a DHCPv6-PD request to the server for acquiring the LAN prefix and recording the LAN state of the router according to the result of acquiring the LAN prefix.
And the mode configuration module is used for configuring a router use mode according to the router WAN state and the router LAN state.
Further, in some embodiments, the WAN address acquisition module includes: and the WAN address application submodule is used for sending an RS message in an SLAAC mode to the server and applying for obtaining the WAN address. And the WAN address receiving sub-module is used for receiving a response message of the server to the RS message. And the WAN state recording sub-module is used for recording the WAN state of the router according to the response message.
The WAN address receiving sub-module is also used for judging whether the address needs to be acquired in a stateful mode according to the M-FLAG mark of the response message.
Further, if M-FLAG in the response message is 0, the WAN state recording submodule directly obtains WAN address prefixes from the response message, and automatically generates legal Ipv6 global unicast addresses, and records that the WAN state of the router is [ WAN Ipv6 address acquisition is successful ]. If the response message does not carry or carries the prefix as illegal character, the WAN state of the router is recorded as [ WAN ipv6 address acquisition failure ].
If M-FLAG is 1 in the response message, the WAN address application sub-module sends dhcpv NA address request. If the server does not respond dhcpv to the WAN address application submodule sends dhcpv NA request to the server with random delay period, the current state is maintained unchanged during the request, i.e. the WAN state recording submodule records the WAN state of the router as [ WAN ipv6 address is being acquired ].
If the server responds dhcpv NA request, after the router and the server complete all interactions dhcpv NA, the server issues a response message to the router, and the router obtains the address from the response message. I.e. if the WAN address receiving sub-module receives the dhcpv NA requested response message, the WAN address is obtained from the response message.
If the WAN address receiving sub-module successfully acquires legal ipv6 global unicast addresses from the response message, the WAN state recording sub-module records the WAN state of the router as [ WAN ipv6 address acquisition is successful ].
If the server response message received by the WAN address receiving submodule does not support or is illegally distributed with the address, the WAN state recording submodule records the WAN state of the router as [ WAN ipv6 address acquisition failure ].
In some embodiments, the LAN prefix acquisition module includes: and the LAN prefix application submodule is used for sending the DHCPv6-PD request to the server. And the LAN prefix receiving submodule is used for receiving a response message after the server processes the DHCPv6-PD request. And the LAN state recording sub-module is used for recording the LAN state of the router according to the received response message of the DHCPv 6-PD.
In some embodiments, the LAN prefix application submodule is further configured to send a DHCPv6-PD request at a random delay period if the LAN prefix receiving submodule does not receive the server response message.
The LAN state recording submodule records the LAN state of the router according to the received response message of the DHCPv6-PD, and the LAN state recording submodule comprises the following steps: if the server responds, the router continues to interact with the server with the DHCPv6-PD. After the interaction is completed, if the LAN state recording submodule successfully acquires legal ipv6 global unicast prefixes from the server message, the state of the recording router is [ LAN ipv6 prefixes are successfully acquired ]. If the prefix is not supported or distributed illegally in the response message of the server, the router state is recorded as [ LAN ipv6 prefix acquisition failure ].
In some embodiments, a mode configuration module is configured to configure a router usage mode based on the router WAN state and the router LAN state. Further, if the router WAN status [ LAN ipv6 prefix is acquiring ] or the router LAN status is [ WAN ipv6 address is acquiring ], the current mode of the router is maintained unchanged, i.e. the mode of the router is [ ipv4 route+ipv 6 route ].
If the router WAN status is [ WAN ipv6 address acquisition success ] and the router LAN status is [ LAN ipv6 prefix acquisition success ], the router is configured to use the [ ipv4 route+ipv 6 route ] mode.
If the router WAN status is [ WAN ipv6 address acquisition success ] and the router LAN status is [ LAN ipv6 prefix acquisition failure ], the router is configured to use [ ipv4 route+ipv 6 bridge ] mode.
If the router state is [ WAN ipv6 address acquisition failure ], the current mode of the router is maintained unchanged.
In summary, the present application also provides an ipv6 adaptive device, including: and the initialization module is used for initializing and setting the router state and the router use mode. The WAN address acquisition module is used for sending an RS message in an SLAAC mode to the server to apply for acquiring the WAN address, and recording the WAN state of the router according to the result of acquiring the WAN address. And the LAN prefix acquisition module is used for sending a DHCPv6-PD request to the server for acquiring the LAN prefix and recording the LAN state of the router according to the result of acquiring the LAN prefix. And the mode configuration module is used for configuring a router use mode according to the router WAN state and the router LAN state. The router states and router usage patterns are initialized so that the router initially adapts to common routing patterns. The router applies WAN address and LAN prefix to the server, updates the router state according to the acquired result, and detects the pd supporting capability of the server. And configuring the router use mode according to the current state of the router so as to adapt to different environments. The ipv6 self-adaptive device provided by the application judges whether the device supports allocation of two prefixes or not by detecting the pd supporting capability of the server, and then selects a proper router forwarding mode, thereby realizing router ipv6 self-adaptation and improving the performance of the router.
Since the foregoing embodiments are all described in other modes by reference to the above, the same parts are provided between different embodiments, and the same and similar parts are provided between the embodiments in the present specification. And will not be described in detail herein.
It should be noted that in this specification, relational terms such as "first" and "second" and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a circuit structure, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such circuit structure, article, or apparatus. Without further limitation, the statement "comprises one … …" does not exclude that an additional identical element is present in a circuit structure, article or device comprising the element. The WLN side is a server side, and may be a superior device associated with a router, which may be HUG devices or superior routers.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure of the application herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
The embodiments of the present application described above do not limit the scope of the present application.

Claims (6)

1. A router ipv6 adaptation method, comprising:
the current use mode of the router is a routing mode, and the router state and the router use mode are initialized;
Sending an RS message in an SLAAC mode to a server to apply for obtaining a WAN address, and recording the WAN state of a router according to the result of obtaining the WAN address;
Sending a DHCPv6-PD request to the server to acquire the LAN prefix, and recording the LAN state of the router according to the result of acquiring the LAN prefix;
Configuring a router usage pattern according to the router WAN state and the router LAN state; if the router WAN state is [ WAN ipv6 address acquisition success ] and the router LAN state is [ LAN ipv6 prefix acquisition failure ], configuring the router to use a [ ipv4 route+ipv 6 bridge ] mode;
otherwise, maintaining the current configuration;
the current use mode of the router is not a routing mode, and the current mode of the router is maintained unchanged.
2. The router ipv6 adaptation method according to claim 1, wherein the initial state of the router is [ WAN ipv6 address is being acquired ], [ LAN ipv6 prefix is being acquired ], and the initial usage mode of the router is [ ipv4 route+ipv6 route ].
3. The router ipv6 adaptive method according to claim 1, wherein sending an RS message in SLAAC mode to a server applies for obtaining a WAN address, and recording a router WAN state according to a result of obtaining the WAN address, comprising:
sending an RS message in an SLAAC mode to a server;
If the server response message is received, judging whether the address needs to be acquired in a stateful mode according to an M-FLAG mark of the response message;
If M-FLAG is 0, directly acquiring WAN address prefix from the response message, automatically generating legal Ipv6 global unicast address, and recording that the WAN state of the router is [ WAN Ipv6 address acquisition is successful ];
If M-FLAG is 1, the router sends dhcpv NA address request to the server, if the server sends a response message to the router, the router acquires legal address from the response message, the WAN state of the router is recorded as [ WAN ipv6 address acquisition is successful ];
If the router does not receive the server response message, recording the WAN state of the router as [ WAN ipv6 address is being acquired ];
Otherwise, the recording router WAN status is [ WAN ipv6 address acquisition failure ].
4. A router ipv6 adaptation method according to claim 3, wherein the sending a DHCPv6-PD request to the server applies for obtaining a LAN prefix, and records the router LAN status according to the result of obtaining the LAN prefix; comprising the following steps:
sending a DHCPv6-PD request to a server;
if the server does not respond, recording the router LAN state as [ LAN ipv6 prefix is being acquired ];
if the server responds, the router and the server continue to interact with the DHCPv6-PD;
after the interaction is finished, if the legal ipv6 global unicast prefix is successfully obtained from the server message, recording the LAN state of the router as [ LAN ipv6 prefix is successfully obtained ];
If the prefix is not supported or distributed illegally in the response message of the server, the LAN state of the router is recorded as [ LAN ipv6 prefix acquisition failure ].
5. The router ipv6 adaptation method according to claim 4, wherein after the router is configured using the [ ipv4 route+ipv 6 bridge ] mode, further comprising: configuring a router:
The WAN sub-interface is configured to select a forwarding path according to the received message type of the external network and the current mode of the router;
bridge BR0, it mounts at least one intranet interface down;
a bridge interface BR0 is mounted under the bridge BR0 to participate in bridge forwarding;
a bridge WAN sub-interface, which is mounted under the bridge BR0 and can participate in bridge forwarding; routing the WAN subinterface;
wherein: the bridge port BR0 and the routing WAN subinterface can be used for routing forwarding;
The routing WAN sub-interface and the bridge WAN sub-interface directly convert the message sent to the WAN side into the WAN sub-interface to send a packet; and the WAN sub-interface receives the message, and selects the routing WAN sub-interface or the bridge WAN sub-interface to forward the message according to the message content and the router mode.
6. An ipv6 adaptive device, comprising:
The mode detection module is used for detecting whether the current use mode of the router is a routing mode or not;
The initialization module is used for initializing and setting the router state and the router use mode;
The WAN address acquisition module is used for sending an RS message in an SLAAC mode to the server to apply for acquiring the WAN address, and recording the WAN state of the router according to the result of acquiring the WAN address;
the LAN prefix acquisition module is used for sending a DHCPv6-PD request to the server to acquire the LAN prefix, and recording the LAN state of the router according to the result of acquiring the LAN prefix;
A mode configuration module, configured to configure a router usage mode according to the router WAN state and the router LAN state; if the router WAN state is [ WAN ipv6 address acquisition success ] and the router LAN state is [ LAN ipv6 prefix acquisition failure ], configuring the router to use a [ ipv4 route+ipv 6 bridge ] mode;
Otherwise, the current configuration is maintained.
CN202110153628.5A 2021-02-04 2021-02-04 Router and router ipv6 self-adaption method and device Active CN114938347B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110153628.5A CN114938347B (en) 2021-02-04 2021-02-04 Router and router ipv6 self-adaption method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110153628.5A CN114938347B (en) 2021-02-04 2021-02-04 Router and router ipv6 self-adaption method and device

Publications (2)

Publication Number Publication Date
CN114938347A CN114938347A (en) 2022-08-23
CN114938347B true CN114938347B (en) 2024-05-10

Family

ID=82863316

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110153628.5A Active CN114938347B (en) 2021-02-04 2021-02-04 Router and router ipv6 self-adaption method and device

Country Status (1)

Country Link
CN (1) CN114938347B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102025797A (en) * 2010-11-30 2011-04-20 北京星网锐捷网络技术有限公司 Address prefix processing method, device, system and network equipment
WO2013123763A1 (en) * 2012-02-20 2013-08-29 烽火通信科技股份有限公司 Dynamic ipv6 configuration method for home gateway
CN103581353A (en) * 2012-08-02 2014-02-12 上海斐讯数据通信技术有限公司 Method and system of automatic configuration of gateway device
CN111541797A (en) * 2020-04-23 2020-08-14 深圳市吉祥腾达科技有限公司 Eco-based IPV6 implementation method
CN111614565A (en) * 2020-05-19 2020-09-01 青岛海信宽带多媒体技术有限公司 Message forwarding method and gateway
CN112272244A (en) * 2020-10-22 2021-01-26 北京自如信息科技有限公司 Router WAN end IPv6 internet mode configuration method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7716472B2 (en) * 2005-12-29 2010-05-11 Bsecure Technologies, Inc. Method and system for transparent bridging and bi-directional management of network data

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102025797A (en) * 2010-11-30 2011-04-20 北京星网锐捷网络技术有限公司 Address prefix processing method, device, system and network equipment
WO2013123763A1 (en) * 2012-02-20 2013-08-29 烽火通信科技股份有限公司 Dynamic ipv6 configuration method for home gateway
CN103581353A (en) * 2012-08-02 2014-02-12 上海斐讯数据通信技术有限公司 Method and system of automatic configuration of gateway device
CN111541797A (en) * 2020-04-23 2020-08-14 深圳市吉祥腾达科技有限公司 Eco-based IPV6 implementation method
CN111614565A (en) * 2020-05-19 2020-09-01 青岛海信宽带多媒体技术有限公司 Message forwarding method and gateway
CN112272244A (en) * 2020-10-22 2021-01-26 北京自如信息科技有限公司 Router WAN end IPv6 internet mode configuration method and device

Also Published As

Publication number Publication date
CN114938347A (en) 2022-08-23

Similar Documents

Publication Publication Date Title
US9756052B2 (en) Method and apparatus for dual stack access
JP5488642B2 (en) Portable network connection device, setting method thereof, computer program, and recording medium
EP1410579B1 (en) Method for configuring a computer network
EP2241091B1 (en) Combining locally addressed devices and wide area network (wan) addressed devices on a single network
RU2602971C2 (en) Dynamic ipv6 configuration method for home gateway
JP5967173B2 (en) Network relay device, method for setting operation mode of packet relay processing unit included in network relay device, and computer program
JP4692258B2 (en) Router device and communication system
WO2018214809A1 (en) Message transmission method and device, and storage medium
CN114258667B (en) Method and device for obtaining IP address
WO2008031319A1 (en) The method and device for managing route information and retransmitting data in accessing device
JP2003520535A (en) Get address
WO2007009367A1 (en) A method for duplicate address detection in the two-layer access network supporting ipv6 and a system thereof
WO2009117960A1 (en) Method for accessing network, authentication method, communication system and related equipment
EP2749010A1 (en) Discovery and disconnection of client addresses in an access node for an ip network
CN104821904B (en) Network repeater and relaying data packets method
CN102238075A (en) IPv6 (Internet Protocol version 6) routing establishing method based on Ethernet Point-to-Point Protocol and access server
KR20110060895A (en) A method and a gateway for providing multiple internet access
US20140313933A1 (en) Method, apparatus, and system for layer 2 interworking based on ipv6
WO2013167083A2 (en) Method and device for selecting domain name server
JP5241957B2 (en) Method and apparatus for connecting a subscriber unit to an aggregation network supporting IPv6
JP2014161084A (en) Self-configuration of forwarding table in access node
WO2012136006A1 (en) Routing method and device for host in multi-homing site
US9438475B1 (en) Supporting relay functionality with a distributed layer 3 gateway
CN114938347B (en) Router and router ipv6 self-adaption method and device
JP5845964B2 (en) Communication apparatus and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant