kilowatt
mach-o mach-o man
Ok, here is what this trick will allow you to do:
instead of typing commands like:
ssh 192.168.1.136
and instead of connecting to servers like this:
http://192.168.1.142/test.shtml
all you have to do, with a properly set up hosts entree is something like this:
ssh macho
or
http://bigmac/test.shtml
A Host file, or host entry, allows for a simple hostname-to-ipaddress system to be set up. While not as versital as a custom DNS server, this is MUCH easier to use and maintain, especially if you only have a couple of hosts on your network.
Under linux and many unix's, one simply edits the file /etc/hosts and adds entries like this:
192.168.1.1 router.localdomain router
192.168.1.121 eroom.localdomain eroom
192.168.1.122 mach.localdomain mach
192.168.1.123 powerbook.localdomain powerbook
the localdomain deal is something I like to set up, so every host thinks its under a domain. If you don't use the localdomain stuff, don't bother with it.
Under linux, with this set up, any time you mention powerbook, or powerbook.localdomain, the computer at 192.168.1.123 is referenced.
However, under Mac OS X, we have something called 'NetInfo' which I believe is from Next. Its a little more complex, but it is quite effective and powerfull if used to its fullest extent.
Here is how to add host entires to the netinfo database easily.
First, open up the terminal, which is located in /Applications/Utilities. Its different from that application called the Console ('Console' monitors errors sent to the console log, at /var/log/system.log).
You will need to be root for this to work, and I recomend typing the following commands:
sudo -s
(enter YOUR password at the password prompt)
Now, lets just see if anything currently resides in netinfo's host database:
[mach4:/tmp] root# nidump hosts /
127.0.0.1 localhost mach4 mach4.localdomain localhost.localdomain
255.255.255.255 broadcasthost
255.255.255.255 -DHCP-
192.168.1.1 router router.localdomain
192.168.1.100 100.localdomain
192.168.1.101 101.localdomain
192.168.1.102 102.localdomain
192.168.1.103 103.localdomain
192.168.1.104 104.localdomain
192.168.1.105 105.localdomain
192.168.1.132 bigbox
[mach4:/tmp] root#
ok, looks like I allready have a few in there, no prob, netinfo is somewhat intelligent, and will allow you to non-destructively add to this db.
So, at this point, we need to create a hosts file.
pico /etc/hosts (return)
Now you have a new file in pico. Type what you wish to become your host file in here, use the example above if you want, leave out all the 255.255 stuff and 127.0.0.1, they should allready be there, so I personally wouldn't mess with them.
Now that you have a nice host file (use tab between ip and names, it looks nice), press control-x. you will be prompted to save the file, press 'y', and then press return.
Ok, now we have a file in /etc called hosts. Under Linux and mosts unix's, we would be finished. But we have to load it into netinfo under Mac OS X. Here's how:
niload hosts . < /etc/hosts
Wow, that was easy, wasn't it?
to check your entries, just type:
nidump hosts .
For some reason, nidump hosts / works as well.
you can also do this in the GUI, I'll post that in a bit.
For more information on nidump and niload, just issue one of these commands in a large terminal window:
man nidump
or
man niload
Press q to quit the man page viewer, and / to search for a string.
Hope this clears things up, and keep in mind that using a hosts file/entry can greatly speed up ssh and any other service that (stupidly) attempts to resolve hosts like 90.0.0.20 and other subnet-only ip addresses.
instead of typing commands like:
ssh 192.168.1.136
and instead of connecting to servers like this:
http://192.168.1.142/test.shtml
all you have to do, with a properly set up hosts entree is something like this:
ssh macho
or
http://bigmac/test.shtml
A Host file, or host entry, allows for a simple hostname-to-ipaddress system to be set up. While not as versital as a custom DNS server, this is MUCH easier to use and maintain, especially if you only have a couple of hosts on your network.
Under linux and many unix's, one simply edits the file /etc/hosts and adds entries like this:
192.168.1.1 router.localdomain router
192.168.1.121 eroom.localdomain eroom
192.168.1.122 mach.localdomain mach
192.168.1.123 powerbook.localdomain powerbook
the localdomain deal is something I like to set up, so every host thinks its under a domain. If you don't use the localdomain stuff, don't bother with it.
Under linux, with this set up, any time you mention powerbook, or powerbook.localdomain, the computer at 192.168.1.123 is referenced.
However, under Mac OS X, we have something called 'NetInfo' which I believe is from Next. Its a little more complex, but it is quite effective and powerfull if used to its fullest extent.
Here is how to add host entires to the netinfo database easily.
First, open up the terminal, which is located in /Applications/Utilities. Its different from that application called the Console ('Console' monitors errors sent to the console log, at /var/log/system.log).
You will need to be root for this to work, and I recomend typing the following commands:
sudo -s
(enter YOUR password at the password prompt)
Now, lets just see if anything currently resides in netinfo's host database:
[mach4:/tmp] root# nidump hosts /
127.0.0.1 localhost mach4 mach4.localdomain localhost.localdomain
255.255.255.255 broadcasthost
255.255.255.255 -DHCP-
192.168.1.1 router router.localdomain
192.168.1.100 100.localdomain
192.168.1.101 101.localdomain
192.168.1.102 102.localdomain
192.168.1.103 103.localdomain
192.168.1.104 104.localdomain
192.168.1.105 105.localdomain
192.168.1.132 bigbox
[mach4:/tmp] root#
ok, looks like I allready have a few in there, no prob, netinfo is somewhat intelligent, and will allow you to non-destructively add to this db.
So, at this point, we need to create a hosts file.
pico /etc/hosts (return)
Now you have a new file in pico. Type what you wish to become your host file in here, use the example above if you want, leave out all the 255.255 stuff and 127.0.0.1, they should allready be there, so I personally wouldn't mess with them.
Now that you have a nice host file (use tab between ip and names, it looks nice), press control-x. you will be prompted to save the file, press 'y', and then press return.
Ok, now we have a file in /etc called hosts. Under Linux and mosts unix's, we would be finished. But we have to load it into netinfo under Mac OS X. Here's how:
niload hosts . < /etc/hosts
Wow, that was easy, wasn't it?
to check your entries, just type:
nidump hosts .
For some reason, nidump hosts / works as well.
you can also do this in the GUI, I'll post that in a bit.
For more information on nidump and niload, just issue one of these commands in a large terminal window:
man nidump
or
man niload
Press q to quit the man page viewer, and / to search for a string.
Hope this clears things up, and keep in mind that using a hosts file/entry can greatly speed up ssh and any other service that (stupidly) attempts to resolve hosts like 90.0.0.20 and other subnet-only ip addresses.