Layer 4 router

From Wikipedia, the free encyclopedia

A typical network router simply sends incoming packets onto the appropriate IP address on its network. A layer 4 router uses a little trickery and sends incoming packets to one or more machines which are hidden behind a single IP address.

The Layer 4 refers to the 7 layer OSI model. The router is on the Transport Layer and makes decisions on where to send the packets. Modern load balancing routers can use different rules to make decisions on where to route traffic. This can be based on least load, or fastest response times, or simply balancing requests out. This is also a redundancy method, so if one machine is not up, the router will not send traffic to it.

[edit] Example

The router will be assigned a VIP (Virtual IP address). All the machines servicing requests will have an interface assigned to that VIP as well. The router will also have a way of checking the heartbeat of the machines. This is configurable, but is often a page on the machine's web server. The apache status page is often used, but this requires server resources and is probably not a good choice. As requests come in, the router sends the request to the appropriate machine, which then sends the response back to the client.