Layer 4 (LVS)

Overview of the LB Layer4 tab

This page applies to:

  • HAProxy ALOHA - all versions

The LB Layer4 tab configures the IP Virtual Server (IPVS) component of the Linux Virtual Server (LVS) embedded software. LVS is a Linux-based load balancer for TCP and UDP that works by switching network packets at the transport layer of the OSI model. It supports Direct Server Return (DSR) and destination NAT. LVS by itself either listens to all ports on an IP or a single specified port. If you need to listen on a range of ports, define a flow.

LVS supports a variety of configurable options such as:

  • Load balancing schemes including round robin, least connection, source, destination, source/destination, and shortest expected delay.
  • Server health checks by HTTP, TCP, ICMP, or ARP protocol.

LVS is a good choice for certain use cases, while the embedded HAProxy is good for others.

Prefer LVS (LB Layer4 tab) when Prefer HAProxy (LB Layer7 tab) when
  • You want to enable Direct Server Return from backend servers.
  • You want to enable destination NAT. If you also need source NAT, use the NAT tab to configure it.
  • You want to load balance an application that uses TCP or UDP (HTTP, WebSocket, FastCGI, Syslog, DNS, for example) with superior logging and statistics.
  • Your use case requires TLS, HTTP routing rules, HTTP header modification, rate limiting, caching, compression, or other HAProxy features.

Do you have any suggestions on how we can improve the content of this page?