Solved

redhat 5 ftp forwarding

Posted on 2013-06-24
8
548 Views
Last Modified: 2013-07-11
Hi Experts,

I have a RHEL 5.4 box with 2 NICs, one connected to a network that has a FTP server while the other NIC connected to a internal network. I would like to setup this box such that other boxes in the internal network can access the FTP server. Is there something like FTP forwarding that i can setup on this server?

Thanks.
0
Comment
Question by:nokyplease
  • 5
  • 2
8 Comments
 
LVL 6

Expert Comment

by:Vijay Pratap Singh
ID: 39273579
Internal boxes can also access the same FTP just need to be in same network whats the issue you facing in this?
0
 

Author Comment

by:nokyplease
ID: 39273714
internal boxes cannot access to the subnet that the FTP server locate, other boxes in the internal network can reach the redhat server nic2.

FTP subnet (nic1) ---- RHEL5 ----- internal network (nic2)

the RHEL5 can access to the FTP without problem as it's nic1 is on the FTP subnet. I want to make other servers in the internal network able to access the FTP via RHEL5:-

FTP subnet <---- RHEL5 <----- internal network ----- server A

is there something that i can setup such that serverA can issue a command like "ftp RHEL5" and then it will actually go to the real FTP on the FTP subnet?

Thanks.
0
 

Author Comment

by:nokyplease
ID: 39280061
Anyone ? I am thinking if iptables may work?
0
 
LVL 27

Expert Comment

by:serialband
ID: 39280170
How about running a 2nd FTP server and having it listen on the other IP address?

I'm not on redhat and I don't know which ftp server you're running, but here's what I've done before.  (examples from memory)

cp  -pr /etc/vsftp /etc/vsftp2
sed -i -e 's/IP_1/IP_2/' /etc/vsftp2/vsftpd.conf

cp /etc/init.d/ftp /etc/init.d/ftp2
sed -i -e 's:/etc/vsftp:/etc/vsftp2:g' /etc/init.d/ftp2

/etc/init.d/ftp2 start

I actually had to do this for IPv6.
0
Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

 

Author Comment

by:nokyplease
ID: 39286536
Not sure how a 2nd ftp server can achieve my goal?

To simplify a bit, what I want to setup is to forward any incoming ftp request (port 20 and 21 as the target ftp is active) to the rhel5 to the target ftp server running outside of the internal network.

I think I will need to enable ip forwarding, setup some nat rules and may also need to enable ip masquerade on the interface connecting to the ftp?
0
 
LVL 27

Expert Comment

by:serialband
ID: 39287004
The 2nd server would answer on the internal network ip address, allowing your internal users to access the FTP server.  You can have different rules and setups for the two separate servers.
0
 

Accepted Solution

by:
nokyplease earned 0 total points
ID: 39288497
Hi ,

I managed to setup the forwarding with iptables and nat rules on the RHEL5 box

iptables -P INPUT ACCEPT
iptables -P OUTPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -t nat -P PREROUTING ACCEPT
iptables -t nat -P POSTROUTING ACCEPT
iptables -t nat -P OUTPUT ACCEPT

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 20 -j DNAT --to-destination FTP-Server:20
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 21 -j DNAT --to-destination FTP-Server:21

iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to RHEL5-NIC2


However, when i issue ftp commands like ls, i got "421 service not available, remote server has closed connection."

please help.
0
 

Author Closing Comment

by:nokyplease
ID: 39316928
To resolve the issue after nat, we can ensure the ip-nat kernel modules are loaded
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now