LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   mapping address:port to name in hosts (https://www.linuxquestions.org/questions/linux-general-1/mapping-address-port-to-name-in-hosts-482394/)

redmeat 09-11-2006 07:57 AM

mapping address:port to name in hosts
 
Hello,

I'm trying to create human readable names for my_linux_box_ip:port using the hosts file. So, for example I would like:

127.0.0.1:2119 niceName1
127.0.0.1:2219 niceName2
127.0.0.1:2319 niceName3

I have tried using /etc/hosts and it won't allow ports.

Does anyone have ANY suggestions, linux related or not?

Many thanks

Jack

marozsas 09-11-2006 09:00 AM

There is no way to do what you are looking for.

IP addresses and port numbers are two separated things and there is no way to assign a simple name to a ip:service pair.

You can assign a simple name to a ip address in /etc/hosts. e.g. 127.0.0.1 nicename.
You can assign a simple name to a port number in /etc/services, e.g. 23 telnet.

You can even assign a web address to be redirected to a ip/port (other than the default 80) using some redirect service like the one provided by dyndns.org. e.g. www.niceName1.com -> ip1:1234 and www.niceName2.com -> ip2:5678, but it works only for http service. The default destination port 80 is implied.

redmeat 09-11-2006 10:12 AM

Thank you marozsas.


All times are GMT -5. The time now is 07:22 AM.