natd with several alias IPs

Chuck Swiger cswiger at
Wed Feb 15 19:16:22 PST 2006

Andrew Pantyukhin wrote:
> I wonder, what tricks do you use to use more than
> one alias IP? I mean, if you have hundreds of
> hosts behind your firewall, what can you do to alias
> some of them to one ip, others to another and so on.

See "man natd" about the following options for 1-to-1 NAT translation, which can
be put into /etc/natd.conf and processed automagicly when the machine boots:

     -redirect_address localIP publicIP
                 Redirect traffic for public IP address to a machine on the
                 local network.  This function is known as static NAT.  Nor-
                 mally static NAT is useful if your ISP has allocated a small
                 block of IP addresses to you, but it can even be used in the
                 case of single address:


                 The above command would redirect all incoming traffic to

                 If several address aliases specify the same public address as

                       redirect_address public_addr
                       redirect_address public_addr
                       redirect_address public_addr

                 the incoming traffic will be directed to the last translated
                 local address (, but outgoing traffic from the
                 first two addresses will still be aliased to appear from the
                 specified public_addr.

     -redirect_address localIP[,localIP[,...]] publicIP
                 These forms of -redirect_port and -redirect_address are used
                 to transparently offload network load on a single server and
                 distribute the load across a pool of servers.  This function
                 is known as LSNAT (RFC 2391).  For example, the argument

                       tcp www1:http,www2:http,www3:http www:http

                 means that incoming HTTP requests for host www will be trans-
                 parently redirected to one of the www1, www2 or www3, where a
                 host is selected simply on a round-robin basis, without
                 regard to load on the net.


More information about the freebsd-questions mailing list