LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-22-2001, 05:08 PM   #1
vjeronimus
LQ Newbie
 
Registered: Sep 2001
Posts: 1

Rep: Reputation: 0
Help wanted: IPTables / ip_masq_ftp


Hi,

I recently reinstalled my linux machine with RedHat 7.1. Before that, I was using Mandrake 7.1 (based on Redhat 6.x). I've converted most of my firewall rules, but I'm stuck with some ftp redirection.

I used the following code on Mandrake:


/usr/sbin/ipmasqadm portfw -f # flush the table
/usr/sbin/ipmasqadm portfw -a -P tcp -L xxx 41 -R yyy 41
/usr/sbin/ipmasqadm portfw -a -P tcp -L xxx 62 -R yyy 62
/usr/sbin/ipmasqadm portfw -l -n
/sbin/modprobe ip_masq_ftp ports=41,62


How can I get the same results with IPTABLES?

I've tried the following (in some varieties..):


IPTABLES -t nat -A PREROUTING -i eth1 -p tcp -sport 41 -j DNAT --to yyy
IPTABLES -t nat -A PREROUTING -i eth1 -p tcp -sport 62 -j DNAT --to yyy


with all 'filter' chains on default policy "Accept" (just to try it out).

Anyone?

regards,
 
Old 10-12-2001, 02:21 PM   #2
warath
Member
 
Registered: Oct 2001
Location: Ontario, Canada
Distribution: Redhat 9
Posts: 43

Rep: Reputation: 15
Here is my iptables script

echo "1" >/proc/sys/net/ipv4/ip_forward
echo "1" >/proc/sys/net/ipv4/conf/all/rp_filter

#flush the tables first
/sbin/iptables --flush
/sbin/iptables --table nat --flush
/sbin/iptables --delete-chain
/sbin/iptables --table nat --delete-chain
#setup masqurading
/sbin/iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
/sbin/iptables --append FORWARD --in-interface eth1 -j ACCEPT

#YOUR PORT FORWARDS
iptables -t nat -A PREROUTING -p tcp -d $INET_IP -dport 41 -j DNAT --to yyy:$PORT_NUM

$INET_IP is your internet ip address
$PORT_NUM is the port number to redirect to if different

let me know if that works.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IPTABLES Firewalling Help Wanted Evilone Linux - Security 5 09-30-2004 10:24 PM
Nothing yet, just wanted to say hello! Yendor44 LinuxQuestions.org Member Intro 4 04-10-2004 01:24 PM
ip_masq_ftp ry Linux - General 0 05-06-2002 01:01 AM
ip_masq_ftp stalin Linux - Networking 3 06-26-2001 04:49 PM
Connection Refused and ip_masq_ftp ivannus Linux - Networking 1 06-14-2001 11:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration