Re: Changing the source address when accessing a different network

From: Allen Kistler (ackistler@yahoo.com)
Date: 02/26/03


From: Allen Kistler <ackistler@yahoo.com>
Date: Wed, 26 Feb 2003 07:08:39 GMT

Stuart wrote:
> I have a Linux RedHat 8.0 (2.4 Kernel) box set up as a
> router/firewall.
>
> It has 4 NICs which route to various private networks i.e.
> 10.1.x.x/16,10.2.x.x/16,10.3.x.x/16,192.168.127.x/24. The last NIC is
> connected to a third party network which the 10.x.x.x networks need to
> route to.
>
> [snip]
>
> Can anyone reply with the iptables commands to get the Linux router to
> change the source addresses?

In /etc/sysconfig/iptables, create a section for nat (since it probably
doesn't already exist, I imagine).

*nat
-A POSTROUTING -o eth3 -j SNAT --to 192.168.127.1
COMMIT

assuming your 4th interface is eth3 and its address is static and
192.168.127.1. Obviously you also need to have iptables installed and
started. You say it's already a firewall....

The above will get you started. There is probably more for you to do.
There are useful HOWTOs at www.tldp.org (which tend to be more concerned
with ipchains), a lot of iptables-specific info at www.netfilter.org,
and, of course, there's the iptables man page.



Relevant Pages

  • Re: Bridging network adapters in Linux
    ... ip addr add $address/$netbits dev br0 ... Either a default route ... two network devices assuming, ... This is done using the iptables mechanism. ...
    (comp.os.linux.networking)
  • [SLE] An iptables challenge
    ... I'm working on figuring out an issue in iptables, ... connected via a VPN link. ... Each box that needs to connect to the third subnet has a ... static route pointing it to the local terminus of the VPN link currently ...
    (SuSE)
  • Re: Forwarding not work in FC9 but ip_forward is turn on
    ... I installed FC9 on my PC that will work as official proxy / firewall. ... A ping from 192.168.10.20 works toward 192.168.5.254 ... iptables has no rule, in fact I have executed the following ... /sbin/ip route add 192.168.10.1/24 dev eth6 ...
    (Fedora)
  • Re: dialup solution (as seconary connection / iptables )
    ... Let me first ask in short the most pressing IPTABLES question. ... Where and how do I alter the source IP to my ppp0 internet IP. ... there which are executed on dialing a connection and on hang up. ... Currently I have default route to router and out to DSL internet. ...
    (comp.os.linux.networking)
  • Re: Seriously confused about linux routing
    ... trying to route traffic originating at 10.10.0.0/16 and direct it to ... computers on the other subnets, however, I'm having problems with the ... Now I'm trying to configure iptables to allow me to use these machines ...
    (comp.os.linux.networking)