1. Field of the Invention
The present invention relates to a wide area network (WAN) interface selection method and WAN system using the same, and more particularly, to a wide area network (WAN) interface selection method and WAN system using the same capable of selecting WAN interfaces for packets according to network address translation (NAT) session information of the packets, so as to achieve better load sharing between WAN interfaces.
2. Description of the Prior Art
A dual wide area network (WAN) system includes a router and two WAN interfaces on two digital subscriber line (DSL) lines. Under such a configuration, the router can receive packets from a local area network (LAN) side and send out the packets to a WAN side through the two WAN interfaces on the DSL lines.
Therefore, in order to achieve better load sharing between the two WAN interfaces for maximizing efficiency, a processor is utilized to determine which WAN interface should a packet be sent out through. Conventionally, the processor makes the decision according to a source internet protocol (IP) address or asynchronous transfer mode (ATM) bonding of the packet.
However, in the case where the processor makes the decision according to the source IP address of the packet, when only one source IP address from the LAN side sends out packets to the WAN side, only one WAN interface would be utilized for sending out all these packets. This cannot achieve a true bandwidth aggregation, i.e. load sharing between the two WAN interfaces. On the other hand, in the case where the processor makes the decision according to ATM bonding of the packet, load sharing between the two WAN interfaces can not be achieved simply by software implementation since ATM bonding would require additional hardware implementation. It will increase the cost.
Thus, there is a need for improvement of those conventional systems.
It is therefore an objective of the present invention to provide a wide area network (WAN) interface selection method and WAN system using the same capable of selecting WAN interfaces for packets according to network address translation (NAT) session information of the packets, so as to achieve better load sharing between WAN interfaces.
The present invention discloses a wide area network (WAN) interface selection method for a WAN system comprising a plurality of WAN interfaces. The WAN interface selection method includes steps of receiving a plurality of packets from a local area network (LAN) side; selecting respective WAN interfaces from the plurality of WAN interfaces for the plurality of packets according to network address translation (NAT) session information of the plurality of packets; and sending out the plurality of packets through the respective WAN interfaces.
The present invention further discloses a wide area network (WAN) system capable of performing load sharing. The WAN system includes a plurality of WAN interfaces; and a processor, for receiving a plurality of packets from a local area network (LAN) side, and selecting respective WAN interfaces from the plurality of WAN interfaces for the plurality of packets according to network address translation (NAT) session information of the plurality of packets, to send out the plurality of packets through the respective WAN interfaces.
These and other objectives of the present invention will no doubt become obvious to those of ordinary skill in the art after reading the following detailed description of the preferred embodiment that is illustrated in the various figures and drawings.
Please refer to
Specifically, please refer to
In this embodiment, if the packet Pkt1 is corresponding to a NAT session of a NAT session table stored in the processor, the processor selects a respective WAN interface specified in the NAT session for the packet Pkt1, and then sends out the packet Pkt1 to the WAN side through the respective WAN interface, e.g. the WAN interface WAN1.
On the other hand, in another embodiment, if the packets Pkt1, Pkt2 are not corresponding to any NAT session of the NAT session table stored in the processor, the processor selects respective WAN interfaces from the WAN interfaces WAN1, WAN2 sequentially for the packets Pkt1, Pkt2 by a round robin method, e.g. selects the WAN interface WAN1 as the respective WAN interface for the packets Pkt1 and selects the WAN interface WAN2 as the respective WAN interface for the packets Pkt2. Then, the processor uses the respective WAN interfaces to create NAT sessions of the packets Pkt1, Pkt2 and store related information in the NAT session table, and then sends out the packets Pkt1, Pkt2 to the WAN side through the respective WAN interfaces.
For example, please refer to
Step 300: Start.
Step 302: Receive the packet Pkt1 from the LAN side.
Step 304: Determine whether the packet Pkt1 is corresponding to any NAT session of the NAT session table stored in the processor. If yes, go to step 314; otherwise, go to step 306.
Step 306: Check whether the flag value is 0. If yes, go to 308; otherwise, go to step 310.
Step 308: Select the WAN interface WAN1 as the respective WAN interface for the packet Pkt1 and set the flag value as 1. Go to step 312.
Step 310: Select the WAN interface WAN2 as the respective WAN interface for the packet Pkt1 and set the flag value as 0. Go to step 312.
Step 312: Use the respective WAN interface to create a NAT session of the packet Pkt1.
Step 314: Send out the packet Pkt1 to the WAN side through the WAN interface specified in the NAT session of the packet Pkt1.
Step 316: End.
Noticeably, in this embodiment, the packets Pkt1, Pkt2 are received from different source IP addresses and thus corresponding to different NAT sessions, such that the packets Pkt1, Pkt2 can be sent out through different respective WAN interfaces. Even when the packets Pkt1, Pkt2 are received from the same source IP address but different NAT sessions, e.g. different destinations, such that the packets Pkt1, Pkt2 can still be sent out through different respective WAN interfaces.
In another embodiment, if the packet Pkt1 is not corresponding to any NAT session of the NAT session table stored in the processor, the processor selects a respective WAN interface from the WAN interfaces WAN1, WAN2 for the packet Pkt1 by a hash algorithm according to NAT session information, such as a source IP address, a destination address and a protocol number, of the packet Pkt1. Then, the processor uses the respective WAN interface to create a NAT session of the packet Pkt1 and store related information in the NAT session table, and then sends out the packet Pkt1 to the WAN side through the respective WAN interface, e.g. the WAN interface WAN1.
For example, please refer to
Step 400: Start.
Step 402: Receive the packet Pkt1 from the LAN side.
Step 404: Determine whether the packet Pkt1 is corresponding to any NAT session of the NAT session table stored in the processor. If yes, go to step 414; otherwise, go to step 406.
Step 406: Calculate the sum of the source IP address, the destination address and the protocol number of the packet Pkt1. If the sum modulo 2 is 0, go to 408; otherwise, go to step 410.
Step 408: Select the WAN interface WAN1 as the respective WAN interface for the packet Pkt1. Go to step 412.
Step 410: Select the WAN interface WAN2 as the respective WAN interface for the packet Pkt1. Go to step 412.
Step 412: Use the respective WAN interface to create a NAT session of the packet Pkt1.
Step 414: Send out the packet Pkt1 to the WAN side through the WAN interface specified in the NAT session of the packet Pkt1.
Step 416: End.
Noticeably, the spirit of the present invention is to select respective WAN interfaces for packets according to NAT session information of the packets, and then send out the packets to a WAN side through the respective WAN interfaces, so as to achieve a better bandwidth aggregation by software implementation of the processor. Those skilled in the art should make modifications or alterations accordingly. For example, number of WAN interfaces of the WAN system 10 is preferably two, i.e. a dual WAN system, but is not limited to this. Besides, the hash selection process 40 utilizes the sum of all of the source IP address, the destination address and the protocol number of the packet Pkt1 to select the respective WAN interface for the packet Pkt1, but the hash selection process 40 can also be achieved by utilizing a sum of only the source IP address and the destination address of the packet Pkt1, i.e. less load sharing.
Moreover, please refer to
The above operations of the WAN system 10 receiving packets from the LAN side to the WAN side can be summarized into a selection process 60 as shown in
Step 600: Start.
Step 602: Receive a plurality of packets from the LAN.
Step 604: Select respective WAN interfaces from the plurality of WAN interfaces WAN1, WAN2 for the plurality of packets according to the NAT session information of the plurality of packets.
Step 606: Send out the plurality of packets through the respective WAN interfaces.
Step 608: End.
Details of the selection process 60 can be derived by referring to the above corresponding descriptions, and are noted narrated hereinafter.
In conventional systems, if the processor determines which WAN interface should the packet be sent out through according to a source IP address of the packet, it can not achieve a true bandwidth aggregation, i.e. load sharing between the two WAN interfaces; and if the processor determines which WAN interface should the packet be sent out through according to ATM bonding of the packet, additional hardware implementation of ATM bonding is required. In comparison, the present invention selects respective WAN interfaces for packets according to NAT session information of the packets, and then sends out the packets to a WAN side through the respective WAN interfaces. It achieves a better bandwidth aggregation by software implementation of the processor, without additional hardware implementation.
Those skilled in the art will readily observe that numerous modifications and alterations of the device and method may be made while retaining the teachings of the invention.