LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 04-27-2011, 07:43 AM   #1
mgai7755
Member
 
Registered: Apr 2011
Posts: 51

Rep: Reputation: 10
Question Help needed configuring iptables to locally translate some ports


Hi,

Because my ISP is blocking every IP port under 1000, I'd like my local nat'ed server to be able to translate incoming and outgoing traffic from some port above 1000 to the default server port locally.

Example :

To connect to my IMAP server (default port : 143) from the outside, I'd connect to my public IP, port 1143 (opened and nat'ed to the right server on my router) and the server would translate this port to 143 on the same machine.

I wish I could simply configure my router to do that but sadly Linksys doesn't permit such setting... I also could modify the listening port of my server but I prefear to keep the default port inside my network.

I think that iptables is the right tool to do that and I never used it and I must say that this tool is not so easy to configure at first sight.

thanks!

Matt
 
Old 04-27-2011, 07:52 AM   #2
savona
Member
 
Registered: Mar 2011
Location: Bellmawr, NJ
Distribution: Red Hat / Fedora
Posts: 215

Rep: Reputation: 66
I am not an iptables guru, but this is where I would start:


Quote:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 1143 -j REDIRECT --to-port 143
 
1 members found this post helpful.
Old 04-27-2011, 08:04 AM   #3
mgai7755
Member
 
Registered: Apr 2011
Posts: 51

Original Poster
Rep: Reputation: 10
Thumbs up

Quote:
Originally Posted by savona View Post
I am not an iptables guru, but this is where I would start:
Awesome. It took less than 5 minutes to get the first answer which is WORKING ! So nice.

I love internet :-) I love users that shares their knowledge.

thanks a million.
 
Old 04-27-2011, 08:08 AM   #4
savona
Member
 
Registered: Mar 2011
Location: Bellmawr, NJ
Distribution: Red Hat / Fedora
Posts: 215

Rep: Reputation: 66
Quote:
Originally Posted by mgai7755 View Post
Awesome. It took less than 5 minutes to get the first answer which is WORKING ! So nice.

I love internet :-) I love users that shares their knowledge.

thanks a million.
I am glad I can help, thats what this site is all about and thats why I love it. I have been helped myself plenty of times by the kind strangers here.

Mark this thread solved if you feel your have all your answers.
 
Old 04-27-2011, 08:13 AM   #5
mgai7755
Member
 
Registered: Apr 2011
Posts: 51

Original Poster
Rep: Reputation: 10
That's why I try to read and if possible answer some messages each time I ask a question...

Last detail : to be entirely complete, if you want this new rule to survive a reboot, just follow this link : http://www.debian-administration.org/articles/445

Matt
 
Old 04-27-2011, 08:20 AM   #6
savona
Member
 
Registered: Mar 2011
Location: Bellmawr, NJ
Distribution: Red Hat / Fedora
Posts: 215

Rep: Reputation: 66
Quote:
Originally Posted by mgai7755 View Post
That's why I try to read and if possible answer some messages each time I ask a question...

Last detail : to be entirely complete, if you want this new rule to survive a reboot, just follow this link : http://www.debian-administration.org/articles/445

Matt
I do not use debian, but in redhat we would use the following one of the following commands to save the firewall rules:

Code:
/etc/init.d/iptables save

or

service iptables save
Maybe someone else here who uses debian/ubuntu can pitch in and correct me if I am wrong.
 
  


Reply



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
BASH/No X: Using google translate to convert TXT files (translate) frenchn00b Programming 10 09-13-2009 10:55 PM
open ports for utorrent using iptables n close smpt to that ports shtorrent00 Linux - Networking 2 09-30-2008 03:34 PM
how? redirect apache2 outbound ports to specific ports w/iptables? nowshining Linux - Security 5 05-27-2008 02:46 AM
IPTables help needed: Can't stealth ports 0 and 1? techchiq Linux - Security 8 09-19-2004 11:24 PM
Help configuring iptables needed. Fenster Linux - Newbie 7 09-15-2004 02:26 PM

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

All times are GMT -5. The time now is 11:46 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