IPTables forwarding rule

From: Harry Phillips (harry_at_hkjsfh.com)
Date: 07/21/04


Date: Wed, 21 Jul 2004 19:20:34 +1000

I have a client with a firewall device that has a limited interface to
iptables (I cannot ssh into it either). All you can do is forward a port
to another IP address, you can't restrict it to a certain source IP.

I have set it up to forward port 22 to my Linux box, that then has
IPTables to accept anything local and drop everything else except my
ADSL modem IP.

Now I want to do a similar thing except forward the packets to another
internal host. I have no idea where to start and what rules to use. The
setup is:

                  _____________________
                 | (firewall device) | |---> |192.168.1.50|
internet <----> |ext_ip 192.168.1.254| <---|---> |192.168.1.1 |
                 |_____________________| |---> |192.168.1.x |

I want the Linux box (192.168.1.1) to forward port x to 192.168.1.50,
but only if the source is my ADSL modem IP.

Do I use the NAT and PREROUTING, POSTROUTING, FORWARD? I have examples
from the Internet if the Linux box and the host it is forwarding to are
on different networks but not when they are on the same network.

-- 
Regards,
Harry Phillips


Relevant Pages

  • IPTables forwarding rule
    ... I have set it up to forward port 22 to my Linux box, ... IPTables to accept anything local and drop everything else except my ... on different networks but not when they are on the same network. ...
    (alt.linux)
  • IPTables forwarding rule
    ... I have set it up to forward port 22 to my Linux box, ... IPTables to accept anything local and drop everything else except my ... on different networks but not when they are on the same network. ...
    (alt.os.linux)
  • Re: seeking a better understanding
    ... | 80 is the only port allowed through, and someone chose to attack this ... I know this is a firewall, but I don't think it is like ... Yes, you can use iptables. ... Then you can consider the Linux ...
    (Security-Basics)
  • Re: local nets
    ... i have a linux box with 3 networks on! ... >> i masq both local nets through eth0, ... > Which distro do you use, and do you use IPCHAINS, IPTABLES etc?? ...
    (comp.os.linux.security)
  • Re: Allow Passive move ftp
    ... > a random source of high port no. would mean a security loop hole... ... > currently i only allow packets originating from port 20 or port 21 to go ... If you're talking about a Linux distro, such as RootHat or Mandork Linux ... then IPTables has nothing to do with them either. ...
    (comp.security.firewalls)