Wednesday, August 17, 2016

networking - Dynamic port forwarding based on hostname or originating ip

I'm a programmer trying to figure out some stuff beyond my domain:




Say I have one machine and clients will make tcp (but not http!) connections to it. I want to redirect clients to their own ports based on which hostname they connect to.
For example, client1 connects to client1.myserver.com and is connected to port 1234.
client2.myserver.com -> 1235, client3.myserver.com -> 1236, etc.



I want to dynamically control how ports x, for host y actually point to port z on my physical machine.



While googling this info, I see references to firewalls, proxies, reverse proxies. Which software do I actually need? Does existing software allow such changes on demand (I have heard have firewall changes requiring a day)?



If I wanted to write such a layer myself (since it may be a bit application specific), could it be done in java or node.js (I mean could it be done using higher level API or do I have to start taking apart ip packets)? How would I know which hostname the client connected to, since all host names resolve to the same machine?




I'll appreciate pointers to any reading material as well.

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...