Port forwarding

I have a simple requirement for port-based port forwarding / tunneling of socket-based software.

  • I have a source server and port using Sockets. This is a java program that works on both windows and linux, and it doesn't matter.
  • I have devices that continue to send data to this port. Bidirectional communication is possible.
  • I want to redirect this data to another remote server and port. Therefore, for clients, they don’t have to worry about changing the IP address whenever I move my application server.

Are there any deamon / service tools / programs that I can use to configure and execute this?

I tried SSH, but as far as I know, this requires a server with support for the SSH protocol. In my case this is not applicable. I also tried using JSch, but again this is an implementation of SSH in java format.

Can someone throw some pointers? Can iptables NAT be used on Linux?

+8
java sockets nat tunneling
source share
3 answers

You can try netcat or socat (it is more powerful than netcat)

Example for socat to forward port 80 using tcp4:

 socat tcp4-listen:80,fork tcp4:{another server}:{another port} 

and refer to http://en.wikipedia.org/wiki/Netcat#Port_Forwarding_or_Port_Mapping for netcat

Both are not Java related.

+4
source share

The code.google.com utility has a TCP / IP port forwarding utility named portforward . It is fully written in Java.

+2
source share

If you are already using xinetd on your system, it provides a simple port forwarding mechanism that can be useful not to re-launch IPTables.

If you use IPTables, Server Fault has an excellent, short question with a very close purpose . Although I find it a bit concise , more detailed documentation is available .

0
source share

All Articles