Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 02-10-2005, 07:40 AM   #1
Senior Member
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Rep: Reputation: 45
change port using destination

Hi... Do u know if it is possible to change the port of some packets using iptables.? I want the decision to be based on the ip address..
Any suggestion?
Old 02-10-2005, 10:39 AM   #2
Registered: Jan 2005
Location: Cork Ireland
Distribution: Debian
Posts: 384

Rep: Reputation: 32

man iptables and search for SNAT, DNAT

ex :
iptables -t nat -A POSTROUTING -s -p tcp --sport 80 -j SNAT --to-source
iptables -t nat -A PREROUTING -d -p tcp --dport 8080 -j DNAT --to-dest

You can have a look at

Old 02-11-2005, 10:55 AM   #3
Senior Member
Registered: Dec 2000
Location: Gothenburg, SWEDEN
Distribution: OpenSUSE 10.3
Posts: 1,028

Rep: Reputation: 45
I you only want to change the port, then you can use the REDIRECT target.
Old 03-01-2005, 05:06 AM   #4
LQ Newbie
Registered: Jan 2005
Location: New Delhi
Posts: 17

Rep: Reputation: 0
Hello all of you

But as u suggested to use iptables it will redirect the traffic of ftp port to another port BUT it still outer world will use the same port.

I dont know but is there any way to change the ftp port so that default ftp port will get changed.means to ftp some system user cant enter from port 21.



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
PLESK [Solution] Change port to 23 (telnet) instead of default port 8443 x5452 Linux - Software 6 05-10-2009 06:58 AM
Change the destination URL by IPTABLES swmok Linux - Networking 4 09-14-2004 12:33 PM
Change Telnet Port acbenny Linux - Networking 2 07-22-2004 09:05 AM
--destination-ports port[,port[,port...]] KevinGuy Linux - Networking 1 03-16-2004 07:06 PM
IPTABLES --to-destination muliple ip:port hawk4eye Linux - Networking 4 02-07-2003 05:59 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 02:28 PM.

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