LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 07-24-2006, 12:19 PM   #1
Bopi
LQ Newbie
 
Registered: Nov 2005
Location: Funchal , Madeira
Distribution: Debian SID
Posts: 26

Rep: Reputation: 15
Simple TCP proxy


hello

i want to redirect all traffic i got on my internet interface to some site
so , if a internet user goes to my ip port 10000 , it redirects to some irc server.

anyone knows how to do this with iptables without instaling a tcp proxy ?

i dont want to redirect nothing to my local network so i guess using PREROUTING wont work
 
Old 07-24-2006, 12:47 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
You're talking about going from Machine A to your Machine (B) to Machine C, with all 3 being on the internet? I suppose you could set up some sort of NAT rule for that, such as:
Code:
iptables -t nat -A PREROUTING -p tcp --dport 10000 -j DNAT --to-destination $SERVER:6667
iptables -t nat -A POSTROUTING -p tcp -d $SERVER --dport 6667 -j MASQUERADE
 
Old 07-24-2006, 12:52 PM   #3
Bopi
LQ Newbie
 
Registered: Nov 2005
Location: Funchal , Madeira
Distribution: Debian SID
Posts: 26

Original Poster
Rep: Reputation: 15
yes , thats what i want, but your example does not work :|
 
Old 07-24-2006, 12:57 PM   #4
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
What happens in this case?
 
Old 07-24-2006, 01:06 PM   #5
Bopi
LQ Newbie
 
Registered: Nov 2005
Location: Funchal , Madeira
Distribution: Debian SID
Posts: 26

Original Poster
Rep: Reputation: 15
ωνω BitchX: Auto Response is set to - aaa
ωνω Connecting to port 10000 of server localhost [refnum 0]
ωνω Connection closed from localhost: Success
ωνω BitchX: Servers exhausted. Restarting.
ωνω Connecting to port 10000 of server localhost [refnum 0]
ωνω Connection closed from localhost: Success
ωνω BitchX: Servers exhausted. Restarting.
ωνω Connecting to port 10000 of server localhost [refnum 0]
ωνω Connection closed from localhost: Success
ωνω BitchX: Servers exhausted. Restarting.
ωνω Connecting to port 10000 of server localhost [refnum 0]
ωνω Connection closed from localhost: Success

BitchX is a irc client ... it keeps connecting , but fails

when i telnet port 10000 i got a connection refused

so i guess it wont do nothing
 
Old 07-24-2006, 01:28 PM   #6
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
Do you have ip forwarding enabled? Are your policies set to accept?
 
Old 07-24-2006, 01:32 PM   #7
Bopi
LQ Newbie
 
Registered: Nov 2005
Location: Funchal , Madeira
Distribution: Debian SID
Posts: 26

Original Poster
Rep: Reputation: 15
yes
ip forwarding enabled
echo "1" > /proc/sys/net/ipv4/ip_forward

all policys ACCEPT
Chain FORWARD (policy ACCEPT)

did u try this example at your box ? did it work ?
 
Old 07-24-2006, 01:35 PM   #8
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
No, but my iptables rulesets are so complicated that sorting out behavior from this versus something else would be hard. Is there a reason you are averse to just using some sort of proxy or something? (i.e., a tool designed for the job)
 
Old 07-24-2006, 01:40 PM   #9
Bopi
LQ Newbie
 
Registered: Nov 2005
Location: Funchal , Madeira
Distribution: Debian SID
Posts: 26

Original Poster
Rep: Reputation: 15
no , no problem , i just wonder why i need an external program , where iptables should do the job.
if i cant use iptables , then ill use one i got.
 
Old 07-24-2006, 01:47 PM   #10
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Debian, Arch
Posts: 8,507

Rep: Reputation: 128Reputation: 128
You may want to take a look at this site: http://www.linuxforums.org/forum/lin...ptables-2.html
 
  


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
Required: unprivileged tcp proxy miggins Linux - Networking 2 06-20-2006 11:51 PM
help with a very simple CGI proxy PolishSausageof Programming 7 04-24-2006 06:49 PM
Proxy behind router... Configng TCP/IP Tizzle Linux - Networking 13 03-05-2006 09:54 AM
tcp ---I just need a simple explaination what this means--going to install mail serve xstation Linux - Networking 1 12-25-2005 03:48 PM

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

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