实现网络负载分担功能的网络通信方法发明领域本发明一般涉及网络通信技术，特别涉及一种具有网络负载分担功能的网络通信系统及其方法，能够为局域网的主机通过多个网关与广域网之间的数据传送提供负载分担和冗余备份功能。 FIELD OF THE INVENTION Communication networks for network load balancing functions of the present invention generally relates to network communication technology, and particularly relates to a network communication system and method having a function of network load balancing can be the host of the LAN and WAN gateways between a plurality of through providing data transmission redundancy and load balancing function. 背景技术目前，随着基于TCP/IP (传输控制协议和网际协议）的网络通信技术的发展，人们对网络通信系统的要求也日益提高。 BACKGROUND At present, with the development of network communication technology based on TCP / IP (Transmission Control Protocol and Internet Protocol), the people on the network communication system is also increasing. 图l是一个典型的网络通信系统的组成框图。 Figure l is a block diagram of a typical network communication system. 如图1所示，该系统由包括多个主机的局域网、广域网以及用于连接局域网和广域网的网关。 As shown in FIG. 1, the system comprises a plurality of hosts by a local area network, wide area network and a gateway for connecting the LAN and WAN. 局域网中的主机可以通过多个网关访问广域网。 LAN hosts can access the Internet through multiple gateways. 但是，当局域网中的主机所使用的网关发生故障时，就需要能够通过其它网关实现与广域网的通信，由此对通信系统提出了网关的负栽分担和备份功能的要求。 However, when the gateway used by the host LAN fails, it is necessary it can be implemented in other communication gateway and a wide area network, whereby the communication system requirements made negative gateway sharing and backup capabilities planted. 在现有技术中，通常采用VRRP (虚拟路由器冗余协议）技术为网关提供备份功能。 In the prior art, generally employed VRRP (Virtual Router Redundancy Protocol) technology provides backup for the gateway. 该技术由IETF(因特网工程任务组）的RFC(请求注解）2338案的主要内容是：在局域网中为主机设置网关地址为网关的虛拟IP地址，这些出口网关可以分为主用网关和备用网关，主用网关负责为局域网内主机提供报文转发服务。 The technology by the IETF (Internet Engineering Task Force) RFC (Request For Comments) 2338 cases are the main contents: Set to Host LAN gateway address for the virtual IP address of the gateway, which can be divided into the main export gateway with a gateway and a standby gateway The main use for the hosts in the LAN gateway is responsible for providing packet forwarding service. 主机在通过主用网关发送数据报文的过程中，如果主用网关失效，主机可通过备用网关发送数据。 Host sending data packets through the primary gateway, a gateway if the master fails, the secondary gateway host may send data. 主用网关与备用网关的切换与主机的操作无关，主机可以不知道有多个网关存在、也不必知道是否发生了网关的切换。 With independent operation of the switching master and the host gateway and a standby gateway host can not know the presence of a plurality of gateways, we do not know if the gateway switching occurs. 对主机而言，只要有网关为它提供正确的服务即可。 For the hosts, as long as it provides a gateway to the right of the service. 图2是现有技术中利用VRRP技术进行数据传输和网关切换的原理示意图。 FIG 2 is a schematic diagram of the prior art techniques utilized for data transmission and VRRP gateway switching principles. 如图2所示，各个主机的网关地址都指向VRRP的虛拟IP地址，主机通过ARP (地址解析协议）进行地址解析，即获得IP地址与MAC (媒体访问控制） 地址之间的对应。 As shown, each host gateway address point 2 the VRRP virtual IP address, host address resolution by ARP (Address Resolution Protocol), i.e., obtain an IP address and MAC (Media Access Control) address correspondence between. 当主机向广域网发送数据时，首先需要解析网关IP的MAC地址，这个网关IP就是VRRP备份组的虚拟IP,于是主机发送ARP请求时， 主用网关将应答以一个虛拟MAC地址。 When the host sends data to the wide area network, first needs to resolve a MAC address of the IP gateway, the IP gateway is a virtual IP VRRP group, then host sends an ARP request, the master responds with a gateway to the virtual MAC address. 之后，主^L就通过该虛拟MAC地址向主用网关发送数据。 Thereafter, the main ^ L transmits data gateway through the virtual MAC address to the host. 主用网关接收目的MAC为其虛拟MAC地址的数据并转发。 Receiving the main data for the destination MAC address and the virtual MAC forwarding by the gateway. 当网关向主机发送数据时，如果还没有该主机的MAC地址，则主用网关会向该主才几发送ARP请求，以获得该主机的MAC地址，然后再将数据发送至该主才几。 When a gateway sends data to the host, if it is not the MAC address of the host, the host will be only a few main transmission gateway to the ARP request to obtain the MAC address of the host, and then transmits the data to the main only a few. 另外，主用网关在正常工作的同时，还定期向备用网关发送VRRP协议报文，以使备用网关监控主用网关的状态。 Further, while the normal operation of the primary, but also periodically sends VRRP packets to the backup gateway with the gateway, the gateway so that the standby state by monitoring the master gateway. 当备用网关连续丟失了指定个数的从主用网关发出的VRRP协议报文后，备用网关判断主用网关出现故障， 并自动接替主用网关来提供服务，这样就完成主用、备用网关之间的切换。 After the VRRP backup gateway consecutive lost packets sent from the host gateway with the specified number, the standby gateway determines a primary gateway fails, and automatically take over the active gateway to provide services, thus completing the main and standby gateways switching between. 在图2所示的上述方案中存在着一个问题，即，由于主用网关和备用网关都连接着广域网链路，但是局域网内各主机的网关MAC地址都是指向同一网关（主用网关）的MAC地址，平时只利用了连接主用网关广域网链路传送数据，而另外的连接备用网关的链路则是空闲的。 There is a problem in the above-described embodiment shown in FIG 2, i.e., since the active and standby gateways are gateways connected to WAN link, but the gateway MAC address of each host within the LAN are directed to the same gateway (the primary gateway) MAC address, usually only utilized with a data transmission link connecting the main WAN gateway, the gateway and the other connected to the standby link is idle. 仅当主用网关失效时， 才通过备用网关传送报文数据。 Only when the master fails a gateway, the gateway transmits only standby data packets. 因此这种技术没有负载分担功能，容易导致负栽过多集中于某一些链路的不均衡情况发生。 Therefore, this technique does not load sharing function, easily lead to excessive concentration of plant negative imbalance in the number of links of a particular occurrence. 为了解决这一问题，需要采用负载分担技术。 To solve this problem, you need load balancing technology. VRRP的办法是提供多个VRRP备份组。 VRRP approach is to provide multiple VRRP backup groups. 各VRRP备份组的主用网关不同，如图3所示，网络通信系统中配备了两个^^分组，分别是VRRP 备份组l (其中网关l为主用、网关2为备用）和VRRP备份组2 (其中网关2 为主用、网关l为备用）。 Master VRRP backup groups with different gateways, as shown, the network communication system equipped with two ^^ packet 3, namely the VRRP backup group l (where l mainly with the gateway, the standby gateway 2) and a VRRP group 2 (wherein 2 mainly with the gateway, the standby gateway l). 各备份组的虚拟IP地址和虚拟MAC地址是不同的。 Virtual IP address and virtual MAC address of each backup group is different. 将局域网中的一部分主机的网关设定为VRRP备份组1的虚拟IP地址，另外一部分主机的网关设定为VRRP备份组2的虚拟IP地址。 The LAN gateway set as part of the host virtual IP address of a VRRP backup group, another part is set to the host gateway the virtual IP address of the VRRP backup group 2. 这样，上述两部分主机分别使用不同的VRRP备份组的虚拟IP地址作为网关IP地址，实现了对负载的统计平均分担功能。 Thus, the above two parts of the host using different virtual IP address of the VRRP backup group as the gateway IP address, to achieve a statistical average load balancing. 虽然上述现有技术解决了负栽分担问题，但是它仍存在着一个问题，即， 在该技术中，若要实现负载的分担，就必须对同一个局域网内的主机分别设定不同网关，而这是用户通常不能接受的。 Although the above prior art to solve the negative planted share issue, but it still exists a problem that, in this technique, to achieve load sharing, you must set a separate gateway for the hosts in the same local area network, and this is the user usually unacceptable. 另外，在上述现有技术中，当所有主机都指定网关后，网关的流量模型也就基本固定。 Further, in the above-described prior art, when all hosts specified gateway, the gateway traffic model also substantially fixed. 如果需要对网关的流量模型重新进行调整，其困难相对较大。 If you need to re-gateway traffic model adjustments, the difficulty is relatively large. 发明内容因此，针对现有技术中存在的上述问题，本发明的目的就是提供这样一种系统和方法，它既能够实现网关的负载分担和冗余备份又能够解决主机需要配置多个网关地址的问题。 Accordingly, the above problems in the prior art, the object of the present invention is to provide such a system and method can be realized both load balancing and redundancy can solve gateways and gateways need to configure multiple host addresses problem. 为了实现上述目的，本发明提供了一种在通信网络中实现网络负载分担功能和冗余备份功能的网络通信方法，所述通信网络包括广域网、局域网主机和用于连接所述广域网与所述局域网主机的多个网关，所述网关包括主用网关和备用网关，其特征在于，所述网关具有相同的虛拟IP地址和不同的虚拟MAC地址，所述局i或网的各主才几配置的网关地址为所述网关的虚拟IP地址，所述方法包括：(1) 所述主机在向广域网发送报文时，向所述局域网广播ARP请求；(2) 主用网关根据各所述网关的状态，确定为所述主机提供服务的网关，用所述^C确定为月l务网关的虚拟MAC地址对所述ARP请求作出应答；(3 )所述主机获得所述被确定的服务网关的MAC地址后，用所述应答的虚拟MAC地址对所发送报文进行以太网封装，并发送至所述被确定提供服务的网关以进行转发。 To achieve the above object, the present invention provides a method for implementing a network communication in a communication network network load balancing and redundancy backup function, the communication network comprising a wide area network, a local area network for connecting the host and the local area network and a wide area network a plurality of the gateway host, the gateway comprising a gateway and a standby gateway master, characterized in that said gateway having the same virtual IP address and a different virtual MAC address, each of the main Board i or mesh configuration of only a few the gateway address to the virtual IP address of the gateway, the method comprising: (1) when the host sends packets to a wide area network, local area network to broadcast the ARP request; (2) according to each of the primary gateway to gateway state, determining the gateway serving the host, as determined by the ^ C l month virtual MAC address traffic to the gateway responds to the ARP request; (3) obtaining the host of the service gateway being determined after the MAC address, the MAC address of the virtual response to the transmitted Ethernet packets encapsulated, and sent to the service gateway is determined to be forwarded. 在本发明的上述实施方法中，所述主用网关与所述备用网关通过按照预定的时间间隔互相发送HELLO报文来相互监控状态，当未能连续收到从某个网关发送的HELLO才艮文时，则确定该网关失效。 In the above-described embodiment of the method of the present invention, the master transmits the HELLO packet to each state by the monitoring time interval to each other with a predetermined standby gateway and the gateway, when the failed received HELLO continuously transmitted from a gateway before Gen Wen, then determine if the gateway fails. 在上述实施方法中，所述监控步骤进一步包括： (4-1)当所述备用网关失效时，由主用网关确定所述网关来替代所述失效的备用网关；(4-2)当所述主用网关失效时，由所述备用网关确定新的主用网关； 理的主^L流量。 In the above-described method embodiments, the step of monitoring further comprises: (4-1) when the standby gateway fail, the gateway with the gateway is determined by the primary backup gateway to replace the failed; (4-2) when the when a failure of said primary gateway, by the standby gateway determines a new active gateway; main reason ^ L flow. 在本发明的方法中，还可包括检测失效网关恢复的步骤，包括： (5-1 )对所述失效的网关设置检测时间，所述检测时间大于所述失效网关的网络HELLO报文发送的时间间隔；(5-2)当所述失效网关恢复正常时，对所述失效网关进行检测，当按照该检测时间内连续收到指定个从该失效网关发出的HELLO报文后，才判断该失效网关恢复；(5-3)当所述失效网关恢复过程中再次失效时，延长检测时间(5-4)当所述失效网关恢复了提供服务的能力后，将检测时间恢复到初始设置的检测时间。 In the method of the present invention, the gateway may further comprise the step of detecting failure recovery, comprising: (5-1) set detection time of the gateway failure, the failure detection time is greater than the network gateway HELLO packet transmitted time interval; (5-2) when the gateway fails to return to normal, the failure detecting gateway, when the detection time according to the specified number of consecutive received HELLO packet sent from the gateway fails, it is determined that gateway failure recovery; (5-3) when the recovery process fails gateway fails again, to extend the detection time (5-4) when the gateway fails to restore the ability to provide services to restore the initial setting of the detection time detection time. 在本发明的上述方法中，对提供服务的网关的确定是由所述主用网关或由所述局域网内设置的控制单元来进行的。 In the method of the present invention, the determination of the gateway provides a service is performed by the master control unit or gateway provided by the local area network within. 另外，在本发明的上述方法中，所述应答由所述主用网关、所述被确定的服务网关或在所述局域网内的所述控制单元执行。 Further, in the above-described method of the present invention, the response by the active gateway, the gateway service is determined within the local area network or the control unit performs. 此外，在本发明的方法中，还可进一步包括当所述网关的优先级发生变化时，进行主用网关与备用网关的切换的步骤。 Further, in the method of the present invention may further comprise a change when the priority of the gateway, the step of the master gateway and standby gateway switching. 该主用网关与备用网关的切换可以采用强占方式或非强占方式进行。 The active and standby gateway switching gateways may use preemptive or non-preemptive mode. 综上所述，本发明提供了一种简单的多网关出口的负载分担和冗余备份功能，并且这些功能的实现对局域网内的主机是透明的。 In summary, the present invention provides a simple load balancing and redundancy backup multiple gateway port, and these functions are implemented on the host LAN is transparent. 局域网内主机不需要做任何特殊配置就可以充分享受负载分担和冗余备盼带来的好处。 LAN host does not need to do any special configuration to fully enjoy the benefits of load balancing and redundancy backup hope brings. 本发明充分利用了广域网链路的带宽和出口网关的处理能力。 The present invention makes full use of bandwidth and processing power outlet gateway WAN links. 附图说明通过详细文字说明并结合以下附图，本发明的上述目的、特征及优点将变得更加易于理解，其中：图1是一个典型的网络通信系统的组成框图；图2是现有技术中利用VRRP技术进行数据传输和网关切换的原理图； 图3是现有技术中利用VRRP技术进行网络负载分担的原理示意图； 图4的示意图用于帮助说明根据本发明实施方案的具有网络负栽分担功能的网络通信方法；图5是本发明实施方案中各网关发送HELLO报文的示意图。 BRIEF DESCRIPTION OF detailed written description in conjunction with the following drawings, the above-described objects, features and advantages of the present invention will become more readily understood, in which: FIG. 1 is a block diagram of a typical network communication system; FIG. 2 is a prior art schematic performed data transmission and switching using the gateway VRRP art; FIG. 3 is a schematic view of the prior art techniques using VRRP network load balancing principle; FIG. 4 is a schematic diagram to help explain a negative having a network according to an embodiment of the present invention planted the method of sharing a network communication function; FIG. 5 is a schematic view of the embodiment of the present invention, each HELLO packet sent by the gateway. 具体实施方式参考图4详细描述本发明的实施方案的例子。 DETAILED DESCRIPTION example of the detailed description of embodiments 4 of the present invention with reference to FIG. 首先要说明的是，在本发明中，主用网关与备用网关的概念实质上与现有技术的概念是不同的。 First, It is noted that, in the present invention, the active and standby gateway gateway concept is substantially prior art and the concept is different. 这是因为，在现有技术中主用网关是为局域网内主机提供服务的，而备用网关则处于闲置状态。 This is because, in the prior art to provide primary service to hosts in the LAN with the gateway, the standby gateway are idle. 而在本发明中，主用网关与备用网关的差别仅在于主用网关具有控制功能而备用网关没有，但是主用网关和备用网关都在为主机提供服务。 In the present invention, the active and standby gateway gateway only difference is that the active gateway has a gateway control function without backup, but are to serve the primary host and the secondary gateway with the gateway. 这一点将在下面对本发明实施方案的描述中得到体现。 This will be the following description of embodiments of the present invention is reflected. 本实施方案为局i或网的主才几配置了相同的虛拟网关地址，这一点显然与上述现有技术不同。 Main Board The present embodiment is only a few sites i or configured with the same virtual gateway address, which is obviously different from the above-described prior art. 如图4所示，在本实施方案中主机的网关地址是网关的虛拟IP地址。 As shown, in the present embodiment, the gateway is a virtual address of the host IP address of the gateway 4. 设网关l为主用网关，网关2为备用网关，则主机的网关地址为10丄1.3。 L based gateway provided with a gateway, the standby gateway 2, the host address of the gateway 10 Shang 1.3. 在本例中，主机通过这两个网关完成数据报文的转发。 In the present embodiment, the host for data packets forwarded through the two gateways. 网关l接收所有的目的MAC地址为虚拟MAC地址A: 00.00.00.00.00.03的报文，网关2 负责接收处理所有目的MAC地址为虛拟MAC地址B: 00.00.00.00.00.04的报文。 L gateway receives all the destination MAC address of the virtual MAC address A: 00.00.00.00.00.03 packet, the gateway 2 is responsible for handling all received destination MAC address of the virtual MAC address B: 00.00.00.00.00.04 packets. 当主机B要向广域网发送数据报文时，首先要向网关发送ARP请求。 When the host B To WAN transmission data packet, the gateway would like to send an ARP request. 该请求为广播l艮文，所以网关1和网关2都能够接收到该请求。 The request is a broadcast message Burgundy l, the gateway 1 and gateway 2 can receive the request. 由于主机B的网关地址在本例中为网关的虚拟IP地址，因此，主用网关l接收到该请求后， 根据目前各个网关的状态，决定由哪个网关为主机B服务，方法是使用该指定网关对应的虚拟MAC地址对主机B的ARP请求作出应答。 Since the gateway address of the host B is the virtual IP address of the gateway, and therefore, the main receiving gateway l to the request in the present embodiment, according to the current status of each gateway, decide which gateway host B service, is to use the designated virtual MAC address corresponding to the gateway responds to the ARP request for the host B. 作出应答的可以是主用网关也可以是其他网关，优选为使用被指定为主机B服务的网关作出应答。 The response may be to make the active gateway may be another gateway, preferably used is designated as the gateway host B and services respond. 这样就可以控制主才几B访问广域网的出口网关，也就能够达到负载统计均衡的目的。 So that you can control the main export gateway only a few B WAN access, it will be able to achieve the purpose of statistical load balancing. 主用网关作出上述决定所依据的条件可以非常灵活，例如可以依据以下至少一种条件：根据出口带宽比来分配主机、或者把一组具有相同特征的主机（如服务器）分配到相同的网关服务、或者平均分配主机到各个网关上、 也可以根据外出接口带宽负栽或者局域网接口的带宽负载等策略进行灵活这种技术对主机是透明的，而且能够根据条件灵活调度哪个网关为哪个主机服务。 Main conditions that decision is based on a flexible gateway may be, for example, can be based on at least one of the following conditions: outlet according to allocate bandwidth than the host, or a group of the host (e.g., server) having the same characteristics of the service assigned to the same gateway or equally distributed to each gateway host, this technique can also be flexible on the host is transparent, but also the flexibility which is the gateway to which the host service scheduling according to the conditions according to outgoing interface bandwidth minus the bandwidth load plant or LAN interface and other strategies. 假设主用网关1根据条件判断主机B应该由网关2来提供服务，于是就使用虛拟MAC地址B: 00.00.00.00.00.04来应答，应答网关可以是主用网关或者主用网关通知网关2进4亍应答，甚至也可以由主用网关通知其他网关应答， 这样主机B就会把才艮文的目的MAC都封装为虚拟MAC地址B: 00.00.00.00.00.04发送。 Assuming active master gateway 1 according to the determination condition B should be provided by the service gateway 2, so they use the virtual MAC address B: 2 into 4 00.00.00.00.00.04 to answer, the response may be a primary gateway with the gateway or the gateway notification master gateway right foot response, even inform other gateways may be a gateway responds with a main, so that only the host B will Gen destination MAC address are encapsulated virtual MAC B: 00.00.00.00.00.04 transmission. 网关2接收到这个报文并转发。 Gateway 2 receives this message and forward. 另一方面，如果是主机A想发送数据到广域网，同样要先发送ARP请求。 On the other hand, if host A wants to send data to the WAN, the same first sends an ARP request. 这时，如果主用网关l 根据条件决定应该由自己为主机A提供服务，则将以虛拟MAC地址A: 00.00.00.00.00.03对这个ARP应答，这样主机l就会把净艮文的目的MAC都封装为虛拟MAC地址A: 00.00.00.00.00.03并发送，这样主用网关l就接收到这个报文并转发。 At this time, if the primary gateway with a decision according to the conditions l A host should provide services, then the virtual MAC address A by themselves is: 00.00.00.00.00.03 this ARP reply, so l will host the Net Gen destination MAC are encapsulated virtual MAC address A: 00.00.00.00.00.03 and transmitted, so that the primary gateway l to receive this packet and forwards. 通过上述方式，使得局域网的主机具有相同的网关IP地址，但是实际访问广域网的数据可能通过不同的网关。 By the above-described manner, so that the host has the same LAN gateway IP address, but the actual data may access the Internet via different gateways. 其根本原因在于，根据本发明的方案， 对于局域网主^/l所配置的相同的虚拟网关IP地址，可以提供不同的以太网硬件地址，也就是MAC地址，而这些MAC地址是对应于不同网关的，以此为基础，就形成了本发明的对局域网主机透明的负载分担方案。 The fundamental reason is that the solution according to the present invention, for the main LAN ^ / same virtual gateway IP address configured l, may provide a different Ethernet hardware address, i.e. MAC address, and the MAC addresses corresponding to different gateways and on this basis, to form a transparent host LAN load balancing scheme of the present invention. 当广域网向局域网的主机A^送的数据到达网关时，无论网关是主用网关还是备用网关，如果该网关没有主机A的MAC地址，那么该网关会向局域网内发送ARP请求。 When a host on the LAN to the WAN ^ A transmission data arrives at the gateway, the gateway is the master gateway whether or standby gateway, if the gateway is not the MAC address of host A, then the gateway will send an ARP request to the LAN. 其中ARP请求报文的源IP使用该网关自己的IP地址例如网关l，即在ARP请求报文内的源IP字段内携带：lO丄ll。 Wherein the ARP request packet source IP gateway using the gateway, for example, its own IP address l, i.e., the source IP field of the request packet carries ARP: lO Shang ll. 当主机A收到ARP 请求报文，就会使用自己的MAC地址对这个请求作出应答，这样该网关就然后发送给主机A。 When Host A receives the ARP request packet, it will use its own MAC address to reply to this request, so that the gateway will then be sent to the host A. 在本发明方法的上述实施例中，主用网关和备用网关同时承担转发工作。 In the above-described embodiment of the method of the present invention, the main working simultaneously with the gateway for forwarding and standby gateway. 主用网关通过为主机分配不同的网关来完成流量调度。 Primary gateway traffic scheduling is done by different gateways assigned to the host. 为了保证网关失效后，由失效网关服务的主机仍然能够正常与外部网络进行数据通信，就需要对各网关进行监控。 In order to ensure that the gateway fails, the failure by the host gateway services will still be able to normal data communication with an external network, we need to monitor each gateway. 在本发明中，包括主用网关和备用网关在内的各网关的监控是相互的。 In the present invention, the monitor includes a main and standby gateways with each gateway including a gateway is mutual. 这种监控通过相互发送HELLO报文（监控报文）来实现。 This monitoring is achieved through mutual sending HELLO packets (packet monitor). HELLO报文是一种设备间的通信报文，该报文通常使用组播发送，以确保各个网关能够接收处理，其主要功能在于能够使其他网关监控HELLO报文发送者的工作状态（是否正常工作）；能够使其他网关了解当前HELLO报文发送者的相关状态信息（比如链路占用情况）。 HELLO packet is a packet communication between a device transmitting a multicast packet is generally used to ensure that the gateway is capable of receiving the respective process, its main function is to enable the gateway to monitor the operating state of other HELLO packet sender (normal work); the other gateway can understand the current state of information related HELLO message sender (such as link occupancy). 在本发明的一个实施例中，HELLO报文中可包括：设备优先级、虚拟IP 地址、网关设备ID、网关设备ID和该网关处理虚拟MAC地址、出口链路可用带宽、链路占用情况、认证类型、认证字、HELLO报文时间间隔、报文校验和等。 In one embodiment of the present invention, HELLO message may include: device priority, a virtual IP address, the gateway device ID, the gateway device and the gateway process ID virtual MAC address, egress links available bandwidth, link occupancy, authentication type and authentication key, interval HELLO packets, packet checksum and the like. 这种HELLO报文通常使用组播发送，以确保各个网关能够接收处理。 Such HELLO packet is typically sent using a multicast, to ensure that each gateway is capable of receiving process. 其中，优先级用于决定哪个网关作为主用网关。 Wherein the priority used to determine which gateway as the primary gateway. 当主用网关失效时，各个备用网关会通过这个优先级决定谁是主用网关。 When the primary fails with the gateway, the standby gateway determines the respective priority class by the master who is a gateway. 虛拟IP地址是为局域网内提供网关的地址。 Virtual IP address is the address of the gateway to provide LAN. 虛拟MAC地址和设备ID共同说明哪个网关应该处理哪个或者哪几个虚拟MAC地址。 Virtual MAC address and the device ID which together illustrate the gateway which should be dealt with or which of the virtual MAC address. 链路占用情况和出口链路可用带宽为主用网关提供主机调度的依据。 Link occupancy and export links based on the available bandwidth to provide host-based scheduling with the gateway. 认证类型和认证字是出于安全考虑，用于确保各个网关是合法的网关。 Authentication type and authentication key for security reasons, each gateway is used to ensure that a legal gateway. 网关的这种HELLO报文会根据自己在该HELLO报文中携带的时间间隔信息，以该时间间隔为周期向外发送HELLO才艮文，其他网关根据是否能够收到其它网关的这种HELLO报文来判断其它网关是否正常工作。 This gateway will HELLO packet interval information carried in accordance with their own HELLO packet in the time period to the time interval before transmitting Gen HELLO packet outward, according to whether the other gateway can receive such other gateways HELLO packet text to determine whether the other gateways work properly. 当其他网关连续地无法从某个网关接收到指定个数的HELLO报文时，则判断网关故障。 When the HELLO packet to another gateway not continuously received from the gateway to a specified number, then the fault is determined gateway. 图5示意性地显示了网关之间发送这种HELLO才艮文的情况。 FIG 5 schematically shows a case that the transmission between the gateway only Gen HELLO packets. 如图5所示， 局域网内的各网关分别向该局域网内的其它网关发送HELLO报文。 5, each gateway on the LAN are transmitted HELLO packet to other LAN gateways. 例如网关l向网关2和3发送HELLO报文，而网关2向网关l和3发送HELLO报文，等等。 L such as a gateway to the gateway transmits a HELLO packet 2 and 3, the gateway 2 l and the gateway 3 transmits the HELLO packet, and the like. 这样，当备用网关失效，主用网关会根据一定的条件决定失效的备用网关的虚拟MAC地址该由哪个网关来接管，也就是原来通过这个失效的网关提供服务的主机需要调整到其他能够正常工作的网关上提供服务。 Thus, when the backup gateway fails, the virtual MAC address of the master determines failure based on certain conditions by the gateway alternate gateway that be taken over by which the gateway, which is the original provision of services by the failure of the gateway host needs to adjust to other work properly to provide services on the gateway. 该条件可以包括，例如，目前的各个网关的链路使用情况、各个网关的服务的主机数、 用户的指定配置等.具体地说，如果检测到备用网关失效，则其他备用网关不做任何动作， 主用网关则根据一定策略决定哪个网关接替失效的备用网关工作.其方法是在HELLO报文中指定一种报文类型，这种类型的报文包含有如下字段：HELLO报文版本号、HELLO报文类型、发送网关设备ID、设备优先级、 虚拟IP、网关设备ID和该网关处理虚拟MAC表、出口链路可用带宽、链路占用情况、认证类型、认证字、HELLO报文时间间隔、报文校验和等字段。 The conditions may include, for example, the current link utilization of each gateway, each gateway host service number, the user's specified configuration, etc. Specifically, if the detected spare gateway fails, the standby gateway without any other action , primary gateway which is based on certain policy decision to replace the standby gateway as the gateway of failure which is designating a packet in the packet type HELLO packet, this type of packet contains the following fields:. HELLO packet version number, HELLO packet type, gateway device ID, device priority, a virtual IP, gateway gateway device ID and the virtual MAC processing table, the available bandwidth egress link, the link occupancy, an authentication type and authentication key, HELLO packet interval , packet checksum fields. 主用网关通过指定的网关设备ID和该网关设备处理的虛拟MAC地址表来通知接管失效网关的网关，以接替失效网关的服务。 Take over the failed primary gateway to inform the gateway with the gateway through the virtual MAC address table designated gateway device and the gateway device ID of the process, to replace dead gateway service. 也就是说当网关发现自己需要处理某个失效网关的报文时，那么它通过发送这样一个ARP请求报文的方式完成主机业务切换，该ARP请求报文中的发送者协议地址可以是该网关的IP地址，但不能是虚拟IP地址，该ARP请求才艮文中的目标协议地址也是该网关的IP地址，该ARP请求^^文的以太网封装中的源MAC地址是失效网关的虚拟MACi也址，该#:指定的网关同时打开对失效网关的虛拟MACi也址的报文接收处理。 That is when the gateway find themselves dealing with a dead gateway message, then send it through such an ARP request packet switching business is accomplished host, the ARP request packet protocol address of the sender can be the gateway an IP address, but not a virtual IP address, target protocol address of the ARP request packet only in Burgundy is the IP address of the gateway, the Ethernet source MAC address of the ARP request encapsulating ^^ text is also dead gateway virtual MACi site, which #: Specifies the gateway for dead gateway while opening a virtual MACi also address the message reception process. 当主用网关失效时，首先^f企测到主用网关失效的备用网关将发送重新选举主用网关的信号，这可以通过发送一种类型的HELLO报文实现。 When the primary fails with the gateway, the first half ^ f measured primary gateway fails backup gateway resend signal RO gateway, which may be achieved by transmitting one type of HELLO packet. 当新的主用网关确定后，新主用网关将发布失效的网关该由哪个网关接替工作的指令。 When the new primary gateway to determine, with a new primary gateway to the gateway. The failure of the command by the gateway which work to succeed. 其后的搡作可以与上述的备用网关失效处理方法相同。 Thereafter shoving failure can be treated the same as the above-described standby gateway. 以上操作就完成了故障网关的切换工作。 The above operation completes the fault switching operation of the gateway. 具体地说，如果某一备用网关最先4企测到主用网关失效，该备用网关应立即发出HELLO报文。 Specifically, if a backup gateway 4 first half gateway measured master fails, the backup gateway should send HELLO packets immediately. 该报文的类型为选举主用网关的报文类型，可包含如下字段：HELLO报文版本号、HELLO报文类型、发送网关设备ID、设备优先级、 虚拟IP、网关设备ID和该网关处理虛拟MAC表、出口链路可用带宽、链路占用情况、认证类型、认证字、HELLO报文时间间隔、报文校验和等字段。 The packet type is packet type master election gateway, it may include the following fields: HELLO packet version number, HELLO packet type, gateway device ID, device priority, a virtual IP, Gateway device ID and the gateway process virtual MAC table, the available bandwidth egress link, the link occupancy, an authentication type and authentication key, interval HELLO packets, packet checksum fields. 其他备用网关收到这种选举主用网关类型的HELLO报文，即发送选举主用网关类型的报文以重新选举主用网关。 Other alternate gateway receives the RO with this type of gateway HELLO packet, i.e. transmitted with the RO message gateway type to re-election primary gateway. 例如，图4中的网关2此时会成为主用网关。 For example, the gateway 4 in FIG. 2 at this time becomes the active gateway. 然后，主用网关根据策略决定谁来接管原有的主用网关处理的那些主才几的流量。 Then, the main gateway based on policy decisions by those who will take over the main flow of the main processing of the original with only a few of the gateway. 下面说明主用网关的选定过程：在本发明的一个实施方案中，主用网关是根据网关设备的优先级来确定的。 In one embodiment of the invention, the primary gateway is determined based on the priority of the gateway device: primary gateway selection process will be described below. 例如，假定在某个局域网中有三个网关，其设备优先级分别是IOO、 80 和60,并且设备优先级数值越大，该设备优先级越高（当然相反设定也可以）。 For example, assume that there are three gateways in a local area network, which device priority are IOO, 80 and 60, and the larger the device priority value, the higher the priority of the device (of course, the opposite setting is also possible). 同时在该例子中假定选举主用网关的条件是：以设备优先级最高的网关为主用网关，如果设备优先级相同则比较网关设备ID， ID大的就成为主用网关。 Also assume that the RO gateway conditions used in this example are: a gateway apparatus with the highest priority mainly with the gateway, if the device is relatively the same priority gateway device ID, ID becomes large master gateway. 这样当网关通过组4番形式发送各自的HELLO报文，这个才艮文即标记为选举HELLO报文。 So that when the gateway transmitted by a respective group 4 HELLO packet fan form, i.e., the packet was marked Gen election HELLO packet. 各个网关设备都根据自己接收到的这种HELLO报文，进行比较，以确定主用网关。 According to this gateway device are each HELLO packet sent to it, are compared to determine the primary gateway. 在本例中，网关l将成为主用网关。 In the present embodiment, a gateway becomes the master gateway l. 设备间的这种选举类型HELLO报文可包括以下字段：HELLO报文版本号、HELLO报文类型、发送网关设备ID、设备优先级、虛拟IP、网关设备ID和该网关处理虚拟MAC表、出口链路可用带宽、链路占用情况、认证类型、认证字、HELLO报文时间间隔、报文校验和等字段。 This type of election between devices HELLO packet may include the following fields: version HELLO packet, HELLO packet type, gateway device ID, device priority, a virtual IP, Gateway gateway device ID and the virtual MAC processing table, the outlet available bandwidth of a link, the link occupancy, an authentication type and authentication key, interval HELLO packets, packet checksum fields. 下面更详细地说明主用网关对主机的服务网关的逸捧。 It will be described in more detail on the primary gateway Yi holding service gateway host. 在本发明的实施方案中，主用网关是根据一定的策略决定使用哪个虛拟MAC给各个主机的ARP请求进行应答。 In an embodiment of the present invention, the virtual master which each host MAC to ARP requests are taken with the use of a gateway according to a certain policy decision. 这种策略可以包括：1 )静态指定特定主机经过特定网关服务；2)进行平均轮流分配（每个网关提供N/M个主机的服务，N为网络内主机数，M为网关数）；3)根据静态出口总可用带宽比例进行调度；4)才艮据出口带宽占用情况进行动态调整；5)根据以太网入口带宽占用情况进行调度。 Such policies may include: 1) statically specify a particular host through a particular gateway service; 2) in turn averaged dispensing (each gateway providing N / M hosts services, N is the number of hosts in the network, M being the number of gateways); 3 ) according to the ratio of total available bandwidth outlet static scheduling; 4) It was Gen outlet dynamically adjust bandwidth consumption; 5) according to the Ethernet inlet scheduling bandwidth consumption. 另外，当主机下线后，网关可以通过ARP的老化机制检测到这一情况。 Further, when the main assembly line, the gateway can detect this situation by the ARP aging mechanism. 网关会通过HELLO报文中携带的关于处理的主机个数的信息，使得其他网关能够了解各个网关目前负责处理的主机个数。 Information about the number of host processing gateway by HELLO packet carries that others can understand the number of gateway host gateway is currently responsible for each process. 以便主用网关根据这个情况调整主冲几的分配。 Adjust the master so that the main distribution washed with several gateway according to the situation. 可以选择的主用、备用网关切换方式有两种，即强占式和非强占式的。 There are two selectable primary and standby gateway switching mode, i.e., preemptive and non-preemptive type. 当使用强占式的时候，当通信系统中网关设备的优先级发生变化时，可能会导致主用网关的强制切换。 When using emptive, when the priority communication system, the gateway device changes may result in forced switching master gateway. 强制切换发生的条件是只要网关中的有设备的优先级比当前主用网关的优先级高，就要对主用网关进行重新选举。 Forcible switching condition occurs as long as there is a device with a priority higher than the priority of the current master gateway in the gateway, it is necessary to re-election of the master with the gateway. 发生网关优先级变化的条件通常有在网关的设备优先级和出口可用带宽相关的情况下、在手工重新指配网关设备的优先级的情况下、或者失效的主用网关恢复的等情况下，就可能会导致主用网关的切换。 Conditions gateway priority change occurs is usually the case at the gateway device priority and the outlet of the available bandwidth of the relevant circumstances, if the priority of the case of manually re-assignment of the gateway device, or a failure of the primary gateway recovery and the like, it could lead to the main switching gateway. 此时，需要作为新的主用网关的网关就会发送一次重新选举主用网关类型的HELLO报文，以便各网关开始重新选定主用网关。 In this case, the need will be sent as a gateway to the new master gateway of a re-election primary gateway type of HELLO messages to all gateways start again selected primary gateway. 对于非强占式的切换，虽然网关中有设备优先级比主用网关的优先级高，也不进行主用网关的强占，直到下一次主用网关选举发生。 For non-emptive handover, although the gateway device has higher priority than the priority of the active gateway, the gateway is not performed with the main seizure until the next occurrence of a primary election gateway. 此时，各个网关的备用状态保持稳定，不因为优先级的变化而发出重新选举主用网关类型的HELLO报文来重新选举主用网关，而是等到下一次重新选举主用网关。 At this time, the standby state of each gateway remains stable, because the change in priorities issued the re-election of the master gateway type HELLO packet to the active gateway re-election, but the time until the next re-election of the master gateway. 例如，在失效网关恢复后，可以使用强占或者非强占的切换处理。 For example, the gateway after failure recovery, use or occupy the non-preemptive processing of the handover. 无论采用上述哪种方式，主用网关都会把先前由该失效网关负责处理的虚拟MAC交还给恢复后的该失效网关处理。 No matter which of the above ways, the master gateway will be the responsibility of the previously dead gateway processing virtual MAC cross the dead gateway back to recovery after treatment. 在本发明的一种实施方案中，对失效网关设置一4全测时间。 In one embodiment of the present invention, it is provided a measuring time full 4 dead gateway. 该检测时间是指在正常4企测到连续个指定个数的监控报文后，才能认为该失效网关恢复的时间。 The detection time is measured at half the normal 4 to the specified number of consecutive packets monitored only after the time that the gateway failure recovery. 该检测时间大于失效网关的网络HELLO报文发送的时间间隔。 The failure detection time greater network gateway HELLO packet transmission interval. 在网关发生失效后，将对该失效网关的检测时间加长。 After the failure occurs gateway, the gateway will lengthen the failure detection time. 通过加长对失效网关的检测时间，可以避免曾经失效网关的不稳定情况对系统通信产生影响。 By lengthening the time on dead gateway detection, the failure can be avoided once the gateway instability of an impact on the communication system. 每次当不稳定的情况发生时，就相应对检测时间进行延长，使得失效网关的不稳定对网络影响最小。 Each time when instability occurs, the detection time of the corresponding extension, so gateway unstable failure minimal impact on the network. 在本发明的实施方案中，还考虑到新加入网关的情况。 In an embodiment of the present invention, also taking into account the newly added gateway. 在此情况下，新加入的网关首先发送HELLO报文，向网络中的其他网关声明该新网关的加入。 In this case, the newly added gateway first sends a HELLO message, announce the new gateway to other gateways in the network. 其它网关相应地更新其相关的状态。 Other gateway updates its associated state. 同时，该新加入的网关也接收其他网关的HELLO报文，更新其相关状态。 Meanwhile, the newly added gateway also receive HELLO messages from other gateways, update its associated state. 主用网关在检测到这个新加入的网关后，在从该新加入网关连续接收到指定个数的HELLO报文后，开始对它进行业务调度。 After the primary gateway detects this newly added gateway, from the addition of new gateway receives a specified number of consecutive HELLO packet, it starts to conduct business schedule. 主用网关检测新加入网关是否可以调度业务的过程和检测失效网关恢复的过程基本一致。 Detecting whether the main newly added gateway may scheduling service gateway process and the detection process consistent failure recovery gateway. 尽管上面对本发明进行了说明，应当理解，这些说明只是列举了本发明的一些具体实施的例子，其目的是为了使公众更好地理解本发明的精神和实和采用各种等同的手段。 Although on the face of the present invention have been described, it should be understood that the description is specific embodiments Some examples of the present invention, its purpose is to better understand the public spirit and embodiments of the present invention and the various equivalent means. 因此，本发明的范围仅由权利要求书所限定。 Accordingly, the scope of the present invention is limited only as defined by the claims. 例如，在上述这些实施方案中，也可以在局域网内单独配置控制单元（例如在服务器上）。 For example, in these embodiments, a separate control unit may be arranged in the LAN (e.g. on a server). 由该控制单元接替主用网关来选择为主机提供服务的网关。 Select the gateway with the gateway serving the host replaced by the main control unit. 此外，显然也可以由控制单元来控制局域网内主用网关与备用网关的监控、 切换等操作。 In addition, obviously also be controlled by the main LAN gateway and standby gateway monitoring, and other operations by the switching control unit. 在这种情况下，可以由控制单元指定局域网内的具有ARP功能的设备用被指定的服务网关的虛拟MAC地址来应答主机的ARP请求。 In this case, the control unit may be specified by the ARP request with ARP function device on the LAN MAC address is specified by the virtual gateway services to host response. 而不仅限于由被指定的服务网关来应答。 Not just to answer with the specified service gateway.