LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 10-09-2004, 04:15 AM   #1
shoaib
LQ Newbie
 
Registered: Sep 2004
Posts: 5

Rep: Reputation: 0
port mapping


Hi , i have question how i can map one port to another in linux.

Like i have a port open 9091 on linux and i wanted to make redirect all requests to port 7891 on the same linux machine.

is it possible ...
please let me know thanks.
Shoaib.
 
Old 10-09-2004, 04:59 AM   #2
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
Yeah, something like
Code:
iptables -t nat -A PREROUTING -p tcp --dport 9091 -j REDIRECT --to-port 7891
keep in mind that this is only a redirection, so clients in fact are still communicating to port 7891(though it appears to them as port 9091), if you block access to port 7891 things won't work.
 
Old 10-09-2004, 06:31 AM   #3
shoaib
LQ Newbie
 
Registered: Sep 2004
Posts: 5

Original Poster
Rep: Reputation: 0
some thing wrong happened

I did this command like this

iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 10000 -j REDIRECT --to-port 7860

it worked fine but when i try to get the list of iptalbes it is showing nothing and the worst part is that i cant remove this rule .
I tried to flush it and delete it but no effect. it is redirecting from 10000 to 7860 still. ...

Is it a bug or iam doing some thing wrong....................................


 
Old 10-09-2004, 07:40 AM   #4
shoaib
LQ Newbie
 
Registered: Sep 2004
Posts: 5

Original Poster
Rep: Reputation: 0
I tried every thing ... i dont know what i am missing. The listing of iptables displays empty tables but the rule is working fine.
cant remove it thats the big problem. is it a bug or what..
 
Old 10-09-2004, 01:51 PM   #5
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
The "nat" table is a built-in table which doesn't show if you just do iptables -L.

to show it:
iptables -t nat -L

to flush it:
iptables -t nat -F
 
  


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
ADSL port mapping 25 110 madunix Linux - Networking 0 03-10-2004 02:58 AM
Port Forwarding/Mapping jmosher Linux - General 0 07-15-2003 09:52 AM
IPTables - again (port mapping) davebarnes Linux - Security 2 09-23-2002 07:48 AM
Port mapping problem ChaosX2 Linux - Networking 6 11-25-2001 02:44 AM
Port Routing/mapping Fuigus Linux - Networking 1 09-14-2001 04:29 AM

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

All times are GMT -5. The time now is 10:16 AM.

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