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 24.0.50.50) on port 21 to the inside machine's (eg 192.168.2.254) port 21. It'd be really cool if you could give me the command with all the options attached :). Thanks.

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

[Webinar] Streamline your web hosting managementRegister Today

x
 
wqclatreConnect With a Mentor Commented:
check out ipmasqadm
http://juanjox.kernelnotes.org/

ipmasqadm portfw -a -P tcp -L 192.168.2.254 80 -R 24.0.50.50 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
0
 
Manfred BertlManagerCommented:
ipchains -A forward -s 24.0.50.50/0 21 -d 192.168.2.254/0 21 -i eth0


0
 
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 24.0.50.50 to 192.168.2.254... but I'll give it a shot.
0
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.

 
wqclatreCommented:
You also have to enable somethings in the kernel...
CONFIG_KMOD=y      
CONFIG_IP_MASQUERADE_MOD=y
CONFIG_IP_MASQUERADE_IPPORTFW=m

btw You have a FAQ on:
http://juanjox.kernelnotes.org/ipmasqadm-FAQ.txt
0
 
wqclatreCommented:
Sorry.. I'm to tired right now.
The syntax is
ipmasqadm portfw -a -P tcp -L 192.168.2.254 21 -R 24.0.50.50 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...
0
 
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.
0
All Courses

From novice to tech pro — start learning today.