0

I am currently working on a webapplication which uses node.js and socket.io. Socket.io need to start a small tcp on port 843 for delivering crossdomain.xml's for FlashPlayers socket connections. As port 843 < port 1024 the node process must run as a root process, which is something I want avoid. Are there any possibilities to forward this port to another port. E.g.: Connection comes in on port 843 and is handled by a process listing to port 3000?

My first guess was to use iptables, but I am quite unfamiliar with it so I asked here for more information and a hint if I am looking in the right direction. If this could be suitable for my problem, are there any performance issues when using iptables?

TheHippo
  • 236
  • 3
  • 11

1 Answers1

1

Sure, you could use iptables to do that. Here's an example one-liner:

# iptables -t nat -A PREROUTING -i eth0 -p tcp -m tcp --dport 843 -j REDIRECT --to-ports 3000

There shouldn't be any practical performance hit since afaik that redirect is all handled in the kernel.

fission
  • 3,601
  • 2
  • 21
  • 31