Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Go Back   Code Forums > Systems > Linux / BSD / OS X
User Name
Password

Reply
 
LinkBack Thread Tools Display Modes
Old 08-24-2006, 02:08 PM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
tunneling software?

system: redhat 7.3

this box has 2 nics. one that i can access, and one for a local network it's on.

on the local network, it's connected to another server. i need to access a program on that server on port 8080.

so, i want to hit the first box on a specific port and just forward the request to the second one on the local network. then, i obviously want the response to come back to me.

what tool can i use for this?
__________________
testing 1 2 3
sde is offline   Reply With Quote
Old 08-24-2006, 02:32 PM   #2 (permalink)
Belisarius
Java fanboy
 
Belisarius's Avatar
 
Join Date: Aug 2003
Posts: 1,114
Belisarius is on a distinguished road
While it's designed for load balancing, you might be able to use Balance. It'll act as a port-proxy.
__________________
GitS
Belisarius is offline   Reply With Quote
Old 08-24-2006, 08:58 PM   #3 (permalink)
teknomage1
Jack of all trades
 
teknomage1's Avatar
 
Join Date: Feb 2005
Location: Los Angeles
Posts: 595
teknomage1 is on a distinguished road
Send a message via AIM to teknomage1
ssh handles all your port forwarding needs. You can check out the -R and -L flags I think.
As an example, here's what I use on my laptop to use my desktop as an http and dns proxy:
ssh -L 3128:localhost:3128 -L 873:localhost:873 -L 6667:localhost:6667 user@host
__________________
Stop intellectual property from infringing on me
teknomage1 is offline   Reply With Quote
Old 08-25-2006, 05:14 AM   #4 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,680
redhead is on a distinguished road
Or simply issue a iptable command on the first box redirecting to the second box..
Something like:
Code:
> iptables -t nat -A PREROUTING -i <EXTERN_NIC> -p tcp --dport 8080 -j DNAT --to <LOCAL_SERVER>
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 08-25-2006, 07:42 AM   #5 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
thanks .. hopefully the server admin thinks this is a good idea. it will save a lot of development time.
__________________
testing 1 2 3
sde is offline   Reply With Quote
Old 08-25-2006, 10:56 AM   #6 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
i've entered that command, but when i do iptables -L, i do not see the rule.

is there anything else i need to do to enable the rule?
__________________
testing 1 2 3
sde is offline   Reply With Quote
Old 08-25-2006, 11:08 AM   #7 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,680
redhead is on a distinguished road
to view it you need to query the NAT table aswell ie:
> iptables -t nat -L PREROUTING
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 08-25-2006, 11:43 AM   #8 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,397
sde is on a distinguished road
ok i see it. shouldn't it reflect the port i specified? maybe i need to start over.

Code:
Chain PREROUTING (policy ACCEPT) target prot opt source destination DNAT tcp -- anywhere anywhere tcp dpt:webcache to: 172.17.0.49 DNAT tcp -- anywhere anywhere tcp dpt:webcache to: 172.17.0.49
__________________
testing 1 2 3
sde is offline   Reply With Quote
Old 08-25-2006, 12:00 PM   #9 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,680
redhead is on a distinguished road
Quote:
tcp dpt:webcache
Theres your port and the protocol beeing used.. If you like to see it as it's port value, you could try adding the -n switch.
Use the -v switch to see a more elaborate output, like which interface it's bound to, and how many packages the rule has captured.

By the way the dpt is shorthand for destination port, and as we all know, webcache is port 8080, so now any connection on port 8080 comming to your EXTERN_NIC will be redirected to port 8080 on the machine located at 172.17.0.49.

But repearting the rule is redundant, since the first one will capture any match befor even reaching the second one...
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to re-organized XML file and call XML file from my software bella_11041988 HTML, XML, Javascript, AJAX 10 05-16-2006 09:03 PM
Fix security at source with latest inspection software redhead Code Newbie News 0 04-05-2004 04:23 AM
When good software goes bad CaN Opener Code Newbie News 2 08-14-2003 03:16 AM
Software Engineering/Design palin Feedback 1 02-24-2003 04:01 PM


All times are GMT -8. The time now is 12:34 AM.


Powered by vBulletin Version 3.6.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2006, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting
Open Circle