OK, let's clear up some confusion here...
First up, there's no explicit requirement in your question that all of those names resolve to the same IP address -- so, you can assign a block of addresses to your router device, have the DNS records setup to provide a one-to-one mapping of name to IP address, and then use DNAT (Destination Network Address Translation) to forward the traffic on to internal devices.
I will continue on the assumption that you don't have the ability to throw a pile of IP addresses at the problem.
In general, for an arbitrary protocol running inside of TCP or UDP (because other protocols that run on top of IP don't necessarily have any concept of ports), you cannot do what you want to do, because there is no guarantee that there is any information inside the traffic "stream" to allow such routing to take place. Certain protocols, in an attempt to get around this very problem, do embed name information in their protocol (such as HTTP, with the Host
header), and for those protocols there are typically proxies that will receive a request, determine the name that was presented, and then route the request to an appropriate location. Some of those proxies have been mentioned in other answers, and if those do not suffice you will no doubt receive appropriate answers if you tell us what layer 7 protocol you are attempting to proxy.
However, the vast majority of protocols do no name-based identification of their intended destination, and for those you have no option but to use IP addresses to control the flow of traffic to different internal endpoints.
EDIT: If you're defining your own protocol, it should be possible to embed the name of the host you're connecting to inside it somewhere, and then you'll just have to write your own proxy (possibly as a plugin to some existing piece of software) to take those requests, map them to the correct backend, and pass them through.