Networking | Hardware | Software | Multimedia | System | Unix&Linux | MBA

Ê×Ò³>>Unix&Linux>>/etc/hosts?

/etc/hosts?

Stephen-I-am
12-28-2005, 02:11 PM
Is there a place I can put host names so that I don't have to type in IP addresses for scp, etc? Thanks.

Stephen

retcynnm
12-28-2005, 02:28 PM
Entries into /etc/hosts, in the expected format of:

xxx.xxx.xxx.xxx mycomputer.fqdn.com mycomputer

should do the trick for you.

edit: Of course, substitute xxx.xxx.xxx.xxx with the IP address of the server you want to connect to, and mycomputer.fqdn.com with the name of the same computer.

TrumpetPower!
12-28-2005, 02:41 PM
Um...am I missing something? What's worng with /etc/hosts itself? Works for me.

Cheers,

b&

Stephen-I-am
12-28-2005, 02:45 PM
Um...am I missing something? What's worng with /etc/hosts itself? Works for me.

Cheers,

b&
I just didn't know that it was done the same thing on macs.

Stephen

TrumpetPower!
12-28-2005, 03:45 PM
I just didn't know that it was done the same thing on macs.

Stephen

Ah. No problem.

In that case, you probably don't (yet) realize that OS X is a complete BSD Unix. Everything you already know about Unix applies--with the usual caveat that, like every OS, it has its own quirks.

And, while the manual pages aren't quite as good as what you get with OpenBSD, they're still far better than what you get with Linux. If your Unix experience is mostly Linux, you'll be pleasantly surprised to learn that ``RTFM'' actually is good, useful advice on OS X. Well, most of the time, anyway.

Cheers,

b&

giskard22
12-28-2005, 05:31 PM
If you make changes to /etc/hosts, when will they be recognized? (10.4)

trevor
12-28-2005, 06:42 PM
If you make changes to /etc/hosts, when will they be recognized? (10.4)
Immediately, as long as "FF" is in your lookup order.

In Terminal, type
lookupd -configuration

Look for the section similar to
LookupOrder: Cache NI FF DNS NIL
TimeToLive: 300
ValidateCache: NO
_config_name: Host Configuration
That "LookupOrder" is the order that hosts are looked up on your system. Cache is the cache (obviously), NI is the NetInfo database, FF is the flat file (in other words the /etc/hosts file), DNS is the external DNS server whose IP address is in /etc/resolv.conf, and NIL is what to do as a fallback when other methods have failed (more information) (http://www.stepwise.com/Articles/Technical/Lookupd.html).

Trevor

navaho
12-28-2005, 08:56 PM
If you make changes to /etc/hosts, when will they be recognized? (10.4)

You can pretty much make sure your change is recognised by doing -

lookupd -flushcache

in the console after editing /etc/hosts

hayne
12-28-2005, 10:20 PM
If you make changes to /etc/hosts, when will they be recognized? (10.4)
See the results of my quick experiments in this other thread:
http://forums.macosxhints.com/showpost.php?p=246266&postcount=4


 

TOP

Windows Server Outsell
Unix Signals And C++ E

For more info

Unix Signals And C++ E
Windows Server Outsell
ssh setup for password
Bash script does not w
esc code 
ARD send unix command 
question about binarie
Scanning mail 
Issuing multiple comma
How do I install Linux

News Archive

/etc/hosts? 
Manually Start a Start
mounting missed hard d
Using Netinfo in Singl
darwin/bsd login probl
system_profiler and fi
Send mail from script 
mounting a drive 
OS X disk first aid ha
system.log shows steal

Related stories:

Manually Start a StartUp Item
mounting missed hard drive on reboot?

Copyright@2004-2005 www.zzcoke.com All Right Reserved

link:Citenna