[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: NAT problems

Tobias Geijersson <tobias.geijersson@xtnd.com> writes:

> The problem is that when I add the rule for masqurading it translates
> all to eth0's before routed to my ip
> provider, and that adress is a private one and will not work!
> How do I solve this in kernel 2.2?

I'm not sure I entirely understand your dilema but it should be possible
under 2.2.  You need to use the iproute2 package and have an appropriately
compiled Linux kernel.

I've used policy routing in a few places and it enables you to masquerade/NAT
as any address you like.

ip rule add from nat

If you router's default gateway is on an interface other than the one to
which you wish to NAT then you may have to set up a custom routing table for
that network.

ip route add default via table 192
ip rule add from lookup table 192 nat

This has the effect of routing all your externally destined packets arriving
from the network to your router with a source address
of ... must actually be an address assigned to you Linux box.

Note you will probably have to add throw routes for your local networks to
the new routing table you created so that local traffic works correctly.

We use this in a location with 4 different Internet connections (DSL/T1) and
route different private IP servers out the different gateways ... it works
very well.

fraser campbell <fraser@starnix.com>                          starnix inc.
tollfree: (905) 771-0017                        thornhill, ontario, canada
http://www.starnix.com/             professional linux services & products

Reply to: