The present application relates to the communications field, and in particular, to a virtual router redundancy protocol fault detection method and a routing device.
A virtual router redundancy protocol (VRRP) is an error tolerance protocol. The protocol ensures, by combining several physical routing devices into one virtual routing device and by using a mechanism, to switch a service to another router in time when a next-hop router of a host is faulty, so as to maintain continuity and reliability of communication.
The VRRP allocates routers in a local area network into a group, where the group of routers is referred to as a VRRP backup group (a VRRP group for short). The VRRP group is equivalent to a virtual router. The virtual router has a virtual Internet Protocol (IP) address. The host in the local area network only needs to know a virtual IP address of the virtual router and set the virtual IP address of the virtual router to a next-hop address of a default route, and then the host can communicate with an external network by using the virtual router. The VRRP group includes one primary router and multiple secondary routers. The primary router is elected according to a priority election mechanism, to functions as a gateway, respond to an Address Resolution Protocol (ARP) request for the virtual IP address, and forward a packet whose destination Media Access Control (MAC) address is a MAC address of the virtual router. The virtual IP address of the VRRP group actually points to the primary router. Another router in the VRRP group is a secondary router. When the primary router is faulty, the secondary router replaces, by using the priority election mechanism, the primary router to continue functioning as the gateway, so as to ensure that the host in the network uninterruptedly communicates with the external network.
A conventional VRRP performs fault detection by sending a Hello packet at a scheduled time, and a default time interval of sending a VRRP protocol packet is one second. When the secondary router cannot receive a Hello packet of the primary router for consecutive three times, a new primary router is determined among the secondary routers by means of priority election, so as to perform active/standby switching. Because a minimum time interval of sending the Hello packet is usually one second, a link fault status can be perceived by the secondary router in at least three seconds, which is a relatively long convergence time for a real-time service that needs to rapidly perceive the link fault status.
An objective of the present application is to provide a virtual router redundancy protocol fault detection method and a routing device.
According to a first aspect, an embodiment of the present application provides a virtual router redundancy protocol fault detection method. The method is applied to a virtual router redundancy protocol (VRRP) group including one primary router and one or more secondary routers. The method includes sending, by the primary router and the secondary router, link detection packets having an echo response function, where a destination address of the link detection packet is a virtual address of the VRRP group. The method also includes determining, by the primary router and the secondary router, whether response packets corresponding to the link detection packets sent by the primary router and the secondary router are received within a predetermined time, and if the primary router and/or the secondary router does not receive the response packet within the predetermined time, determining that the primary router is faulty.
In a first possible implementation manner of the first aspect, the link detection packet is an ECHO-type bidirectional forwarding detection (BFD) packet.
According to a second aspect, an embodiment of the present application provides a routing device. The routing device is applied to a virtual router redundancy protocol (VRRP) group including one primary router and one or more secondary routers. The routing device is one of the primary router or the secondary routers. The routing device includes a sending module, configured to send a link detection packet having an echo response function, where a destination address of the link detection packet is a virtual address of the VRRP group. The routing device also includes a determining module, configured to: determine whether a response packet corresponding to the link detection packet sent by the sending module is received within a predetermined time, and if the response packet is not received within the predetermined time, determine that the primary router is faulty.
In a first possible implementation manner of the second aspect, the link detection packet sent by the sending module is an ECHO-type bidirectional forwarding detection (BFD) packet.
According to a third aspect, an embodiment of the present application provides a virtual router redundancy protocol (VRRP group), where the VRRP group includes one primary router and multiple secondary routers, the primary router and the secondary routers are configured to: send link detection packets having an echo response function, where a destination address of the link detection packet sent by each of the primary router and the secondary routers is a virtual IP address of the VRRP group; and if the primary router and/or the secondary router does not receive a response packet within a predetermined time, determine that the primary router is faulty.
In a first possible implementation manner of the third aspect, the link detection packet is an ECHO-type bidirectional forwarding detection (BFD) packet.
Technical solutions of the embodiments of the present application may implement rapid fault detection on a VRRP group network in a one primary multiple secondaries environment. The reason why in the prior art, configuration of a link detection session by the VRRP group is hard to implement in the one primary multiple secondaries network environment is that the link detection session needs to be established between every two routers of all routers, so as to ensure that after the VRRP group performs active/standby switching, the link detection session can still exist between all secondary routers and a primary router. Therefore, each router in the VRRP group simultaneously receives a link detection packet from a primary router and a link detection packet from another secondary router. However, because a primary router and a secondary router in the VRRP group are dynamically switched, and it cannot be identified, by using the link detection packets, whether a detected faulty link is a link to which the primary router belongs or a link to which the secondary router belongs, the VRRP group cannot be triggered to perform active/standby switching. However, in the technical solutions of the embodiments of the present application, an echo-response-type packet is used as a fault detection packet and a peer IP address is set to a virtual IP address of the VRRP group. Therefore, regardless of whether the active/standby switching is performed or the primary router is changed, the secondary router always detects a status of a link between the secondary router and the primary router by using the echo response packet. In addition, the echo response packet does not need to be configured for a peer end, and therefore, after the active/standby switching is performed, no configuration needs to be performed on the VRRP group, and detection on the link between the primary router and the secondary router may be persistently implemented. Based on this, as long as a router in the VRRP group detects a response packet of an echo response detection packet sent by the router, the router can determine whether the primary router is faulty, thereby achieving an objective of rapidly detecting a fault.
To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer and more comprehensible, the following further describes the present application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely used to explain the present application but are not intended to limit the present application.
A virtual router redundancy protocol (VRRP) group includes one primary router and multiple secondary routers, where each router in the VRRP group sends a link detection packet having an echo response function, and a destination address of the link detection packet sent by each router in the VRRP group is a virtual IP address of the VRRP group. If the primary router and/or the secondary router does/do not receive a response packet within a predetermined time, it is determined that the primary router is faulty.
Because a rapid detection means includes many technologies such as bidirectional forwarding detection (BFD) and Operation, Administration and Maintenance (OAM), only the BFD is used as an example in a solution mentioned in this application. However, the link detection packet in this solution is not limited to a BFD packet, and another rapid detection means that can implement the echo response function may also be applied to this solution.
According to this embodiment, a virtual router redundancy protocol (VRRP) fault detection method is provided. As shown in
Optionally, the link detection packet is an ECHO-type bidirectional forwarding detection (BFD) packet.
An application scenario of this embodiment is shown in
Specifically, according to this embodiment, as shown in
After detecting that the primary router is faulty, the secondary routers RT2 and RT3 separately trigger active/standby switching of the VRRP group, and start to perform priority election according to a VRRP protocol, to determine a new primary router.
In this embodiment, after active/standby switching is performed, an example in which RT2 becomes active is used, an application scenario of which is shown in
Corresponding to the foregoing virtual router redundancy protocol fault detection method, this embodiment of the present application further provides a routing device.
The sending module 601 is configured to send a link detection packet having an echo response function, where a destination address of the link detection packet is a virtual IP address of the VRRP group in which the sending module 601 is located.
The determining module 602 is configured to: determine whether a response packet corresponding to the link detection packet sent by the sending module 601 is received within a predetermined time, and if the response packet is not received within the predetermined time, determine that the primary router is faulty.
Optionally, the routing device may further include the switching module 603, which is configured to perform active/standby switching when the primary router is faulty.
Optionally, the link detection packet that has the echo response function and that is sent by the sending module 601 is an ECHO-type BFD packet.
As can be seen from the foregoing embodiment, the device is configured in the VRRP group. In a one primary multiple secondaries case, the device sends the ECHO-type BFD packet to the virtual IP address of the VRRP group in which the device is located, and listens to the response packet of the BFD packet, to detect whether the primary router is faulty. When the primary router is faulty, the VRRP group is triggered to perform active/standby switching.
As described above, the routing device may implement rapid detection on a fault in a one primary multiple secondaries VRRP network environment. After it is detected that the primary router is faulty and the active/standby switching is performed, continuous detection on a status of the primary router after the switching may be implemented by the apparatus without the need of performing extra setting on the apparatus.
It should be noted that a person of ordinary skill in the art may understand that all or a part of the processes of the methods in the embodiments may be implemented by a computer program instructing relevant hardware. The program may be stored in a computer readable storage medium. When the program runs, the processes of the methods in the embodiments are performed. The foregoing storage medium may include: a magnetic disk, an optical disc, a read-only memory (ROM), or a random access memory (RAM).
The virtual router redundancy protocol fault detection method and apparatus that are provided in the present application are described in detail above. The principle and the implementation manners of the present application are described herein through specific embodiments. The description about the embodiments is merely used to help understand the method and core ideas of the present application. In addition, a person of ordinary skill in the art can make variations to the present application in terms of the specific implementation manners and application scopes according to the ideas of the present application. In conclusion, the content of this specification shall not be construed as a limitation to the present application.
While this invention has been described with reference to illustrative embodiments, this description is not intended to be construed in a limiting sense. Various modifications and combinations of the illustrative embodiments, as well as other embodiments of the invention, will be apparent to persons skilled in the art upon reference to the description. It is therefore intended that the appended claims encompass any such modifications or embodiments.
Number | Date | Country | Kind |
---|---|---|---|
201410395694.3 | Aug 2014 | CN | national |
This application is a continuation of International Application No. PCT/CN2015/086150, filed on Aug. 5, 2015, which claims priority to Chinese Patent Application No. 201410395694.3, filed on Aug. 12, 2014. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2015/086150 | Aug 2015 | US |
Child | 15429812 | US |