Host name aliases

For system help, all hardware / software topics NOTE: use Coders Corner for all coders topics.

Moderators: Krom, Grendel

Post Reply
User avatar
Iceman
DBB Habitual Type Killer
DBB Habitual Type Killer
Posts: 4929
Joined: Thu Apr 20, 2000 2:01 am
Location: Huntsville, AL. USA
Contact:

Host name aliases

Post by Iceman »

Anyone know a way (in Linux) to setup host name aliases without knowing the IP address of the host? I know that in the /etc/hosts file I can equate any number of aliases to a given IP address but I don't know the IP of the node I want to alias.

I am using an FC2 installation and tapping onto a M$ Windows network. I know the name of the node I want to hit but it is so long that it's a pain in the @$$ to type it every time I want to FTP to it.
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

you can't get the IP of this host you want to connect to, is it one of those virtual host setups?
User avatar
Nitrofox125
DBB Admiral
DBB Admiral
Posts: 1848
Joined: Sun Jul 07, 2002 2:01 am
Location: Colorado Springs, CO, USA
Contact:

Post by Nitrofox125 »

Can you just set the 'really long name' to be the 'IP address' in the hosts file and use that? Or, set something up in ~/.login or ~/.profile (dunno which it is for your version) that sets your short name to the long name for you as a variable, kinda like path? (I don't know if that's possible, just an idea).
User avatar
Iceman
DBB Habitual Type Killer
DBB Habitual Type Killer
Posts: 4929
Joined: Thu Apr 20, 2000 2:01 am
Location: Huntsville, AL. USA
Contact:

Post by Iceman »

The IP address changes (DHCP) so I would have to look it up quite often. The name of the node is "Bart-WinXP-In-Pauls-Office@magnacom-inc.com" ... duh ... so much for using a descriptive name when I set it up. Anyhow, re-typing that name over and over again is a pain in the arse. Imagine this ...

% ping Bart-WinXP-In-Pauls-Office@magnacom-inc.com
% ftp Bart-WinXP-In-Pauls-Office@magnacom-inc.com
User avatar
CDN_Merlin
DBB_Master
DBB_Master
Posts: 9781
Joined: Thu Nov 05, 1998 12:01 pm
Location: Capital Of Canada

Post by CDN_Merlin »

You would need some type of program like 'no-ip" for windows that would translate the PC's IP to a given name. Don't know of any for Linux.
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

store it as a shell varible.
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

Well you could always run BIND on the machine, define an alias for your big long name, and configure it to refer all your other requests to the network's DNS server, but that would be a bit excessive. :P

In fact, if you have access to the DNS server that's already running on your network, why not add an alias right on that? That's a lot cleaner than storing the big long name in a shell variable.
User avatar
Iceman
DBB Habitual Type Killer
DBB Habitual Type Killer
Posts: 4929
Joined: Thu Apr 20, 2000 2:01 am
Location: Huntsville, AL. USA
Contact:

Post by Iceman »

DCrazy wrote:In fact, if you have access to the DNS server that's already running on your network, why not add an alias right on that? That's a lot cleaner than storing the big long name in a shell variable.
That's a good idea but I don't have access to the server admin account. Looks like its gonna be a shell variable.

%!/bin/csh
% setenv BART Bart-WinXP-In-Pauls-Office@magnacom-inc.com
% ping $BART
% ftp $BART

That may not be so bad ...
Post Reply