Nginx as Loadbalancer, router + NAT

Hi,
we planing to switch our websites Loadbalancer to Nginx.
Currently it is a Pound LB with around 1000-2000 connections/s and all
Backend-Servers are in the same official Subnet.
We want to make all Backend-Webservers private (192.168.x.x) and only
the LB with an official IP address and NAT to the backends.
Is this possible with nginx? I only see examples with 127.0.0.1.
Does NAT and routing use a lot more Load?

Thank you

Sascha Kain
IT - Administration
eraffe media GmbH & Co. KG
Marketing - Consulting - Software
Schönfeldstr. 17 - 83022 Rosenheim

Fon: + 49 (0)8031 - 941 41 -31
Fax: + 49 (0)8031 - 941 41 -69
Email: [email protected]

www.eraffe-media.de - www.eraffe.de

eraffe media GmbH & Co. KG, Sitz: Rosenheim,
Registergericht: AG Traunstein HR A Nr. 9104,
St-Nr. 156/125/80046, Ust-IdNr. DE 156/157/58806

Persönlich haftende Gesellschafterin:
eraffe media Verwaltungs-GmbH, Sitz: Rosenheim,
Registergericht: AG Traunstein HR B 16956

Geschäftsführer: Maximilian Kuss, Oliver Döser

On Tue, Jul 29, 2008 at 01:10:51PM +0200, Sascha sk. Kain wrote:

we planing to switch our websites Loadbalancer to Nginx.
Currently it is a Pound LB with around 1000-2000 connections/s and all Backend-Servers are in the same official Subnet.
We want to make all Backend-Webservers private (192.168.x.x) and only the LB with an official IP address and NAT to the backends.
Is this possible with nginx? I only see examples with 127.0.0.1.
Does NAT and routing use a lot more Load?

If I understand your question, you may set any addreses in upstream:

upstream  backend {
    server   192.168.1.1;
    server   192.168.1.2;
    server   192.168.1.3;
    server   192.168.2.1;
    server   192.168.2.1;
    # and
    server   127.0.0.1;
    # and even
    server   unix:/tmp/socket;
}

Hi,
Yes correct! And to the server section I would add this lines:

server {
listen 89.250.xx.xxx:80 # offical ip-adress

}

And enable NAT/IP-Masquerading on this box.

Then I should have a Router/NAT/LoadBalancer with nginx. Correct?
I need the IP based Hash, to get always to the same private host!

Will there be any problems with the host headers or smt like this?

Best Regards

Sascha

-----Ursprüngliche Nachricht-----
Von: [email protected] [mailto:[email protected]] Im Auftrag von
Igor S.
Gesendet: Dienstag, 29. Juli 2008 14:12
An: [email protected]
Betreff: Re: nginx as Loadbalancer, router + NAT

On Tue, Jul 29, 2008 at 01:10:51PM +0200, Sascha sk. Kain wrote:

we planing to switch our websites Loadbalancer to Nginx.
Currently it is a Pound LB with around 1000-2000 connections/s and all Backend-Servers are in the same official Subnet.
We want to make all Backend-Webservers private (192.168.x.x) and only the LB with an official IP address and NAT to the backends.
Is this possible with nginx? I only see examples with 127.0.0.1.
Does NAT and routing use a lot more Load?

If I understand your question, you may set any addreses in upstream:

upstream  backend {
    server   192.168.1.1;
    server   192.168.1.2;
    server   192.168.1.3;
    server   192.168.2.1;
    server   192.168.2.1;
    # and
    server   127.0.0.1;
    # and even
    server   unix:/tmp/socket;
}