Welcome to the most active Linux Forum on the web.
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 11-23-2008, 09:38 PM   #1
LQ Newbie
Registered: Nov 2008
Posts: 1

Rep: Reputation: 0
IPTables ext access to service that only accepts localhost

I'm running IPTables and a particular service on a server and I have a wish to do something a bit odd.

I've got a service on this machine that will only accept connections if coming from the localhost. I don't want to change this at all.

What I do want is, on occasion, to be able to access this particular service from the outside on a non standard port. I've already setup the ACCEPT rule so that the connection comes in on the non standard port and terminates on the correct one, and the logs reflect that I'm getting a connection.

Is there anyway I can get the external IP address to appear to this service as though its coming from the localhost through IPTables?
Old 11-23-2008, 09:49 PM   #2
Senior Member
Registered: Jun 2008
Distribution: debian, ubuntu, sidux
Posts: 1,125
Blog Entries: 2

Rep: Reputation: 124Reputation: 124
You might be able to use a SNAT rule in iptables to re-write the source to look like its from localhost. Outside of iptables you could use a simple socat or netcat to bridge the two things. Or you could even just use SSH and do a port forward on it like ssh -L port: user@ip and then connect locally to that port and ssh will make it connect to the service from localhost.



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
Bind Iptables can't access out of localhost wspivak Linux - Server 4 03-26-2008 08:28 PM
iptables - problem whit lan access to apache and ftp service Ronin_tekorei Linux - Networking 5 01-17-2008 05:21 PM
[IPTABLES] open ext access to web server on GW server kozaki Linux - Networking 3 08-27-2005 05:11 PM
EXT 3 ... access in windoze mailavj Linux - Software 6 05-28-2005 03:14 AM
Iptables-- ext ip? Half_Elf Linux - Security 8 06-02-2002 02:51 AM > Forums > Linux Forums > Linux - Networking

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