Main-standby switching method and device, gateway equipment and storage medium
Patent Information
- Application Number
- CN202380008244.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-10
- Publication Date
- 2024-11-12
AI Technical Summary
In the AMT protocol, if the forwarding path between the relay device and the multicast source fails or the transmission quality decreases, the gateway device cannot obtain multicast data in time, affecting the quality of multicast service.
By obtaining the priority values of the active relay device and the standby relay device, the active and standby relay devices are switched according to the preset switching conditions to ensure the quality of multicast service.
This effectively avoids the degradation of the multicast service quality of the relay device that affects the service quality of the multicast receiver, and improves the multicast service quality of the gateway device.
Smart Images

Figure CN118947096A_ABST
Abstract
Description
Active / standby switching method, device, gateway device, and storage medium Technical Field
[0001] The present application relates to the field of network communication technology, and in particular to a primary-backup switching method, apparatus, gateway device, and storage medium. Background Art
[0002] The Automatic Multicast Tunneling (AMT) protocol enables multicast receivers that do not support native multicast protocols to connect to a multicast source and receive multicast traffic from the multicast source.
[0003] The AMT protocol uses a relay deployment method. A gateway can use anycast to determine the nearest relay device. The gateway then joins the multicast group maintained by the relay device as a multicast member, successfully establishing an AMT tunnel between the gateway and the relay device. After receiving multicast data from the multicast source, the relay device can send the multicast data to the gateway through the AMT tunnel. The gateway then sends the multicast data to the multicast receivers.
[0004] After the AMT tunnel is successfully established, if the relay device is topologically closest to the gateway and the route between the relay device and the gateway is reachable, the gateway will continue to receive multicast data through the relay device. In this case, if the forwarding path between the relay device and the multicast source fails or the transmission quality degrades, the gateway will not be able to receive the multicast data transmitted by the relay device in a timely manner. This will further prevent multicast receivers from receiving multicast data in a timely manner, affecting the quality of multicast service.
[0005] Summary of the Invention
[0006] The present invention provides a method, apparatus, gateway device, and storage medium for switching between active and standby modes, which prevent multicast receivers from being unable to obtain multicast data in a timely manner, thereby affecting the quality of multicast services. The specific technical solutions are as follows:
[0007] In a first aspect, an embodiment of the present application provides a method for active / standby switching, which is applied to a gateway device and includes:
[0008] Obtaining a priority value of the active relay device and a priority value of the standby relay device, wherein the priority values are used to indicate the multicast service quality of the relay device;
[0009] If the magnitude relationship between the priority values of the active relay device and the backup relay device meets a preset switching condition, the active and backup relay devices are switched.
[0010] In a possible implementation, the method further includes:
[0011] After the gateway device comes online, a relay discovery message is sent to each of the multiple relay devices, each relay discovery message including a different anycast address;
[0012] If a relay notification message is received from a relay device within a first preset time period, the relay device that sent the relay notification message is used as the master relay device; or, if multiple relay notification messages are received from multiple relay devices within the first preset time period, a master relay device is selected from the multiple relay devices, and the relay notification message sent by the master relay device carries the maximum priority value;
[0013] Establish an AMT tunnel with the primary relay device.
[0014] In a possible implementation, obtaining the priority value of the active relay device and the priority value of the standby relay device includes:
[0015] Sending a request message to the primary relay device every second preset time period;
[0016] receiving a member query message sent by the master relay device, wherein the member query message includes a priority value of the master relay device;
[0017] Sending a relay discovery message to the standby relay device every first preset time period;
[0018] A relay notification message sent by the backup relay device is received, where the relay notification message includes a priority value of the backup relay device.
[0019] In a possible implementation, if the priority value of the active relay device and the priority value of the standby relay device meet a preset switching condition, switching the active and standby relay devices includes:
[0020] If the priority value of the backup relay device is greater than the priority value of the active relay device, switching between the active and standby relay devices is performed; or
[0021] If the priority value of the backup relay device is greater than the priority value of the active relay device, the active-standby switching timer is started; if the priority value of the backup relay device obtained last time is greater than the priority value of the active relay device before the active-standby switching timer times out, the active-standby relay device is switched; or
[0022] If the priority value of the backup relay device is greater than the priority value of the main relay device, the master-slave switching timer is started. If the priority values of the backup relay devices obtained are greater than the priority value of the main relay device before the master-slave switching timer times out, the master-slave relay devices are switched.
[0023] In a possible implementation, the switching of the primary and backup relay devices includes:
[0024] Sending a request message to the backup relay device;
[0025] If a member query message sent by the backup relay device is received, a member update message is sent to the backup relay device, and a periodic query keep-alive timer between the backup relay device and the active relay device is stopped, where the timeout duration of the periodic query keep-alive timer is the second preset duration;
[0026] If the member query message sent by the primary relay device is not received within the third preset time period, the AMT tunnel information between the primary relay device and the primary relay device is deleted.
[0027] In a possible implementation, after deleting the AMT tunnel information between the active relay device and the active relay device, the method further includes:
[0028] Sending a relay discovery message to the active relay device every first preset time period;
[0029] After receiving the member query message sent by the backup relay device, the method further includes:
[0030] Send a request message to the backup relay device every second preset time period.
[0031] In a possible implementation, the member query message includes a first flag bit field and a priority field. When the first flag bit field takes a first value, it indicates that the priority field carries the priority value of the master relay device.
[0032] In a possible implementation, the member query message further includes a second flag bit field;
[0033] If the value of the second flag bit field is the first value, it means that the priority field is located after the gateway address field and adjacent to the gateway address field;
[0034] If the value of the second flag bit field is the second value, it means that the priority field is located after the encapsulation information of the common query message and is adjacent to the encapsulation information.
[0035] In a possible implementation, the relay notification message includes a priority field, and the priority field is used to carry a priority value of the standby relay device.
[0036] In a possible implementation, the priority field occupies 8 reserved bits. When the priority field takes a value of 0, it indicates that the priority field does not carry a priority value.
[0037] In one possible implementation, the priority value is determined based on the health parameters of the relay device, and the health parameters include any one or more of the following: the number of accessible multicast sources; the network quality between the multicast source; the failure rate of the transmission path between the multicast source and the multicast source; and the quality of the routing link between the multicast source and the multicast source.
[0038] In a second aspect, an embodiment of the present application provides a master-slave switching device, applied to a gateway device, the device comprising:
[0039] an acquisition module, configured to acquire a priority value of a primary relay device and a priority value of a backup relay device, wherein the priority value is used to indicate a multicast service quality of the relay device;
[0040] The switching module is configured to switch the primary and backup relay devices if the magnitude relationship between the priority values of the primary relay device and the backup relay device meets a preset switching condition.
[0041] In a possible implementation, the apparatus further includes:
[0042] A sending module, configured to send a relay discovery message to each of the plurality of relay devices after the gateway device comes online, each relay discovery message including a different anycast address;
[0043] A selection module is configured to, if a relay notification message sent by a relay device is received within a first preset time length, select the relay device that sent the relay notification message as the primary relay device; or, if multiple relay notification messages sent by multiple relay devices are received within the first preset time length, select the primary relay device from the multiple relay devices, the relay notification message sent by the primary relay device carrying the maximum priority value;
[0044] An establishing module is used to establish an AMT tunnel with the primary relay device.
[0045] In a possible implementation, the acquisition module is specifically configured to:
[0046] Sending a request message to the primary relay device every second preset time period;
[0047] receiving a member query message sent by the master relay device, wherein the member query message includes a priority value of the master relay device;
[0048] Sending a relay discovery message to the standby relay device every first preset time period;
[0049] A relay notification message sent by the backup relay device is received, where the relay notification message includes a priority value of the backup relay device.
[0050] In a possible implementation, the switching module is specifically configured to:
[0051] If the priority value of the backup relay device is greater than the priority value of the active relay device, switching between the active and standby relay devices is performed; or
[0052] If the priority value of the backup relay device is greater than the priority value of the active relay device, the active-standby switching timer is started; if the priority value of the backup relay device obtained last time is greater than the priority value of the active relay device before the active-standby switching timer times out, the active-standby relay device is switched; or
[0053] If the priority value of the backup relay device is greater than the priority value of the main relay device, the master-slave switching timer is started. If the priority values of the backup relay devices obtained are greater than the priority value of the main relay device before the master-slave switching timer times out, the master-slave relay devices are switched.
[0054] In a possible implementation, the switching module is specifically configured to:
[0055] Sending a request message to the backup relay device;
[0056] If a member query message sent by the backup relay device is received, a member update message is sent to the backup relay device, and a periodic query keep-alive timer between the backup relay device and the active relay device is stopped, where the timeout duration of the periodic query keep-alive timer is the second preset duration;
[0057] If the member query message sent by the primary relay device is not received within the third preset time period, the AMT tunnel information between the primary relay device and the primary relay device is deleted.
[0058] In a possible implementation, the switching module is further configured to send a relay discovery message to the active relay device every first preset time period;
[0059] The switching module is further configured to send a request message to the backup relay device every second preset time period.
[0060] In a possible implementation, the member query message includes a first flag bit field and a priority field. When the first flag bit field takes a first value, it indicates that the priority field carries the priority value of the master relay device.
[0061] In a possible implementation, the member query message further includes a second flag bit field;
[0062] If the value of the second flag bit field is the first value, it means that the priority field is located after the gateway address field and adjacent to the gateway address field;
[0063] If the value of the second flag bit field is the second value, it means that the priority field is located after the encapsulation information of the common query message and is adjacent to the encapsulation information.
[0064] In a possible implementation, the relay notification message includes a priority field, and the priority field is used to carry a priority value of the standby relay device.
[0065] In a possible implementation, the priority field occupies 8 reserved bits. When the priority field takes a value of 0, it indicates that the priority field does not carry a priority value.
[0066] In one possible implementation, the priority value is determined based on the health parameters of the relay device, and the health parameters include any one or more of the following: the number of accessible multicast sources; the network quality between the multicast source; the failure rate of the transmission path between the multicast source and the multicast source; and the quality of the routing link between the multicast source and the multicast source.
[0067] In a third aspect, an embodiment of the present application provides a gateway device, the gateway device comprising:
[0068] processor;
[0069] transceiver;
[0070] A machine-readable storage medium storing machine-executable instructions capable of being executed by the processor; the machine-executable instructions prompting the processor to perform the following steps:
[0071] Obtaining a priority value of the active relay device and a priority value of the standby relay device, wherein the priority values are used to indicate the multicast service quality of the relay device;
[0072] If the magnitude relationship between the priority values of the active relay device and the backup relay device meets a preset switching condition, the active and backup relay devices are switched.
[0073] In one possible implementation, the machine executable instructions further cause the processor to execute the following steps:
[0074] After the gateway device is online, the relay discovery message is sent to multiple relay devices respectively through the transceiver, each relay discovery message including a different anycast address;
[0075] If a relay notification message sent by a relay device is received through the transceiver within a first preset time length, the relay device that sent the relay notification message is used as the master relay device; or if multiple relay notification messages sent by multiple relay devices are received through the transceiver within the first preset time length, a master relay device is selected from the multiple relay devices, and the relay notification message sent by the master relay device carries the maximum priority value;
[0076] Establish an AMT tunnel with the primary relay device.
[0077] In one possible implementation, the machine executable instructions further cause the processor to execute the following steps:
[0078] every second preset time period, sending a request message to the active relay device through the transceiver;
[0079] Receiving, through the transceiver, a member query message sent by the primary relay device, wherein the member query message includes a priority value of the primary relay device;
[0080] sending a relay discovery message to the standby relay device through the transceiver at intervals of the first preset time;
[0081] A relay notification message sent by the backup relay device is received through the transceiver, where the relay notification message includes a priority value of the backup relay device.
[0082] In one possible implementation, the machine executable instructions further cause the processor to execute the following steps:
[0083] If the priority value of the backup relay device is greater than the priority value of the active relay device, switching between the active and standby relay devices is performed; or
[0084] If the priority value of the backup relay device is greater than the priority value of the active relay device, the active-standby switching timer is started; if the priority value of the backup relay device obtained last time is greater than the priority value of the active relay device before the active-standby switching timer times out, the active-standby relay device is switched; or
[0085] If the priority value of the backup relay device is greater than the priority value of the main relay device, the master-slave switching timer is started. If the priority values of the backup relay devices obtained are greater than the priority value of the main relay device before the master-slave switching timer times out, the master-slave relay devices are switched.
[0086] In one possible implementation, the machine executable instructions further cause the processor to execute the following steps:
[0087] Sending a request message to the backup relay device through the transceiver;
[0088] If a member query message sent by the backup relay device is received through the transceiver, a member update message is sent to the backup relay device through the transceiver, and a periodic query keep-alive timer between the standby relay device and the active relay device is stopped, where the timeout duration of the periodic query keep-alive timer is the second preset duration;
[0089] If the member query message sent by the primary relay device is not received through the transceiver within the third preset time period, the AMT tunnel information between the primary relay device and the primary relay device is deleted.
[0090] In one possible implementation, the machine executable instructions further cause the processor to execute the following steps:
[0091] Sending a relay discovery message to the active relay device through the transceiver every first preset time period;
[0092] The machine executable instructions further cause the processor to perform the following steps:
[0093] Every second preset time period, a request message is sent to the backup relay device through the transceiver.
[0094] In a possible implementation, the member query message includes a first flag bit field and a priority field. When the first flag bit field takes a first value, it indicates that the priority field carries the priority value of the master relay device.
[0095] In a possible implementation, the member query message further includes a second flag bit field;
[0096] If the value of the second flag bit field is the first value, it means that the priority field is located after the gateway address field and adjacent to the gateway address field;
[0097] If the value of the second flag bit field is the second value, it means that the priority field is located after the encapsulation information of the common query message and is adjacent to the encapsulation information.
[0098] In a possible implementation, the relay notification message includes a priority field, and the priority field is used to carry a priority value of the standby relay device.
[0099] In a possible implementation, the priority field occupies 8 reserved bits. When the priority field takes a value of 0, it indicates that the priority field does not carry a priority value.
[0100] In one possible implementation, the priority value is determined based on a health parameter of the relay device, where the health parameter includes any one or more of the following:
[0101] The number of accessible multicast sources;
[0102] Network quality between the multicast source and the source;
[0103] Failure rate of the transmission path to the multicast source;
[0104] The quality of the routing link to the multicast source.
[0105] In a fourth aspect, an embodiment of the present application provides a machine-readable storage medium storing machine-executable instructions. When called and executed by a processor, the machine-executable instructions prompt the processor to implement any of the method steps described in the first aspect above.
[0106] In a fifth aspect, an embodiment of the present application provides a computer program product, which prompts the processor to implement any method step described in the first aspect.
[0107] By adopting the above-mentioned technical solution and the embodiment of the present application, the relay device communicating with the gateway device includes a primary relay device and a backup relay device. When the priority value of the primary relay device and the priority value of the backup relay device meet the preset switching conditions, the primary and backup relay devices can be switched. Because the priority value represents the multicast service quality of the relay device, that is, the gateway device can switch the relay device between the primary and backup positions based on the multicast service quality of the relay device. This can avoid the impact of the gateway device's multicast service quality on the multicast receiver due to a decrease in the multicast service quality of one relay device, thereby improving the gateway device's multicast service quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0108] The drawings described herein are used to provide further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute improper limitations on the present application.
[0109] FIG1 is a schematic diagram of an AMT network architecture provided in an embodiment of the present application;
[0110] FIG2 is a flowchart of a method for establishing an AMT tunnel between a gateway device and a relay device provided in an embodiment of the present application;
[0111] FIG3 is a flow chart of a primary-standby switching method provided in an embodiment of the present application;
[0112] FIG4 is an exemplary schematic diagram of a member query message provided in an embodiment of the present application;
[0113] FIG5 is an exemplary schematic diagram of a relay notification message provided in an embodiment of the present application;
[0114] FIG6 is a flow chart of another active-standby switching method provided in an embodiment of the present application;
[0115] FIG7 is a flowchart of another active-standby switching method provided in an embodiment of the present application;
[0116] FIG8 is a schematic structural diagram of a master-slave switching device provided in an embodiment of the present application;
[0117] FIG9 is a schematic structural diagram of a gateway device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0118] To make the objectives, technical solutions, and advantages of the present invention more clearly understood, the present invention is further described below with reference to the accompanying drawings and examples. It should be understood that the described examples are only some examples of the present invention, not all examples. All other examples derived by persons of ordinary skill in the art based on the examples of the present invention fall within the scope of protection of the present invention.
[0119] To facilitate understanding of the solution provided by the embodiments of the present application, the AMT network architecture involved in the embodiments of the present application is first introduced. As shown in Figure 1, the AMT network architecture includes a multicast receiver (Receiver), a gateway device (Gateway), a relay device (Relay) R1, a relay device (Relay) R2, a multicast source (Source) S1, a multicast source (Source) S2, and a multicast source (Source) S3.
[0120] The number of devices in FIG1 is only an example, and the number of devices in actual implementation is not limited thereto.
[0121] The multicast receiver may be a site, host, or application program that does not support the multicast routing protocol and needs to obtain multicast data.
[0122] The gateway device is located in a network that does not support multicast routing protocols, and multicast receivers can access the gateway device.
[0123] Each relay device can be connected to at least one multicast source. For example, the relay devices R1 and R2 in FIG1 are both connected to the multicast source S1 , the multicast source S2 , and the multicast source S3 .
[0124] The gateway device can establish an AMT tunnel with a relay device in anycast mode, and then receive multicast data from the multicast source sent by the relay device through the AMT tunnel.
[0125] In Figure 1, taking the establishment of an AMT tunnel between the gateway device and the relay device R1 as an example, after the relay device R1 receives multicast data from any multicast source, it can forward the multicast data to the gateway device through the AMT tunnel, and then the gateway device can forward the multicast data to the multicast receiver.
[0126] The following describes the process of establishing an AMT tunnel between a gateway device and a relay device.
[0127] As shown in Figure 2, the process of establishing an AMT tunnel between a gateway device and a relay device includes the following steps:
[0128] S201. The gateway device sends a relay discovery message (Relay Discovery) to the relay device.
[0129] AMT-enabled relay devices advertise routes with the same IP address prefix. Gateway devices, upon learning these routes, can generate anycast addresses based on the IP address prefix. For example, the anycast address includes the IP address prefix, with all remaining bits set to 0.
[0130] When a gateway device sends a relay discovery message based on an anycast address, it forwards the relay discovery message to the relay device that is topologically closest and has announced the above IP address prefix based on the anycast routing table.
[0131] Optionally, the relay discovery message includes a random number.
[0132] S202: After receiving the relay discovery message, the relay device sends a relay advertisement message (Relay Advertisement) to the gateway device.
[0133] After receiving the relay discovery message, the relay device can obtain the random number from the relay discovery message. In addition, the relay notification message sent by the relay device includes the random number and the unicast Internet Protocol (IP) address of the relay device.
[0134] After receiving the relay notification message, the gateway device verifies whether the random number in the relay notification message is the same as the random number it sent. If they are the same, the gateway device can use the unicast IP address in the relay notification message when communicating with the relay device using the AMT protocol.
[0135] Among them, the above S201-S202 is the relay device discovery stage. Through the above steps, the gateway device can determine the relay device that can establish an AMT tunnel with itself.
[0136] S203: The gateway device sends a request message to the relay device. Correspondingly, the relay device receives the request message.
[0137] The request message contains a request random number and a query identifier, which is used to indicate whether the relay device should return a message containing a third-generation Internet Group Management Protocol version 3 (IGMPv3) general query message or a second-generation Multicast Listener Discovery Protocol version 2 (MLDv2) general query message to the gateway device.
[0138] For example, the value of the query identifier can be 1 or 0. When the query identifier value is 1, it is used to indicate that the relay device should send a message containing an IGMPv3 general query message or an MLDv2 general query message to the gateway device; when the query identifier value is 0, it is used to indicate that the relay device does not need to send a message containing an IGMPv3 general query message or an MLDv2 general query message to the gateway device.
[0139] S204: The relay device sends a membership query message (Membership Query) to the gateway device. Correspondingly, the gateway device receives the membership query message.
[0140] After receiving the request message, the relay device can extract information such as the source IP address, source User Datagram Protocol (UDP) port, request random number and private key from the request information, and then calculate the hash summary of the extracted information to obtain the message authentication code.
[0141] Furthermore, the relay device may return a member query message to the gateway device, where the member query message includes: the request random number, the message authentication code, and an IGMPv3 regular query message or an MLDv2 regular query message.
[0142] S205: The gateway device sends a membership update message (Membership Update) to the relay device.
[0143] After receiving the membership query message, the gateway device can verify whether the request random number in the membership query message is the same as the request random number included in the request message sent by itself.
[0144] If they are the same, the gateway device may start a periodic query keep-alive timer (Query Timer), and whenever the periodic query keep-alive timer times out, the gateway device is triggered to send a new request message to the relay device.
[0145] At the same time, the gateway device saves the request random number and message authentication code, and obtains the IGMPv3 general query message or MLDv2 general query message in the member query message. The IGMP protocol module in the gateway device processes the IGMPv3 general query message, or the MLD protocol module processes the MLDv2 general query message.
[0146] After the gateway device receives the multicast join request sent by the multicast receiver, the gateway device may send a member update message to the relay device.
[0147] The member update message includes: a request random number, a message verification code, and an IGMPv3 report message or an MLDv2 report message.
[0148] It can be understood that when the gateway device periodically sends request information to the relay device based on the periodic query keep-alive timer, the random number carried in the member update message sent by the gateway device each time is the request random number in the member query message received by the gateway device for the last time, and the message verification code carried is the message verification code in the member query message received by the gateway device for the last time.
[0149] S206: The relay device sends a multicast data message (Multicast Data) to the gateway device.
[0150] After receiving a Membership Update message, the relay device calculates a message authentication code based on the source IP address, source UDP port, request random number, and private key. If the calculated message authentication code matches the message authentication code in the Membership Update message, the relay device accepts and processes the Membership Update message, successfully establishing an AMT tunnel between the gateway device and the relay device. If the calculated message authentication code differs from the message authentication code in the Membership Update message, the relay device ignores the Membership Update message.
[0151] After an AMT tunnel is established between the gateway device and the relay device, if the relay device receives multicast data from the multicast source and determines that the gateway device belongs to the multicast group corresponding to the multicast source, that is, the gateway device is interested in the multicast data of the multicast source, the relay device can encapsulate the multicast data into a multicast data packet, and then send the multicast data packet to the gateway device based on the AMT tunnel.
[0152] After receiving the multicast data message, the gateway device extracts the multicast data in the multicast data message and sends the multicast data to the multicast receiver.
[0153] Referring to Figure 1, assuming that the gateway device is closest to the relay device R1 and an AMT tunnel is successfully established between the relay device R1, if the forwarding path between the relay device R1 and the multicast source fails or the transmission quality degrades, the multicast service quality will be affected.
[0154] To solve the above problem, an embodiment of the present application provides a method for active / standby switching, which is applied to a gateway device. As shown in FIG3 , the method includes:
[0155] S301: Obtain a priority value of a primary relay device and a priority value of a backup relay device.
[0156] The priority value indicates the multicast service quality of the relay device. The higher the multicast service quality of the relay device, the higher the priority value of the relay device; the lower the multicast service quality of the relay device, the lower the priority value of the relay device.
[0157] An AMT tunnel has been established between the active relay device and the gateway device, but no AMT tunnel has been established between the standby relay device and the gateway device. The number of active relay devices is one, and the number of standby relay devices can be one or more, depending on the actual situation. This embodiment of the application uses one standby relay device as an example for illustration.
[0158] S302: If the priority value of the active relay device and the priority value of the standby relay device meet a preset switching condition, switching between the active and standby relay devices is performed.
[0159] The switching of the primary and backup relay devices refers to switching the current primary relay device to the backup relay device, and switching the current backup relay device to the primary relay device.
[0160] It is understood that during the active / standby switchover process, the gateway device can disconnect the AMT tunnel with the active relay device. After disconnecting the AMT tunnel with the active relay device, the active relay device's identity is switched to the standby relay device. Accordingly, the gateway device also needs to establish an AMT tunnel with the standby relay device. After establishing the AMT tunnel with the standby relay device, the standby relay device's identity is switched to the active relay device, thus achieving active / standby switchover.
[0161] In an embodiment of the present application, the relay device communicating with the gateway device includes a primary relay device and a backup relay device. When the priority value of the primary relay device and the priority value of the backup relay device meet a preset switching condition, the primary and backup relay devices can be switched. Because the priority value represents the multicast service quality of the relay device, the gateway device can switch the relay device between the primary and backup positions based on the multicast service quality of the relay device. This can prevent the multicast service quality of the gateway device from being affected by a decrease in the multicast service quality of one relay device, thereby improving the multicast service quality of the gateway device.
[0162] In the embodiment of the present application, in order for the gateway device to perform active / standby switching according to the method flow shown in FIG2 , the gateway device must first determine the active relay device and the standby relay device. After the gateway device goes online, the active relay device and the standby relay device can be determined in the following manner:
[0163] After the gateway device goes online, it sends relay discovery messages to multiple relay devices, each of which includes a different anycast address.
[0164] Optionally, if there is only one backup relay device, you can preconfigure two relay addresses for each relay device. These two relay addresses have different IP address prefixes, and the forwarding paths between the gateway device and these two relay addresses are different. Consequently, each relay device will advertise routes with two different IP address prefixes, and the gateway device can learn the routes advertised by the relay device.
[0165] Accordingly, the gateway device can create a pseudo-interface for each active relay device and a pseudo-interface for each backup relay device, configuring the two pseudo-interfaces to back up each other. A relay discovery address prefix and a relay discovery address with the prefix are configured for each pseudo-interface.
[0166] For example, the Relay Discovery Address Prefix configured for pseudo-interface 1 is one of the IP address prefixes advertised by the relay device, and the Relay Discovery Address Prefix configured for pseudo-interface 2 is another IP address prefix advertised by the relay device.
[0167] Alternatively, the gateway device can create a pseudo-interface and configure two Relay Discovery Address Prefixes and two Relay Discovery Addresses on the pseudo-interface.
[0168] It can be understood that the above-mentioned relay discovery address is an anycast address. Assuming that the two relay discovery addresses configured by the gateway device are anycast address 1 and anycast address 2, the destination address of a relay discovery message sent is anycast address 1, and the relay discovery message can be routed to the relay device closest to the gateway device according to anycast address 1. Similarly, the destination address of another relay discovery message sent by the gateway device is anycast address 2, and the relay discovery message is routed to the relay device closest to the gateway device according to anycast address 2. Because the topological paths between the gateway device and anycast address 1 and anycast address 2 are different, the two relay discovery messages sent by the gateway device will be sent to two different relay devices.
[0169] After the gateway device sends the two relay discovery messages, if it receives a relay announcement message from a relay device within the first preset time period, the relay device that sends the relay announcement message will be used as the primary relay device.
[0170] Alternatively, if relay announcement messages are received from multiple relay devices within the first preset time period, a master relay device is selected from the multiple relay devices, and the relay announcement message sent by the selected master relay device carries the maximum priority value.
[0171] In other words, if relay notification messages are received from multiple relay devices within the first preset time period, and if one of the relay notification messages carries the largest priority value, the relay device corresponding to the relay notification message with the larger priority value will be used as the main relay device, and the other relay devices will be used as backup relay devices.
[0172] Optionally, after sending the two relay discovery messages, the gateway device may start an advertisement waiting timer, with the timeout duration of the advertisement waiting timer being the first preset duration. In this way, whether the first preset duration has been reached may be determined by the timer timeout mechanism.
[0173] If the gateway device does not receive a relay notification message sent by any relay device within the first preset time period, it may resend the relay discovery message according to the provisions of the AMT protocol.
[0174] After determining the primary relay device, the gateway device can establish an AMT tunnel with the primary relay device. The method for establishing the AMT tunnel between the gateway device and the primary relay device complies with the AMT protocol and will not be repeated here.
[0175] By adopting the embodiment of the present application, the gateway device can send multiple relay discovery messages, and each relay discovery message includes a different anycast address. Then, when a relay notification message is received within the first preset time period, the relay device that sent the relay notification message is used as the primary relay device. This ensures that the gateway device can establish an AMT tunnel with at least one relay device. Alternatively, when multiple relay notification messages are received within the first preset time period, the relay device corresponding to the relay notification message carrying the largest priority value can be used as the primary relay device, so that the gateway device can provide higher quality multicast services to multicast receivers.
[0176] In one embodiment of the present application, after establishing an AMT tunnel with the primary relay device, the gateway device can continue to obtain the priority values of the primary relay device and the backup relay device. The gateway device can obtain the priority value of the primary relay device by following steps A-B, and obtain the priority value of the backup relay device by following steps C-D.
[0177] Step A: Send a request message to the active relay device every second preset time period.
[0178] Among them, when the gateway device establishes an AMT tunnel with the main relay device, it will send a request message to the main relay device. After receiving the member query message replied by the main relay device and verifying that the request random number carried in the member query message is correct, the gateway device can start the periodic query keep-alive timer (Query Timer). The timeout period of the periodic query keep-alive timer is the second preset period.
[0179] Furthermore, whenever the query keep-alive timer times out, the gateway device sends a new request message to the active relay device.
[0180] The request message is a Request message in the AMT protocol, and the member query message is a Membership Query message in the AMT protocol.
[0181] Step B: receiving a member query message sent by the master relay device, wherein the member query message includes a priority value of the master relay device.
[0182] Each time the master relay device receives a request message, it can obtain its latest priority value and encapsulate the priority value in a member query message.
[0183] It is understandable that each time the gateway device sends a request message to the primary relay device, it can receive a member query message replied by the primary relay device, so that the gateway device can periodically obtain the priority value of the primary relay device.
[0184] According to the AMT protocol, after receiving the member query message, the gateway device will further send a member update message to the primary relay device.
[0185] Step C: Send a relay discovery message to the backup relay device every first preset time period.
[0186] Each time the gateway device sends a relay discovery message, it can start the above-mentioned advertisement waiting timer (Advertisement Timer). Whenever the advertisement waiting timer times out, it sends a relay discovery message to the backup relay device. The relay discovery message is a Relay Discovery message in the AMT protocol.
[0187] For example, after the gateway device goes online, it may start the notification waiting timer after sending relay discovery messages to multiple relay devices respectively.
[0188] For example, after a gateway device goes online, it sends two relay discovery messages with destination addresses of anycast address 1 and anycast address 2, respectively. If the relay discovery message with destination address of anycast address 1 is sent to relay device 1, and the gateway device determines that relay device 1 is the active relay device, the gateway device can subsequently send a relay discovery message with destination address of anycast address 2 each time the announcement wait timer expires.
[0189] Step D: Receive a relay notification message sent by the backup relay device, where the relay notification message includes the priority value of the backup relay device.
[0190] After receiving the relay discovery message, the standby relay device can obtain its latest priority value and encapsulate the priority value in a relay notification message. The relay notification message is a Relay Advertisement message in the AMT protocol.
[0191] It is understandable that each time the gateway device sends a relay discovery message to the backup relay device, it can receive a relay notification message replied by the backup relay device, so that the gateway device can periodically obtain the priority value of the backup relay device.
[0192] By adopting the embodiment of the present application, the gateway device can periodically obtain the priority values of the main relay device and the backup relay device, so that the gateway device can timely perform the main and backup switching according to the priority values of the main relay device and the backup relay device, thereby improving the quality of multicast service.
[0193] In this embodiment of the present application, the priority value may be determined based on the health parameters of the relay device, which include but are not limited to the following parameters:
[0194] The number of accessible multicast sources;
[0195] Network quality between the multicast source and the source;
[0196] Failure rate of the transmission path to the multicast source;
[0197] The quality of the routing link to the multicast source.
[0198] The network quality can include transmission delay, jitter, packet loss rate, etc. between the relay device and the multicast source.
[0199] The relay device may detect the failure rate of the transmission path between the relay device and the multicast source through a detection mechanism. For example, the detection mechanism may be a point 2 multiple point Bidirectional Forwarding Detection (P2MP BFD) mechanism.
[0200] Each health parameter of a relay device corresponds to a preset weight and threshold. The relay device's priority is the sum of the weights of each health parameter. Each time a health parameter is obtained, if a health parameter is less than its threshold, the priority is reduced by the weight associated with that health parameter. Once the health parameter is again greater than or equal to its threshold, the priority is increased by the weight associated with that health parameter.
[0201] The relay device can refresh its priority value periodically.
[0202] In one implementation, the relay device may calculate its own priority value based on its own health parameter.
[0203] In another implementation, the network controller may centrally monitor the health parameters of each relay device, calculate a priority value for each relay device, and then issue the priority value to each relay device.
[0204] In one embodiment of the present application, in the above S302, if the priority value of the active relay device and the priority value of the standby relay device meet the preset switching condition, switching between the active and standby relay devices is performed, specifically including the following three implementation methods:
[0205] Method 1: If the priority value of the backup relay device is greater than the priority value of the active relay device, the active and standby relay devices are switched.
[0206] That is, the preset switching condition may be: the priority value of the backup relay device is greater than the priority value of the main relay device.
[0207] If the priority value of the backup relay device is greater than the priority value of the primary relay device, it means that the multicast service quality of the backup relay device is higher, so the primary and backup relay devices can be switched, thereby switching the multicast tunnel to the AMT tunnel between the backup relay device, so that the gateway device can provide better multicast services for multicast receivers.
[0208] Method 2: If the priority value of the backup relay device is greater than the priority value of the main relay device, the main-backup switching timer is started. If the priority value of the backup relay device obtained last time is greater than the priority value of the main relay device before the main-backup switching timer times out, the main-backup relay device is switched.
[0209] That is, the preset switching condition can be: after detecting that the priority value of the backup relay device is greater than the priority value of the main relay device, start the main-backup switching timer. Before the main-backup switching timer times out, the priority value of the backup relay device obtained last time is greater than the priority value of the main relay device.
[0210] It is understood that if the priority value of the backup relay device last obtained by the gateway device before the master-slave switch timer expires is less than or equal to the priority value of the master relay device, the gateway device does not need to switch the master-slave relay device and still maintains the AMT tunnel with the master relay device. This can avoid frequent switching of the master-slave relay device due to factors such as network instability.
[0211] Method three: If the priority value of the backup relay device is greater than the priority value of the main relay device, the main-backup switching timer is started. If the priority value of the backup relay device obtained is greater than the priority value of the main relay device before the main-backup switching timer expires, the main and backup relay devices are switched.
[0212] That is, the preset switching condition is: if the priority value of the backup relay device is greater than the priority value of the main relay device, the main-backup switching timer is started. Before the main-backup switching timer times out, the priority value of the backup relay device obtained is greater than the priority value of the main relay device.
[0213] On the contrary, if before the master-slave switching timer times out, the priority value of the backup relay device obtained at any time is less than or equal to the priority value of the master relay device, there is no need to switch the master-slave relay device, and the AMT tunnel with the master relay device is still maintained.
[0214] In this way, if the priority value of the backup relay device continues to be greater than the priority value of the main relay device within a period of time, the main and backup relay devices will be switched, otherwise no switching will be performed. This can avoid frequent switching of the main and backup relay devices due to factors such as network instability.
[0215] In one embodiment of the present application, after the gateway device determines that the priority values of the active relay device and the backup relay device meet the preset switching conditions, the steps of switching the active and backup relay devices specifically include:
[0216] The gateway device sends a request message to the backup relay device. If it receives a member query message from the backup relay device, it sends a member update message to the backup relay device. After sending the member update message to the backup relay device, the AMT tunnel between the gateway device and the backup relay device is established.
[0217] In addition, if a member query message is received from a backup relay device, the gateway device must also stop the periodic query keep-alive timer (Query timer) between the gateway device and the primary relay device. If no member query message is received from the primary relay device within the third preset time period, the AMT tunnel information between the gateway device and the primary relay device is deleted. The timeout period of the periodic query keep-alive timer is the second preset time period. The AMT tunnel information may include an identifier of the AMT tunnel, as well as other information used to describe the AMT tunnel. For details, please refer to the relevant provisions of the AMT protocol. The third preset time period can also be implemented through a timer, and the setting of the third preset time period may comply with the provisions of the IGMP protocol or the MLD protocol.
[0218] Among them, after the gateway device stops the periodic query keep-alive timer between it and the active relay device, it will stop sending member query messages to the active relay device every second preset time. Accordingly, the active relay device will not reply to the member query message.
[0219] After the gateway device sends a request message to the backup relay device, if it receives a member query message from the backup relay device, it indicates that the gateway device is able to communicate with the backup relay device, that is, it is able to establish an AMT tunnel with the backup relay device. Therefore, the gateway device can delete the AMT tunnel information between it and the primary relay device in the above manner. It is understandable that after the gateway device deletes the AMT tunnel information between it and the primary device, it is equivalent to disconnecting the AMT tunnel between it and the primary device, and the primary relay device will no longer send multicast data to the gateway device through the AMT tunnel.
[0220] After the gateway device deletes the AMT tunnel information between it and the primary relay device, the gateway device may also perform the following steps:
[0221] Send a relay discovery message to the active relay device every first preset time period.
[0222] After the gateway device deletes the AMT tunnel information between it and the primary relay device, the primary relay device has changed to a backup role, so the gateway device needs to enable the notification waiting timer for the primary relay device, that is, start sending relay discovery messages to the primary relay device every first preset time period. Correspondingly, the primary relay device will also reply with a relay notification message carrying a priority value.
[0223] In addition, after receiving the member query message sent by the backup relay device, the gateway device may send a relay announcement message to the backup relay device every second preset time period.
[0224] Since the gateway device has established an AMT tunnel with the backup relay device, the backup relay device has now changed to the active role, so the gateway device can turn off the advertisement waiting timer (Advertisement Timer) maintained for the backup relay device, that is, stop sending relay discovery messages to the backup relay device every first preset time period.
[0225] The gateway device may also enable a periodic query keep-alive timer (Query timer) for the backup relay device, ie, start sending a request message to the backup relay device every second preset time period. Correspondingly, the backup relay device will also reply to a member query message carrying a priority value.
[0226] In this way, the switching of the master and backup relay devices is completed, and the master and backup roles of the master relay device and the backup relay device are exchanged. Subsequently, the priority values of the master relay device and the backup relay device can still be periodically obtained according to the method in the above embodiment, and when the preset switching conditions are met, the master and backup relay devices can be switched again.
[0227] Based on the introduction of the above embodiments, the embodiments of the present application add priority values to both the member query message and the relay announcement message. The message formats of the member query message and the relay announcement message are introduced below.
[0228] In one embodiment of the present application, the member query message includes a first flag bit field and a priority field. When the first flag bit field takes a first value, it is used to indicate that the priority field carries the priority value of the primary relay device.
[0229] In addition, the member query message also includes a second flag bit field.
[0230] If the second flag bit field takes the first value, it indicates that the priority field is located after the gateway address field and adjacent to the gateway address field;
[0231] If the value of the second flag bit field is the second value, it means that the priority field is located after the encapsulation information of the common query message and is adjacent to the encapsulation information.
[0232] For example, the first value may be 1 and the second value may be 0.
[0233] As an example, as shown in FIG4 , FIG4 is a schematic diagram of the structure of the member query message when the value of the second flag bit field is the first value.
[0234] The Membership Query Message includes the following fields: Version, Type, Reserved, P Flag, L Flag, G Flag, Response Media Access Control (Response MAC) address, Request Nonce, Encapsulated General Query Message, Gateway Port Number, Gateway IP Address, and Priority.
[0235] The value of the Type field is 4. If the gateway device and the relay device communicate using the IPv4 protocol, the regular query message is a Membership Query message based on the IGMPv3 protocol. If the gateway device and the relay device communicate using the IPv6 protocol, the regular query message is a Listener Query message based on the MLDv2 protocol. The IP address of the gateway device can be an IPv4 address or an IPv6 address.
[0236] The first flag bit field is a P flag bit field, and the second flag bit field is a G flag bit field. When both the P flag bit field and the G flag bit field are 1, it indicates that the priority field is located after the Gateway IP Address field in FIG4 .
[0237] When the P flag field is 1 and the G flag field is 0, the Member Query message does not include the Gateway Port Number field and the Gateway IP Address field, and the Priority field is located after the Encapsulated General Query Message in Figure 4.
[0238] In another embodiment of the present application, the relay announcement message includes a priority field, and the priority field is used to carry the priority value of the standby relay device.
[0239] As an example, as shown in Figure 5, Figure 5 is a schematic diagram of a relay notification message provided in an embodiment of the present application. The relay notification message includes the following fields: version (Version), type (Type), priority (Priority), reserved bit (Reserved), discovery random number (Discovery Nonce) and relay address (Relay Address). Among them, the value of the version (Version) field is 0, the value of the type (Type) field is 2, and the relay address (Relay Address) field includes an IPv4 address or an IPv6 address. The priority field is located after the type field and is adjacent to the type field.
[0240] In the above-mentioned member query message and trunk query message, the priority field is an 8-bit unsigned integer with a valid range of 1 to 255. When the priority field value is 0, it indicates that the priority field does not carry the priority value of the active trunk device.
[0241] As shown in FIG6 , FIG6 is a flow chart of the active-standby switching method provided in an embodiment of the present application, which may include the following steps: S601 - S608 .
[0242] S601: The gateway device sends a relay discovery message (Relay Discovery) to the first relay device and the second relay device.
[0243] S602: After receiving the relay transmission message, the first relay device sends a relay notification message (Relay Advertisement) to the gateway device.
[0244] The relay notification message includes the first priority value of the first relay device.
[0245] S603: After receiving the relay transmission message, the second relay device sends a relay advertisement message (Relay Advertisement) to the gateway device.
[0246] The relay notification message includes the second priority value of the second relay device.
[0247] After receiving the relay notification messages sent by the first relay device and the second relay device, the gateway device determines the relationship between the first priority value and the second priority value. If the first priority value is greater than the second priority value, the gateway device determines the first relay device as the main relay device and the second relay device as the backup relay device.
[0248] S604: The gateway device sends a request message (Request) to the first relay device.
[0249] Taking the example that the priority value of the first relay device is greater than the priority value of the second relay device, the gateway device uses the first relay device as the main relay device and the second relay device as the backup relay device. Based on the AMT protocol regulations, the gateway device will send a request message to the first relay device.
[0250] S605: After receiving the request message, the first relay device sends a membership query message (Membership Query) to the gateway device.
[0251] The member query message includes the latest first priority value of the first relay device.
[0252] After receiving the member query message, the gateway device may start a periodic query keep-alive timer (Query Timer). Whenever the periodic query keep-alive timer times out, the gateway device is triggered to resend a request message to the first relay device.
[0253] S606: The gateway device sends a membership update message (Membership Update) to the first relay device.
[0254] After the first relay device receives and processes the member update message, the AMT tunnel is established between the gateway device and the first relay device.
[0255] It is understandable that the priority value of the relay device will change. After determining that the first relay device is the primary relay device and the second relay device is the backup relay device, the advertisement wait timer can be started. Specifically, the advertisement wait timer can be started after the gateway device receives the member query message sent by the first relay device. Whenever the advertisement wait timer times out, the following steps are triggered:
[0256] S607: The gateway device sends a relay discovery message (Relay Discovery) to the second relay device.
[0257] S608: The second relay device sends a relay advertisement message (Relay Advertisement) to the gateway device.
[0258] Similarly, the relay notification message carries the latest second priority value of the second relay device, so that the gateway device can obtain the second priority value of the second relay device in a timely manner.
[0259] The specific implementation methods of the above steps have been described in detail above and will not be repeated here.
[0260] As shown in FIG7 , FIG7 is a flow chart of another active-standby switching method provided in an embodiment of the present application. The method may include the following steps: S701 - S707 .
[0261] S701: When the periodic query keep-alive timer times out, the gateway device sends a request message (Request) to the first relay device.
[0262] Here, the first relay device is the main relay device at this time.
[0263] S702: The first relay device sends a membership query message (Membership Query) to the gateway device.
[0264] The gateway device receives the member query message and obtains the priority value of the first relay device. If the priority value of the first relay device is less than the priority value of the second relay device, the master / slave role switching is performed.
[0265] S703: The gateway device sends a request message (Request) to the second relay device.
[0266] S704: The second relay device sends a membership query message (Membership Query) to the gateway device.
[0267] The member query message carries the priority value of the second relay device.
[0268] After the gateway device receives the member query message, it indicates that the second relay device can be used as the main relay device. The gateway device stops the periodic query keep-alive timer (Query Timer) of the first relay device and starts the periodic query keep-alive timer between it and the second relay device. Whenever the periodic query keep-alive timer of the second relay device times out, a new request message is sent to the second relay device.
[0269] S705: The gateway device sends a membership update message (Membership Update) to the second relay device.
[0270] After the second relay device receives and processes the member update message, the gateway device and the second relay device complete the establishment of the AMT tunnel.
[0271] At this time, the second relay device switches to the active relay device, and the first relay device switches to the standby relay device.
[0272] It is understandable that after receiving the member query message in the above S704, the gateway device can stop the periodic query keep-alive timer of the first relay device, and the gateway device will not continue to send request messages to the first relay device, and the first relay device will not reply to the member query message to the gateway device.
[0273] If the gateway device does not receive the member query message within the third preset time period, the first relay device's advertisement waiting timer may be started. Whenever the first relay device's advertisement waiting timer times out, the following steps may be performed:
[0274] S706: The gateway device sends a relay discovery message (Relay Discovery) to the first relay device.
[0275] S707: The first relay device sends a relay advertisement message (Relay Advertisement) to the gateway device.
[0276] Likewise, the relay notification message carries the priority value of the second relay device, so that the gateway device can obtain the priority value of the second relay device in a timely manner.
[0277] The specific implementation methods of the above steps have been described in detail above and will not be repeated here.
[0278] Based on the same inventive concept, an embodiment of the present application further provides a master-slave switching device, which is applied to a gateway device. As shown in FIG8 , the device includes:
[0279] An acquisition module 801 is configured to acquire a priority value of a primary relay device and a priority value of a backup relay device, wherein the priority value is used to indicate the multicast service quality of the relay device;
[0280] The switching module 802 is configured to switch the primary and backup relay devices if the priority values of the primary relay device and the backup relay device meet a preset switching condition.
[0281] Optionally, the device further comprises:
[0282] A sending module is used to send relay discovery messages to multiple relay devices after the gateway device goes online, each relay discovery message includes a different anycast address;
[0283] A selection module is configured to, if a relay notification message sent by a relay device is received within a first preset time length, select the relay device that sent the relay notification message as the primary relay device; or, if multiple relay notification messages sent by multiple relay devices are received within the first preset time length, select the primary relay device from the multiple relay devices, the relay notification message sent by the primary relay device carrying the maximum priority value;
[0284] The establishment module is used to establish an AMT tunnel with the primary relay device.
[0285] Optionally, the acquisition module 801 is specifically configured to:
[0286] Sending a request message to the primary relay device every second preset time period;
[0287] Receive a member query message sent by the primary relay device, where the member query message includes the priority value of the primary relay device;
[0288] Sending a relay discovery message to the backup relay device every first preset time period;
[0289] Receive a relay notification message sent by a backup relay device, where the relay notification message includes a priority value of the backup relay device.
[0290] Optionally, the switching module 802 is specifically configured to:
[0291] If the priority value of the backup relay device is greater than the priority value of the main relay device, the main and backup relay devices are switched; or
[0292] If the priority value of the backup relay device is greater than the priority value of the main relay device, the main-backup switching timer is started. If the priority value of the backup relay device obtained last time is greater than the priority value of the main relay device before the main-backup switching timer times out, the main-backup relay device is switched; or
[0293] If the priority value of the backup relay device is greater than the priority value of the main relay device, the main-backup switching timer is started. If the priority value of the backup relay device obtained is greater than the priority value of the main relay device before the main-backup switching timer times out, the main-backup relay device is switched.
[0294] Optionally, the switching module 802 is specifically configured to:
[0295] Send a request message to the backup relay device;
[0296] If a member query message is received from the backup relay device, a member update message is sent to the backup relay device, and a periodic query keep-alive timer is stopped between the backup relay device and the active relay device, where the timeout period of the periodic query keep-alive timer is the second preset period;
[0297] If the member query message sent by the active relay device is not received within the third preset time period, the AMT tunnel information between the active relay device and the active relay device is deleted.
[0298] Optionally, the switching module 802 is further configured to send a relay discovery message to the active relay device every first preset time period; the switching module 802 is further configured to send a request message to the standby relay device every second preset time period.
[0299] Optionally, the member query message includes a first flag bit field and a priority field. When the first flag bit field takes a first value, it is used to indicate that the priority field carries the priority value of the primary relay device.
[0300] Optionally, the member query message further includes a second flag bit field;
[0301] If the second flag bit field takes the first value, it indicates that the priority field is located after the gateway address field and adjacent to the gateway address field;
[0302] If the value of the second flag bit field is the second value, it means that the priority field is located after the encapsulation information of the common query message and is adjacent to the encapsulation information.
[0303] Optionally, the relay notification message includes a priority field, and the priority field is used to carry the priority value of the backup relay device.
[0304] Optionally, the priority field occupies 8 reserved bits. When the priority field takes a value of 0, it indicates that the priority field does not carry a priority value.
[0305] Optionally, the priority value is determined based on the health parameters of the relay device, which include any one or more of the following: the number of accessible multicast sources; the network quality between the multicast source; the failure rate of the transmission path between the multicast source; and the quality of the routing link between the multicast source.
[0306] The embodiment of the present application further provides a gateway device, as shown in FIG9 , which includes:
[0307] Processor 901;
[0308] transceiver 904;
[0309] A machine-readable storage medium 902 stores machine-executable instructions that can be executed by the processor 901; the machine-executable instructions prompt the processor 901 to perform the following steps:
[0310] Obtaining, through the transceiver 904, a priority value of the active relay device and a priority value of the standby relay device, the priority value being used to indicate the multicast service quality of the relay device;
[0311] If the priority values of the active relay device and the backup relay device meet a preset switching condition, the active and backup relay devices are switched.
[0312] Optionally, the machine executable instructions further cause the processor 901 to perform the following steps:
[0313] After the gateway device goes online, it sends relay discovery messages to multiple relay devices through the transceiver 904, each relay discovery message includes a different anycast address;
[0314] If a relay announcement message is received from a relay device through the transceiver 904 within the first preset time period, the relay device that sent the relay announcement message is used as the master relay device; or if multiple relay announcement messages are received from multiple relay devices through the transceiver 904 within the first preset time period, the master relay device is selected from the multiple relay devices, and the relay announcement message sent by the master relay device carries the maximum priority value;
[0315] Establish an AMT tunnel with the active relay device.
[0316] Optionally, the machine executable instructions further cause the processor 901 to perform the following steps:
[0317] Every second preset time period, sending a request message to the primary relay device through the transceiver 904;
[0318] Receiving a member query message sent by the primary relay device through the transceiver 904, where the member query message includes a priority value of the primary relay device;
[0319] Every first preset time period, sending a relay discovery message to the backup relay device through the transceiver 904;
[0320] The relay notification message sent by the backup relay device is received through the transceiver 904. The relay notification message includes the priority value of the backup relay device.
[0321] Optionally, the machine executable instructions further cause the processor 901 to perform the following steps:
[0322] If the priority value of the backup relay device is greater than the priority value of the main relay device, the main and backup relay devices are switched; or
[0323] If the priority value of the backup relay device is greater than the priority value of the main relay device, the main-backup switching timer is started. If the priority value of the backup relay device obtained last time is greater than the priority value of the main relay device before the main-backup switching timer times out, the main-backup relay device is switched; or
[0324] If the priority value of the backup relay device is greater than the priority value of the main relay device, the main-backup switching timer is started. If the priority value of the backup relay device obtained is greater than the priority value of the main relay device before the main-backup switching timer times out, the main-backup relay device is switched.
[0325] Optionally, the machine executable instructions further cause the processor 901 to perform the following steps:
[0326] Sending a request message to the backup relay device via the transceiver 904;
[0327] If a member query message sent by the backup relay device is received through the transceiver 904, a member update message is sent to the backup relay device through the transceiver 904, and a periodic query keep-alive timer between the standby relay device and the active relay device is stopped, and the timeout period of the periodic query keep-alive timer is the second preset period;
[0328] If the member query message sent by the active relay device is not received through the transceiver 904 within the third preset time period, the AMT tunnel information between the active relay device and the active relay device is deleted.
[0329] Optionally, the machine executable instructions further cause the processor 901 to perform the following steps:
[0330] Sending a relay discovery message to the active relay device via the transceiver 904 every first preset time period;
[0331] The machine executable instructions further cause the processor 901 to perform the following steps:
[0332] Every second preset time period, a request message is sent to the backup relay device via the transceiver 904 .
[0333] Optionally, the member query message includes a first flag bit field and a priority field. When the first flag bit field takes a first value, it is used to indicate that the priority field carries the priority value of the primary relay device.
[0334] Optionally, the member query message further includes a second flag bit field;
[0335] If the second flag bit field takes the first value, it indicates that the priority field is located after the gateway address field and adjacent to the gateway address field;
[0336] If the value of the second flag bit field is the second value, it means that the priority field is located after the encapsulation information of the common query message and is adjacent to the encapsulation information.
[0337] Optionally, the relay notification message includes a priority field, and the priority field is used to carry the priority value of the backup relay device.
[0338] Optionally, the priority field occupies 8 reserved bits. When the priority field takes a value of 0, it indicates that the priority field does not carry a priority value.
[0339] Optionally, the priority value is determined based on the health parameters of the relay device, which include any one or more of the following: the number of accessible multicast sources; the network quality between the multicast source; the failure rate of the transmission path between the multicast source; and the quality of the routing link between the multicast source.
[0340] As shown in Figure 9, the gateway device may further include a communication bus 903. The processor 901, the machine-readable storage medium 902, and the transceiver 904 communicate with each other via the communication bus 903. The communication bus 903 may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. The communication bus 903 may be divided into an address bus, a data bus, a control bus, and the like.
[0341] The transceiver 904 may be a wireless communication module. Under the control of the processor 901 , the transceiver 904 exchanges data with other devices.
[0342] The machine-readable storage medium 902 may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Alternatively, the machine-readable storage medium 902 may be at least one storage device located remotely from the processor.
[0343] The processor 901 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0344] Based on the same inventive concept, according to the active / standby switching method provided in the above embodiments of the present application, the present application also provides a machine-readable storage medium storing machine-executable instructions that can be executed by a processor. The processor is prompted by the machine-executable instructions to implement any of the steps of the above active / standby switching method.
[0345] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the steps of any active-standby switching method in the above embodiments.
[0346] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0347] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for switching between active and standby devices, It is characterized in that Applicable to gateway devices, including: Obtaining a priority value of a primary relay device and a priority value of a backup relay device, wherein the priority values are used to indicate the multicast service quality of the relay device; If the magnitude relationship between the priority values of the active relay device and the backup relay device meets a preset switching condition, the active and backup relay devices are switched.
2. The method according to claim 1, It is characterized in that The method further comprises: After the gateway device is online, a relay discovery message is sent to multiple relay devices respectively, each relay discovery message includes a different anycast address; If a relay notification message sent by a relay device is received within a first preset time length, the relay device that sent the relay notification message is used as the main relay device; or, if multiple relay notification messages sent by multiple relay devices are received within the first preset time length, a main relay device is selected from the multiple relay devices, and the relay notification message sent by the main relay device carries the maximum priority value; An AMT tunnel is established with the primary relay device.
3. The method according to claim 1, It is characterized in that The obtaining of the priority value of the active relay device and the priority value of the standby relay device includes: Sending a request message to the primary relay device every second preset time period; receiving a member query message sent by the primary relay device, wherein the member query message includes a priority value of the primary relay device; Sending a relay discovery message to the standby relay device every first preset time period; A relay notification message sent by the standby relay device is received, wherein the relay notification message includes a priority value of the standby relay device.
4. The method according to claim 3, It is characterized in that If the magnitude relationship between the priority values of the active relay device and the backup relay device meets a preset switching condition, switching between the active and backup relay devices is performed, including: If the priority value of the backup relay device is greater than the priority value of the active relay device, switching between the active and backup relay devices is performed; or, If the priority value of the backup relay device is greater than the priority value of the active relay device, the active-standby switching timer is started; if the priority value of the backup relay device obtained last time before the active-standby switching timer times out is greater than the priority value of the active relay device, the active-standby relay device is switched; or, If the priority value of the backup relay device is greater than the priority value of the main relay device, the master-slave switching timer is started. If the priority values of the backup relay devices obtained are greater than the priority value of the main relay device before the master-slave switching timer times out, the master-slave relay devices are switched.
5. The method according to claim 3, It is characterized in that The switching of the main and standby relay devices includes: Sending a request message to the standby relay device; If a member query message sent by the backup relay device is received, a member update message is sent to the backup relay device, and a periodic query keep-alive timer between the backup relay device and the active relay device is stopped, and the timeout period of the periodic query keep-alive timer is the second preset timer. Set duration; If the member query message sent by the primary relay device is not received within the third preset time period, the AMT tunnel information between the primary relay device and the primary relay device is deleted.
6. The method according to claim 5, It is characterized in that After deleting the AMT tunnel information between the master relay device and the master relay device, the method further includes: Sending a relay discovery message to the active relay device every first preset time period; After receiving the member query message sent by the standby relay device, the method further includes: Send a request message to the standby relay device at every second preset time period.
7. The method according to claim 3, It is characterized in that The member query message includes a first flag bit field and a priority field. When the first flag bit field takes a first value, it is used to indicate that the priority field carries the priority value of the primary relay device.
8. The method according to claim 7, It is characterized in that The member query message also includes a second flag bit field; If the value of the second flag bit field is the first value, it means that the priority field is located after the gateway address field and adjacent to the gateway address field; If the value of the second flag bit field is the second value, it means that the priority field is located after the encapsulation information of the common query message and is adjacent to the encapsulation information.
9. The method according to claim 3, It is characterized in that The relay notification message includes a priority field, and the priority field is used to carry the priority value of the standby relay device.
10. The method according to claim 7 or 9, It is characterized in that The priority field occupies 8 reserved bits. When the priority field takes a value of 0, it indicates that the priority field does not carry a priority value.
11. The method according to claim 1, It is characterized in that The priority value is determined based on the health parameter of the relay device, and the health parameter includes any one or more of the following: The number of accessible multicast sources; Network quality with the multicast source; The failure rate of the transmission path to the multicast source; The quality of the routing link to the multicast source.
12. A master-slave switching device, It is characterized in that Applied to a gateway device, the device comprises: An acquisition module, used to acquire a priority value of a primary relay device and a priority value of a backup relay device, wherein the priority value is used to indicate the multicast service quality of the relay device; The switching module is used to switch the primary and backup relay devices if the magnitude relationship between the priority values of the primary relay device and the backup relay device meets a preset switching condition.
13. The device according to claim 12, It is characterized in that The device also includes: A sending module, used for sending relay discovery messages to multiple relay devices respectively after the gateway device is online, each relay discovery message including a different anycast address; The selection module is used to, if a relay notification message sent by a relay device is received within a first preset time length, use the relay device that sent the relay notification message as the main relay device; or, if multiple relay devices send a relay notification message within the first preset time length, multiple relay notification messages, then select a master relay device from the multiple relay devices, the relay notification message sent by the master relay device carrying the maximum priority value; An establishing module is used to establish an AMT tunnel with the primary relay device.
14. The device according to claim 12, It is characterized in that The acquisition module is specifically used for: Sending a request message to the primary relay device every second preset time period; receiving a member query message sent by the primary relay device, wherein the member query message includes a priority value of the primary relay device; Sending a relay discovery message to the standby relay device every first preset time period; A relay notification message sent by the standby relay device is received, wherein the relay notification message includes a priority value of the standby relay device.
15. The device according to claim 14, It is characterized in that The switching module is specifically used for: If the priority value of the backup relay device is greater than the priority value of the active relay device, switching between the active and backup relay devices is performed; or, If the priority value of the backup relay device is greater than the priority value of the active relay device, the active-standby switching timer is started; if the priority value of the backup relay device obtained last time before the active-standby switching timer times out is greater than the priority value of the active relay device, the active-standby relay device is switched; or, If the priority value of the backup relay device is greater than the priority value of the main relay device, the master-slave switching timer is started. If the priority values of the backup relay devices obtained are greater than the priority value of the main relay device before the master-slave switching timer times out, the master-slave relay devices are switched.
16. The device according to claim 14, It is characterized in that The switching module is specifically used for: Sending a request message to the standby relay device; If a member query message sent by the standby relay device is received, a member update message is sent to the standby relay device, and a periodic query keep-alive timer between the standby relay device and the active relay device is stopped, and the timeout duration of the periodic query keep-alive timer is the second preset duration; If the member query message sent by the primary relay device is not received within the third preset time period, the AMT tunnel information between the primary relay device and the primary relay device is deleted.
17. The device according to claim 16, It is characterized in that The switching module is further configured to send a relay discovery message to the primary relay device at intervals of the first preset time length; The switching module is further configured to send a request message to the standby relay device every second preset time period.
18. The device according to claim 14, It is characterized in that The member query message includes a first flag bit field and a priority field. When the first flag bit field takes a first value, it is used to indicate that the priority field carries the priority value of the primary relay device.
19. The device according to claim 18, It is characterized in that The member query message also includes a second flag bit field; If the value of the second flag bit field is the first value, it means that the priority field is located after the gateway address field and adjacent to the gateway address field; If the value of the second flag bit field is the second value, it means that the priority field is located after the encapsulation information of the common query message. A position adjacent to the packaging information.
20. The device according to claim 14, It is characterized in that The relay notification message includes a priority field, and the priority field is used to carry the priority value of the standby relay device.
21. The device according to claim 18 or 20, It is characterized in that The priority field occupies 8 reserved bits. When the priority field takes a value of 0, it indicates that the priority field does not carry a priority value.
22. The device according to claim 12, It is characterized in that The priority value is determined based on the health parameter of the relay device, and the health parameter includes any one or more of the following: The number of accessible multicast sources; Network quality with the multicast source; The failure rate of the transmission path to the multicast source; The quality of the routing link to the multicast source.
23. A gateway device, It is characterized in that The gateway device comprises: processor; Transceiver; A machine-readable storage medium storing machine-executable instructions that can be executed by the processor; the machine-executable instructions prompt the processor to perform the following steps: Obtaining a priority value of a primary relay device and a priority value of a backup relay device, wherein the priority values are used to indicate the multicast service quality of the relay device; If the magnitude relationship between the priority values of the active relay device and the backup relay device meets a preset switching condition, the active and backup relay devices are switched.
24. The gateway device according to claim 23, It is characterized in that The machine executable instructions further cause the processor to perform the following steps: After the gateway device is online, a relay discovery message is sent to multiple relay devices respectively through the transceiver, each relay discovery message includes a different anycast address; If a relay notification message sent by a relay device is received through the transceiver within a first preset time length, the relay device that sent the relay notification message is used as the main relay device; or, if multiple relay notification messages sent by multiple relay devices are received through the transceiver within the first preset time length, a main relay device is selected from the multiple relay devices, and the relay notification message sent by the main relay device carries the maximum priority value; An AMT tunnel is established with the primary relay device.
25. The gateway device according to claim 23, It is characterized in that The machine executable instructions further cause the processor to perform the following steps: Every second preset time period, sending a request message to the active relay device through the transceiver; Receiving, by the transceiver, a member query message sent by the primary relay device, wherein the member query message includes a priority value of the primary relay device; At every first preset time period, sending a relay discovery message to the standby relay device through the transceiver; The relay notification message sent by the standby relay device is received by the transceiver, and the relay notification message includes the standby relay device. The priority value of the relay device.
26. The gateway device according to claim 25, It is characterized in that The machine executable instructions further cause the processor to perform the following steps: If the priority value of the backup relay device is greater than the priority value of the active relay device, switching between the active and backup relay devices is performed; or, If the priority value of the backup relay device is greater than the priority value of the active relay device, the active-standby switching timer is started; if the priority value of the backup relay device obtained last time before the active-standby switching timer times out is greater than the priority value of the active relay device, the active-standby relay device is switched; or, If the priority value of the backup relay device is greater than the priority value of the main relay device, the master-slave switching timer is started. If the priority values of the backup relay devices obtained are greater than the priority value of the main relay device before the master-slave switching timer times out, the master-slave relay devices are switched.
27. The gateway device according to claim 25, It is characterized in that The machine executable instructions further cause the processor to perform the following steps: Sending a request message to the standby relay device through the transceiver; If a member query message sent by the standby relay device is received through the transceiver, a member update message is sent to the standby relay device through the transceiver, and a periodic query keep-alive timer between the standby relay device and the active relay device is stopped, and the timeout duration of the periodic query keep-alive timer is the second preset duration; If the member query message sent by the primary relay device is not received through the transceiver within the third preset time period, the AMT tunnel information between the primary relay device and the primary relay device is deleted.
28. The gateway device according to claim 27, It is characterized in that The machine executable instructions further cause the processor to perform the following steps: Sending a relay discovery message to the active relay device through the transceiver at intervals of the first preset time; The machine executable instructions further cause the processor to perform the following steps: At every second preset time period, a request message is sent to the standby relay device through the transceiver.
29. The gateway device according to claim 25, It is characterized in that The member query message includes a first flag bit field and a priority field. When the first flag bit field takes a first value, it is used to indicate that the priority field carries the priority value of the primary relay device.
30. The gateway device according to claim 29, It is characterized in that The member query message also includes a second flag bit field; If the value of the second flag bit field is the first value, it means that the priority field is located after the gateway address field and adjacent to the gateway address field; If the value of the second flag bit field is the second value, it means that the priority field is located after the encapsulation information of the common query message and is adjacent to the encapsulation information.
31. The gateway device according to claim 25, It is characterized in that The relay notification message includes a priority field, and the priority field is used to carry the priority value of the standby relay device.
32. The gateway device according to claim 29 or 31, It is characterized in that The priority field occupies 8 reserved bits. When the priority field takes a value of 0, it indicates that the priority field does not carry a priority value.
33. The gateway device according to claim 23, It is characterized in that The priority value is determined based on the health parameter of the relay device, and the health parameter includes any one or more of the following: The number of accessible multicast sources; Network quality with the multicast source; The failure rate of the transmission path to the multicast source; The quality of the routing link to the multicast source.
34. A machine-readable storage medium, It is characterized in that Machine executable instructions are stored, and when called and executed by a processor, the machine executable instructions prompt the processor to: implement the method steps described in any one of claims 1-11.
35. A computer program product, It is characterized in that The computer program product causes the processor to implement the method steps described in any one of claims 1-11.
Citation Information
Patent Citations
Method and equipment for implementing 6to4 relay routing device backup
CN101141409A
Method for optimizing multicast quality and electronic equipment
CN112637078A
Main and standby switching management method and device, equipment and machine readable storage medium
CN113794541A
Gateway redundancy protocol for communications networks
US20170118067A1
