Direct server return

Also known as: DSR

On this page 7

Direct server return (DSR) is a load balancing forwarding mode in which the load balancer handles only the inbound half of each connection, while the backend server sends its responses directly to the client. Because response traffic never passes back through the balancer, DSR removes the balancer from the return path and allows a small appliance to front services whose outbound traffic is many times larger than their inbound traffic.

In networking practice, DSR is also called direct routing, triangular routing or asymmetric load balancing. It is a technique of Layer 4 load balancing and works best for protocols where requests are small and responses are large, such as video delivery, file downloads and DNS.

How direct server return forwards traffic

Direct server return works by letting the balancer rewrite only the delivery information of an incoming packet, not its destination IP address. The client sends a request to the virtual IP address (VIP) published by the service. The balancer selects a backend with its load balancing algorithm and forwards the packet so that it still carries the VIP as its destination.

Each backend has the VIP configured on a loopback interface and therefore accepts the packet as addressed to itself. When the server replies, it uses the VIP as the source address and sends the response through its default gateway, straight toward the client. The client sees a normal conversation with the VIP and never learns that two different machines handled the two directions.

The following table shows the path of a single TCP connection in DSR mode compared with a conventional proxy or NAT design.

StepDSR modeFull proxy or NAT mode
Client requestClient to VIP on the balancerClient to VIP on the balancer
Forward to backendDestination MAC or outer header rewrittenDestination IP rewritten or new connection opened
Backend responseServer to client directlyServer to balancer
Return to clientBalancer not involvedBalancer rewrites and forwards
Source IP seen by serverOriginal client IPBalancer IP unless preserved
Packet path in DSR and in a full-proxy design

Variants of DSR forwarding

DSR comes in several forwarding variants that differ in how the packet reaches a backend while keeping the VIP intact. The choice depends mainly on whether the balancer and servers share a Layer 2 broadcast domain.

MethodHow the packet is deliveredNetwork requirementTypical overhead
MAC rewritingOnly the destination MAC address changesSame Layer 2 segmentNone
IP-in-IP tunnelingPacket encapsulated in a new IP headerRouted reachability20 bytes per packet
GRE or GUE tunnelingPacket wrapped in a tunnel protocolRouted reachability, tunnel endpoint on server24 to 32 bytes per packet
Destination NAT with source preservedPartial rewrite, return routed via policyCareful routing designVaries
Common DSR forwarding methods

MAC-based DSR is the original and simplest form, used by Linux Virtual Server in its direct routing mode and by many hardware appliances. Tunnel-based DSR removes the Layer 2 constraint and allows backends in different subnets or data centers, at the cost of a reduced effective MTU, which must be handled with a lower MSS or path MTU discovery.

DSR compared with other load balancing modes

DSR trades features for throughput. A balancer that sees only half of each conversation cannot inspect responses, terminate TLS or retry a failed request, so DSR sits at the opposite end of the spectrum from Layer 7 load balancing.

PropertyDirect server returnLayer 4 NATLayer 7 proxy
Return traffic through balancerNoYesYes
Balancer bandwidth needInbound onlyBoth directionsBoth directions
TLS terminationNot possibleNot possibleSupported
Content-based routingNot possibleNot possibleSupported
Client IP visible to serverYes, nativelyYes, with routing designThrough headers or PROXY protocol
Server configuration changesLoopback VIP and ARP tuningGateway via balancerNone
Comparison of balancer forwarding modes

Because the server sees the real client address without any additional header, DSR avoids the need for the PROXY protocol or an X-Forwarded-For header. However, session persistence is limited to source-IP-based methods such as IP hash or consistent hashing, since the balancer cannot read cookies.

When direct server return is the right choice

DSR is most valuable when the response-to-request ratio is high and the balancer would otherwise become the bandwidth bottleneck. For a streaming service, responses can be ten to a hundred times larger than requests, so removing the return path reduces balancer load by roughly the same factor.

SituationRecommended choiceReason
Video, downloads, CDN originDSRLarge asymmetric responses
DNS and other UDP servicesDSRStateless, small queries, high packet rates
HTTPS with path routing or WAFLayer 7 proxyNeeds content inspection
Backends in another cloud or subnet without tunnelsNAT or proxyMAC rewriting cannot cross routers
Strict stateful firewall between servers and clientsNAT or proxyAsymmetric flows break state tracking
Decision guide for DSR

Large operators often combine both approaches: a DSR tier of Layer 4 balancers distributes traffic across a fleet of Layer 7 proxies, which then terminate TLS. This design scales the expensive proxy layer horizontally while keeping the front tier lightweight.

Limitations and common configuration mistakes

Most DSR failures come from the server-side configuration, because every backend must accept traffic for an address it must never advertise. The most frequent problem is the ARP problem: if a server answers ARP requests for the VIP, upstream switches may send all client traffic straight to that server and bypass the balancer entirely.

  • Suppress ARP for the VIP on every backend, for example with the Linux settings arp_ignore=1 and arp_announce=2.
  • Bind services to the VIP as well as the real address, or responses will carry the wrong source IP and clients will reset the connection.
  • Disable strict reverse path filtering where tunnel-based DSR delivers packets on an unexpected interface.
  • Health checks see only reachability: the balancer cannot observe response errors or latency, so checks must test the application explicitly.
  • Stateful middleboxes such as firewalls drop return packets they never saw opening, so the return path must be stateless or permitted explicitly.

Operational features are also reduced. Connection draining, rate limiting and response-based metrics must move to the servers themselves, and troubleshooting requires captures on both the balancer and the backend because no single device sees the complete flow.

In everyday language

Imagine a busy restaurant where a host at the door takes every order and assigns it to a cook. In a normal setup, each finished dish goes back past the host before it reaches the table, and the host soon becomes a crowded bottleneck.

Direct server return lets the cooks carry the dishes straight to the tables. The host still decides who cooks what, but only handles the small orders, not the heavy plates. The result is that one modest doorway can serve a very large dining room, as long as every cook knows how to find the tables and nobody needs the host to check each plate.

Seen in the real world

A regional video platform serves recorded lectures from twelve origin servers, each with a 25 Gbit/s uplink. Requests from viewers total about 2 Gbit/s at peak, while video responses reach roughly 180 Gbit/s. A pair of Layer 4 balancers with 40 Gbit/s interfaces could never carry that return traffic in proxy mode.

The network team configures DSR with IP-in-IP tunneling, places the VIP on each server’s loopback, suppresses ARP for it and lowers the TCP MSS to absorb the tunnel header. Session affinity uses consistent hashing on the client address. After the change, the balancers carry only the inbound 2 Gbit/s, CPU load on them stays below 15 percent, and the origin servers deliver video at full uplink speed directly to viewers.