Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

reroute incoming ftp connection

Status
Not open for further replies.

denis60

Technical User
Apr 19, 2001
89
CA
Hi!

Is it possible to reroute an incoming ftp connection to an other server from a specific ip address.

Thanks in advanced
 
assuming that your external interface is ppp0
and you want to redirect traffic from 10.1.1.0 network to another FTP server

iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 21 -j -s 10.1.1.0 DNAT --to-destination new_server_address:21


CHeers

QatQat

Life is what happens when you are making other plans.
 
Thanks so much QatQat.
I'll try as soon as possible :)
 
Can we preroute a tcp port to a ssh port with the same line of command:

ex.: iptables -t nat -A PREROUTING -i ppp0 -p tcp --dport 21 -j -s 10.1.1.0 DNAT --to-destination new_server_address:22
 
Not exactly;
Probably what you want to do is tunneling.
FTP protocol and SSH service serve two very different purposes; you can however tunnel a lot of services through SSH, but FTP is not among them.

You rather use scp to securely move files across machines.

here is an example of syntax

assuming that you want to move file1 from home/user1 into another machine

scp /home/file1 remotemachine.domain.com:/home/remoteuser/file1

This will attempt to login using the same user you are using on the sending pc.

to specify a different user


scp /home/file1 remoteuser@remotemachine.domain.com:/home/remoteuser/file1


Finally, another useful parameter, if SSH server on remote pc does not run on port 22

scp -P xxx /home/file1 remotemachine.domain.com:/home/remoteuser/file1

where xxx is the new port number.

Cheers

QatQat



Life is what happens when you are making other plans.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top