As @Andriy has stated, using IP alone, this is not possible.
When your computer connects to server1.example.com
, it is actually resolving this to an IP address, for example: 123.123.123.123
.
Once it has the IP address, it will then attempt to connect to the relevant port on host 123.123.123.123
. At this point, there is no concept of a 'hostname' or DNS.
If you want to achieve this, then you have two options:
- Differentiate the services by using different public IP addresses.
- Differentiate the services by using different ports.
You have already stated that "don't want it to be protocol specific", but (for example) if you were using HTTP(S), then this would be possible.
This is only possible because HTTP includes additional information in its headers, after connecting to the host at 123.123.123.123
it says "Please act as if I'm talking to server1.example.com
".
It is trivial to connect to 123.123.123.123
and say "Please act as if I'm talking to someotherhost.example.com
" - even if this host is not publicly advertised. Whether this request is actioned depends on your configuration.
Are you talking about HTTP(S), or plain old IP routing? – Attie – 2017-06-01T16:08:06.880
I don't want it to be protocol specific. I want to route all traffic. – Travis – 2017-06-01T16:19:08.257