LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-17-2012, 03:18 AM   #1
nepalproxy
LQ Newbie
 
Registered: Jul 2012
Posts: 7

Rep: Reputation: Disabled
FTP Port Forwarding


I have the following requirement, I am a general user and do not have much idea about it.

My FTP Server is installed on 192.168.1.200
My Public IP is 202.70.56.12

I have Centos 6.3 Installed on two machines

Centos 1 has 202.70.56.12 IP
Centos 2 has 192.168.1.200 IP

I want to forward all ftp request on Centos 1 IP 202.70.56.12 to 192.168.1.200

I tried using iptables but do not succeed..

Please help me with all detailed steps.
 
Old 10-17-2012, 04:57 AM   #2
KatrinAlec
Member
 
Registered: Feb 2012
Posts: 125

Rep: Reputation: 14
You'll have to use the table for nat and there are two ports envolved.

First step is a destination nat
if you try to reach your public ip on port 21 (the control-channel) forward it to your FTP Server.

You also need the state ESTABLISHED to let things back out.

Then you need the state RELATED for the data channel (port 20) so that your firewall knows to let that port through as well.

Since I don't know the syntax by heart:
http://stackoverflow.com/questions/1...nd-passive-ftp
 
Old 10-19-2012, 11:02 AM   #3
piquezino
LQ Newbie
 
Registered: Aug 2012
Location: Troyes, France
Distribution: Ubuntu
Posts: 15

Rep: Reputation: Disabled
Hello,

Try this :

Quote:
# echo 1 > /proc/sys/net/ipv4/ip_forward
Quote:
iptables -t nat -A PREROUTING -d 192.168.1.200 -p tcp –dport 21 -j DNAT –to-dest 202.70.56.12
iptables -t nat -A POSTROUTING -d 202.70.56.12 -p tcp –dport 21 -j SNAT –to 192.168.1.200
 
  


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
Port forwarding for FTP server dlugasx Linux - Server 1 10-21-2010 11:42 AM
FTP port forwarding tomammon Linux - Networking 1 10-15-2004 06:49 AM
port forwarding using iptables (ftp) spank Linux - Newbie 3 01-20-2004 06:14 AM
Problem With FTP and Maybe Port forwarding ComFox Linux - Networking 1 09-19-2002 10:16 PM
ftp and ftp port forwarding with IPtables?? FunkFlex Linux - Security 3 04-24-2002 03:03 AM

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

All times are GMT -5. The time now is 10:08 PM.

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