IPChains and forwarding...

I've got one machine set up as a firewall/masquerading machine. I have another behind it on my LAN that's set up to do web serving, ftp serving, etc. How can I use IPChains to forward all packets on the outside NIC (eg on port 21 to the inside machine's (eg port 21. It'd be really cool if you could give me the command with all the options attached :). Thanks.

ipchains -I forward ...(?)
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

wqclatreConnect With a Mentor Commented:
check out ipmasqadm

ipmasqadm portfw -a -P tcp -L 80 -R 80

if i remember the syntax right...
portfw works by reverse-masq so you must have a masq rule to
``take the reply packets out

(something like this)
   # ipchains -I forward -p tcp -s internal_IP/32 80 -j MASQ
Manfred BertlManagerCommented:
ipchains -A forward -s 21 -d 21 -i eth0

jguerinAuthor Commented:
 mmmm... I'm not sure about that... but I'll try it. From what I've read in the man pages, that will just allow all packets with those respective source/destinations to go from the firewall to my other server... but I don't think that it actually will forward the connections from to but I'll give it a shot.
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

You also have to enable somethings in the kernel...

btw You have a FAQ on:
Sorry.. I'm to tired right now.
The syntax is
ipmasqadm portfw -a -P tcp -L 21 -R 21

I thought that you wanted to forward the www-server (port 80)
If you like to forward a ftp-server I think you also have to forward port 20 (ftp-data)
otherwise you can only use passive-mode in youre ftp-client when you connect to youre ftp from outside...
jguerinAuthor Commented:
Heheh, well I was hoping to find some way to get ipchains to do it. I guess it turns out that ipchains is only for packet filtering. Too bad. I just ran into ipmasqadm the other day and am trying to install it now. Thanks.
All Courses

From novice to tech pro — start learning today.