# hostname problem



## jocknerd (Jul 3, 2002)

i'm trying to connect to my linux box by its hostname Mulder from my iBook running OS X 10.1.5. I can connect to it by its ip address 192.168.0.100 but not by Mulder. I added the following line to /etc/hosts:

192.168.0.100     mulder

But I noticed the /etc/hosts file says that this file is used only when the system is run in single user mode. I'm supposed to modify Netinfo instead. 

Anyone got a quick guide for setting up Netinfo to user hostnames?


----------



## howardm4 (Jul 4, 2002)

perhaps the easiest way would be to 
use 'niload'.

make a mock hosts file w/ just the 
entry you want (do NOT use Textedit).

then do a:
sudo niload hosts . < name_of_mock_hosts_file


----------



## deraven (Jul 7, 2002)

This can be done pretty easily in NetInfoManager

1. Open it up.
2. Authenticate (click the little lock icon).
3. Go to / machines
4. With machines highlighted, choose "New Subdirectory" from the "Directory" menu
5. Double-click on "new_directory" across from "name" and change it to "mulder"
6. Choose "New Property" from the "Domain" menu
7. Change the property name to "ip_address" and the value to "192.168.0.100"
8. Click on "localhost" (or any other entry so it knows you're done there)
9. It'll ask you to save, then update. Say yes to both.
10. Quit NetInfoManager

Now you can put "mulder" in for the address when using "Connect to Server..." (or anywhere else, even IE) and it should take you to that IP.

-deraven


----------



## gatorparrots (Jul 12, 2002)

Neither technique works for me.
I am using it in a slightly different situation: i.e. I want my TiBook to be able to access my G4 desktop by a domain name, but adding the domain name via NetInfo on the TiBook according to the above methods did not prove to provide the desired results.

I have smtp, web, ftp, and ssh running on the G4 desktop machine and would like to be able to access them via a domain name.

This would all be inconsequential if I owned a router that allowed for loop backs (because the domain name I want to use is also a registered internet domain name), but as it stands I would like to get the hostname working for intranet access (with mail, ftp, ssh, and web clients).

Any ideas would be appreciated.


----------



## FireFly-NL (Jul 12, 2002)

doesn't work for me either.

whenever I type something like: router (webconfig for my router) edited the ip in both hosts and using netinfo it tries to connect to router.xs4all.nl (.xs4all.nl = my provider)

i have not specified a search domain or something.


----------



## deraven (Jul 12, 2002)

Try adding a:

serves     ./local

entry to the new Machines entry you made.

That shouldn't be needed, but I'm not sure why it won't work for you.

Also, G. Peretz, if there's a fully qualified domain name that's the same as what you're trying to use, that could be the problem. You might want to just create a subdomain (g4.mydomain.com, not locally on the machine, but as an actual entry in the DNS record) that points to the IP of the machine and see how that works... but if you're router doesn't do loopback, it might still end up hitting the router rather than the machine behind it.

I'll mess around with it some more here and see what I can find.


----------



## lethe (Jul 12, 2002)

i just tried it using niutil, to answer the same question in a different thread in the OSX forum:

http://www.macosx.com/forums/showthread.php?s=&threadid=19724

it didn t work for me either.  i can only assume that it doesn t work because of the lookup order?


----------



## deraven (Jul 13, 2002)

Yeah, testuser, that's what I was thinking. I didn't add the serves entry because I seemed to remember that bascially screwing things like this up.

I really don't see why it's not working for some people... I've tried my proceedure on 5 machines now and it's not been a problem on any of them.

I think I'll try messing with it some more on the machine that has a real TLD and see if that causes any problems.

Hmmm...


----------



## FireFly-NL (Jul 13, 2002)

Nope still nothing....

i added hostname: modem
and set the ip_address to 10.0.0.138

terminal:
#ping modem
PING modem.xs4all.nl (194.109.51.139): 56 data bytes

i did not ask to ping: modem.xs4all.nl. My iMac starts acting like a *** microsoft pc thinking to much on its own.


----------



## deraven (Jul 13, 2002)

That's pretty odd... I think it's even more odd that there just happens to be a "modem.xs4all.nl" that resolves.

Out of curiosity, what other entries do you have in the Machines section?


----------



## FireFly-NL (Jul 13, 2002)

it not that odd that modem.xs4all.nl resolves. Using xs4all (provider) you can set the "modem" part as you hostname.

I can change my hostname to modem2.xs4all.nl within 8 hours. And since xs4all is a rather well known provider in NL, al lot of hostnames ending with .xs4all.nl resolve.


----------



## FireFly-NL (Jul 13, 2002)

machines:
broadcasthost, modem(10.0.0.138), windows(192.168.1.3), localhost and my hostname(my ip)


----------



## davidbrit2 (Jul 13, 2002)

I noticed that testuser's example includes a kill -HUP to the lookupd process. Make sure you aren't forgetting that, otherwise lookupd might never know that you actually added an entry for a host name. Hey, sometimes problems are caused by the simplest things. Hopefully this is one of those times.


----------



## FireFly-NL (Jul 13, 2002)

nope did that over a 100 times since the ips were included in the machines list. It something with that .xs4all.nl but i can't turn it off.

It does work when I don't fill in the dns records (network setup). However doing that restults in no internet acces using hostnames.


----------



## gatorparrots (Jul 14, 2002)

> _Originally posted by testuser _
> *You should be able to reach the other computer by its hostname entry:
> ping hostname
> 
> The lookup order only makes a difference if you are trying to mask a legitimate hostname (i.e. route requests to a different machine than would be returned by a DNS server). *



Well, this must be what is happening in my situation. I am trying to access my desktop machine from my laptop and would like to have it look at the local area network first for _domain.tld_ before going out on the 'net and looking for _domain.tld_. This way, I can keep the same configuration if I am in the office or on the road with the laptop. If I am away from the local area network it should default to traditional DNS lookups on the 'net.

Is lookupd the place the make this preferential order change?

If it cannot easily be done, I think I will just try to convince the office manager to purchase a Linksys router that will allow for loopbacks. It will simplify my life tremendously. A quick word of advice: never, ever buy a Belkin router. Ever.


----------



## lethe (Jul 29, 2002)

i just noticed that there is a description of a slightly different way to accomplish this in the HOWTO forum, using niload instead of niutil.

http://www.macosx.com/forums/showthread.php?s=&threadid=10694

seems he doesn t need to change lookup order either


----------



## gatorparrots (Aug 16, 2002)

So, now that I have a router that correctly supports loopbacks, this is the correct way to reverse the lookup order change back to the original state:

sudo -s 
rm -rf /etc/lookupd 
kill -HUP `cat /var/run/lookupd.pid` 
exit


----------

