The preferred embodiment of the present invention will be described in detail with accompany drawings as below.
Referring to
The server 10 includes a CPU 20, a network connection state detection module 30, an IP address take-over module 40, a unicast ARP requirement send module 50, a first NIC 60, and a second NIC 70. The network connection state detection module 30 disposed between the CPU 20 and the first NIC 60 is used for detecting the network connection state of the first NIC 60 by receiving the signals sent by the first NIC 60, and sending a disconnection signal to the CPU 20 when the first NIC 60 is disconnected. The IP address take-over module 40, connected respectively with the CPU 20, the first NIC 60, and the second NIC 70, is used for receiving a control signal sent by the CPU 20, clearing the setting of the first NIC 60 according to the control signal, and setting the IP address of the first NIC 60 to be a slave IP address of a second NIC 70 which operates normally in the same or a different network segment. The unicast ARP requirement send module 50 disposed between the CPU 20 and the second NIC 70 is used for receiving the control signal sent by the CPU 20, and forcibly unicasting an ARP requirement containing the MAC address of the second NIC 70 to each client 80 through the second NIC 70 according to the control signal, so as to update the MAC address stored in an ARP cache of each client 80 and corresponding to the IP address of the first NIC 60.
The embodiment of the present invention will be described in more detail below.
The client 80 is connected with the first NIC 60 of the server 10 through an IP address, and the IP address of the server 10 and the MAC address of the first NIC 60 are stored in a correspondence list of the IP address and the MAC address stored in the local ARP cache. Meanwhile, the server 10 records the IP address and the MAC address of the client 80 connected with the first NIC 60. The network connection state detection module 30 receives the signals sent by the first NIC 60 continuously, so as to determine the network connection state of the first NIC 60. When the first NIC 60 is disconnected, the network connection state detection module 30 sends a disconnection signal to the CPU 20. The CPU 20 sends a control signal to the IP address take-over module 40 after receiving the disconnection signal. The IP address take-over module 40 clears the setting of the first NIC 60, and sets the IP address of the first NIC 60 to be a slave IP address of the second NIC 70 which operates normally in the same or a different network segment, according to the control signal. When the IP address of the first NIC 60 and the IP address of the second NIC 70 are in the same network segment, a route of the network segment is used; when the IP address of the first NIC 60 and the IP address of the second NIC 70 are in different network segments and there is no route there-between, a route of a master IP address of the second NIC 70 is used; when the IP address of the first NIC 60 and the IP address of the second NIC 70 are in different network segments and there are routes there-between, a route without the IP addresses of the routes connecting the two network segments is used. After a successful setting, the IP address take-over module 40 sends a successful setting signal to the CPU 20. The CPU 20 sends a control signal to the unicast ARP requirement send module 50 after receiving the successful setting signal. The unicast ARP requirement send module 50 traverses the IP address and the MAC address of the client 80 connected with the first NIC 60, which are recorded by the server 10, according to the control signal, and forcibly unicasts an ARP requirement including the IP address of the first NIC 60, the MAC address of the second NIC 70 set with the IP address, the IP address and the MAC address of the client 80 to the IP address of the client 80, so as to update the MAC address stored in the ARP cache of the client 80 and corresponding to the IP address of the first NIC 60.
Now referring to
First, the client 80 is connected with the first NIC 60 of the server 10 through an IP address, and the IP address of the server 10 and the MAC address of the first NIC 60 are stored in a correspondence list of the IP address and the MAC address stored in the local ARP cache. Meanwhile, the server 10 records the IP address and the MAC address of the client 80 connected with the first NIC 60 through the IP address (step S200). Then, the network connection state detection module 30 receives the signals sent by the first NIC 60 continuously so as to determine the network connection state of the first NIC 60 (step S210). When the first NIC 60 is disconnected, the network connection state detection module 30 sends a disconnection signal to the CPU 20. The CPU 20 sends a control signal to the IP address take-over module 40 after receiving the disconnection signal. The IP address take-over module 40 clears the setting of the first NIC 60, and sets the IP address of the first NIC 60 to be a slave IP address of the second NIC 70 which operates normally in the same or a different network segment, according to the control signal (step S220). At this time, when the IP address of the first NIC 60 and the IP address of the second NIC 70 are in the same network segment, a route of the network segment is used; when the IP address of the first NIC 60 and the IP address of the second NIC 70 are in different network segments and there is no route there-between, a route of a master IP address of the second NIC 70 is used; when the IP address of the first NIC 60 and the IP address of the second NIC 70 are in different network segments and there are routes there-between, a route without the IP addresses of the routes connecting the two network segments is used. After a successful setting, the IP address take-over module 40 sends a successful setting signal to the CPU 20. The CPU 20 sends a control signal to the unicast ARP requirement send module 50 after receiving the successful setting signal. The unicast ARP requirement send module 50 traverses the IP address and the MAC address of the client 80 connected with first NIC 60, which are recorded by the server 10, according to the control signal, and forcibly unicasts an ARP requirement to the IP address of the client 80 (step S230). The ARP requirement includes the IP address of the first NIC 60, the MAC address of the second NIC 70, the IP address and the MAC address of the client 80, so as to update the MAC address stored in the ARP cache of the client 80 and corresponding to the IP address of the first NIC 60.