Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Give names to nameless IP addresses System
I have a number of printers at work as well as one at home that I can print to, but since none of them have nameserver entries, my list of printers is just a list of numeric IP address. Not exactly friendly. Even printer (or something else) is in the nameserver, it might not have user friendly IP address. It annoys me to no end that OS X does not let me give names to such printers, but fortunately I found a way to do this via the netinfo database.

Start up the "NetInfo Manager" application in /Applications/Utilities. Click the lock and type in your password to give yourself access. Now click "machines" (NOT "printers"!) in the list at the top of the window and then click to select "localhost" within that. Choose "Duplicate" from the Edit menu (or click the duplicate icon) to make a copy of this entry - we're going to edit it to be our printer. Make sure the copy is selected, not the original, and then in the bottom portion of the window click beside the "name" field and set its value to whatever name you want, but don't put spaces in the name. For example, I named one of mine maxwells-hp2100. Next change the ip_address field to be the address of the printer in question. Quit NetInfo Manager and save your changes when prompted.

Open Print Center and click the "Add Printer..." button. Select LPR printers using IP" from the pop-up menu. Instead of typing in the IP address for the printer, type in the name you gave that IP address in NetInfo Manager. Using the above example you would type, "maxwells-hp2100" into the IP field. Note that if you have correctly entered the name the notice reading "Incomplete or invalid address" that appears below the entry field as you type will disappear. Lastly set the type of printer from the pop up menu, click the Add button and start printing to maxwells-hp2100 instead of 123.456.789.012.
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)

Give names to nameless IP addresses | 14 comments | Create New Account
Click here to return to the 'Give names to nameless IP addresses' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
renaming localhost?
Authored by: rg200 on Jun 18, '02 05:05:50AM

I have used the first part of this hint to tell my OS X computer the names of the other machines on my network.

I would also like to change the name "localhost" to the name of my OS X machine, so that it appears instead of localhost in the terminal prompt - can I do it in the same way without breaking anything?


[ Reply to This | # ]
renaming localhost?
Authored by: serversurfer on Jun 18, '02 05:53:49AM
Edit /etc/hostconfig and change the HOSTNAME entry from -AUTOMATIC- to mybox. I think you'll need to restart afterwards.

[ Reply to This | # ]
renaming localhost?
Authored by: stephen on Jun 18, '02 10:00:42PM

Edit /etc/hostconfig and change this line:


HOSTNAME=your user name

and that's all

[ Reply to This | # ]
Useful anywhere
Authored by: serversurfer on Jun 18, '02 06:17:38AM
You can use this tip with any type of IP, not just printers. Also, you can use these "aliases" just about anywhere.

For example, add an entry for your friend's IP called mybuddy. In the Finder, choose "Go -> Connect to Server" and enter afp://mybuddy in the "Address:" field. Then try entering http://mybuddy/~myusername/ in to your favorite web browser.

Have fun!

[ Reply to This | # ]
easier to just use Print Center...
Authored by: j-beda on Jun 18, '02 10:12:11AM

Isn't it easier to just assign a queue name in Print Center?

Open Print Center and click the "Add Printer..." button. Select "LPR printers using IP" from the pop-up menu. Fill in the IP address you want. Unselect "Use Default Queue on Server" and type the name you want in that box.

This seems quite a bit easier than messing around with NetInfo stuff.

[ Reply to This | # ]
easier to just use Print Center...
Authored by: sjonke on Jun 18, '02 10:24:50AM

I have not tried changing the queue name but my understanding has been (and the word "queue" would seem to imply) that this is the name of a queue. :) If that queue does not exist I suppose it may go back to the default queue, but there may be some side effects associated with that (I don't know). Moreover, if there IS a queue with that name you might get unexpected printing results.

[ Reply to This | # ]
easier to just use Print Center...
Authored by: j-beda on Jun 19, '02 11:15:01AM

I think that the "queue name" is the name of the queue that the print centre creates, and that the default name for the queue is the name of the printer, but that you can have it named whatever you want via this box.

In any case, how likely is it that somehow your system is going to generate a printer queue name of "the printer in Fred's office" by itself?

Additionally, the Print Center Help has directions to use this dialogue to "give the printer a better name" with no cautions about naming conflicts.

[ Reply to This | # ]
easier to just use Print Center...
Authored by: mhills on Jun 19, '02 01:28:20PM

Changing the queue name seems the easiest way to approach this,
but there are reports that the queue name does have an effect
on the printing process. (I've encountered this for LPR printing
to HP postscript printers from adobe apps; there have been discussions
about this at Adobe's forums for photoshop and illustrator. The
printer is treated differently if the queue name is "BINPS")

Any ideas?

[ Reply to This | # ]
easier to just use Print Center...
Authored by: CaptCosmic on Jun 19, '02 07:04:18PM

Changing the queue name can cause printing to fail. The queue name given is the name of the print queue on the device to which you are printing. Most printers only have a single queue, and will print anything sent to them. However, Some devices maintain multiple queues.

Take, for example, the HP JetDriect printer servers. They were available in the port versions that would drive three different printers. But since they all shared the IP address of the JetDirect box, the only way to select between them was by the queue name. If you didn't have the right queue name, the JetDirect simply ignored the print job.

[ Reply to This | # ]
easier to just use Print Center...
Authored by: dashard on Jun 20, '02 01:29:58PM
In local cases you can very often simply use the queue name field to 'name' your printer. In some corporate/office settings, however, the queue name is a real thing and your print jobs need to be sent to the proper printer and the proper queue.

[ Reply to This | # ]
one host only
Authored by: wngdn on Jun 18, '02 11:06:26AM

Keep in mind that these names will only work on the machine where you enter them (unless it is a NetInfo Server for a network). This is roughly equivalent to the UNIX /etc/hosts file, which is what everyone used until the net got too big and someone invented DNS.

On a small network it's not a big deal to enter things on individual machines, but if you have more than three or so you should consider installing a DNS server.

[ Reply to This | # ]
Falling at the first fence...
Authored by: Andrew McDonald on Jun 20, '02 03:03:01AM
I'm having problems with the NetInfo step. I authenticate, select the /machines/localhost entry and then try to Duplicate it, but I get an error message which says:

NetInfo Error
NetInfo write failed! (Operation succeeded)

A permissions problem, then?
I had a look in /var/db/local.nidb to see if I could change anything by hand, but thought the better of it. I'm running Mac OS X 10.1.5, if that's anything to do with it.

[ Reply to This | # ]
Penalty at Startup
Authored by: dashard on Jun 20, '02 05:53:00PM

There seems to be a downside to this, although maybe it's just an inconvenience.

When I restarted for the first time after using this tip to add 4 'IP aliases,' the startup sequence halted at 'Starting Directory Services' for a full 2+ minutes. That's a full 120+ seconds of appearing as if there is a major problem that's been introduced by mucking around in NetInfo (and we all know that there is infinite possibility to screw things up in NetInfo). Then, after this very long pause, startup continues as normal and the system operates normally.

I verified these 'IP aliases' as the culprits by removing them and restarting. Zipped right through the startup. I decided to add them back one at a time to see if perhaps one of the entries was causing the problem, and, voila, instant delay at the directory services startup section. It wasn't any particular one, it was any and all. FWIW, the delay wasn't any longer with all four aliases added back than it was with just one. I called Apple and completely baffled the tier 2 that I spoke with (such fun). He was no help.

Can anyone else confirm this behavior?

[ Reply to This | # ]
Authored by: serversurfer on Jun 21, '02 06:22:39AM
I overlooked this omission in the original tip or I would have mentioned this before:

For the impatient:
Remove the serves property from the server aliases you create. Yup, just delete it completely. No, not just the Value, the whole Property. (Click once on the serves line and choose Delete from the Edit menu.

For the gurus-in-training:
The serves Property for a machine subdirectory tells NetInfo to contact that machine on startup and at regular intervals thereafter and query it for information to be added to the local (your) NetInfo database. (Signified by the ./local value.)

The hang is caused while the system waits for the requests to time out. (Your friends computer is unlikely to respond to such requests and if it does, your box will probably exhibit much more unusual symptoms than a startup hang.) As I said, the system automatically attempts to update this info at regular intervals. If you check your system log, you will find a task called lookupd reporting failed connections to the IPs you set up every few minutes. Do the above and all will be well. Guru Wisdom for the Patient: Dupe localhost; call it myduddy, delete serves, etc; then dupe mybuddy from then on. Saves a step.

[ Reply to This | # ]