LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 08-10-2004, 11:50 AM   #1
silence
LQ Newbie
 
Registered: Jun 2004
Distribution: Red Hat 7.3
Posts: 11

Rep: Reputation: 0
Can traffic be forwarded to localhost?


I would like to be able to forward packets from my local lan to the localhost 127.0.0.1. There is a service running here that I can't change the listening address on. I tried an IPTABLES rule but it didn't seem to have an affect and I am thinking that it is because for security the localhost is blocked by default.
 
Old 08-10-2004, 12:19 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,816

Rep: Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724
Can you explain futher? What service?
 
Old 08-10-2004, 02:28 PM   #3
silence
LQ Newbie
 
Registered: Jun 2004
Distribution: Red Hat 7.3
Posts: 11

Original Poster
Rep: Reputation: 0
Well I was hoping there was a quick answer cause I didn't want to bother anyone with a bunch of details but........

A client SSH's into our server with a remote port forward for 5900 (VNC) Then on that computer hosting the SSH, we use VNC, connect to localhost:5900 and it forwards the port to the remote client.

I don't wanna get up and go do this computer to remote controll. I wanna do it from my puter to the ssh server and forward it that way.

The only other way I thouht of is it create the remote SSH forward to the internal adapter but that doesn't seems to work either for some reason. Then I can't even get VNC to work.

The reason we are doing all this is because for other reasons they can't forward the 5900 on their end so we can connect directly to them.
 
Old 08-10-2004, 02:42 PM   #4
futhark
Member
 
Registered: Nov 2003
Location: Montréal (Can)
Distribution: FC4
Posts: 110

Rep: Reputation: 15
Here's a small script I did to forward bit torrent from my firewall box to my personal comp. It should be easy to adapt for your own setup. Just change base_port, client_ip and external_ip accordingly.

The for loop exists because I sometimes need to open multiple ports (ex games). Say I need to open 8 ports starting to 6112 (starcraft, warcraft). The for becomes : "for p in `seq 0 7`".

base_port="6881"
client_ip="192.168.0.25"
for p in 0 ; do
let "port=$base_port + p"
iptables -t nat -A PREROUTING -p tcp -d $external_ip --dport $port -j DNAT --to-destination $client_ip
iptables -A FORWARD -p tcp -d $client_ip --dport $port -j ACCEPT
iptables -t nat -A POSTROUTING -p tcp -s $client_ip --sport $port -j SNAT --to-source $external_ip
done

Note however you should consider using a physical router if you are not comfortable with iptables and need good, immediate security. It took me a long time to learn to use iptables. Every time I reviewed my firewall I fixed flaws in it.
 
  


Reply


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
Traffic shaping (limiting outgoing bandwidth of all TCP-traffic except FTP/HTTP) ffkodd Linux - Networking 3 10-25-2008 12:09 AM
route locally generated traffic to ip:port to localhost:port maenho Linux - Software 2 03-11-2005 04:08 AM
forwarded traffic is caught by input chain kc8tbe Linux - Security 5 04-14-2004 02:14 PM
Most efficient way to tunnel all traffic to remote linux box to then be forwarded? Rims Linux - Networking 0 03-14-2004 01:49 PM
Wireless traffic stomps isdn traffic on gateway machine Radix999 Linux - Wireless Networking 0 11-14-2003 12:54 AM


All times are GMT -5. The time now is 04:51 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration