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

  • [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: 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)
  • Re: Need help with network aliases and firewall (FC4)
    ... /sbin/ip address add 10.0.0.1/24 device eth1 ... /sbin/ip route add 10.0.0.0/24 device eth1 ... iptables, so I use firestarter as a gui to it. ... It seems there is no way to make firestarter work with aliases. ...
    (Fedora)
  • Re: Routing by port number
    ... This document describes packet marking and routing with iptables and ... wcardwell at nc dot rr dot com ... > connections pass through one route, all http connections another, etc. ...
    (comp.os.linux.networking)