[Tfug] getting IP's from host names
Paul Scott
tfug@tfug.org
Sun Sep 15 13:36:02 2002
Bowie J. Poag wrote:
>
> What you've ask is a somewhat-loaded question, in that there are several
> correct answers.
>
> Oooh boy, here we go......On Unix machines, there is a concept that goes
> under several different monickers....its called a "name service switch", a
> "dns order" or a "dns chain". Basically, its a statement that tells the
> machine how to go about resolving a hostname. Depending on the flavor of
> Unix, this is either defined in /etc/resolv.conf, /etc/nsswitch.conf or
> /etc/host.conf.... The purpose of this statement is to basically tell the
> system "Ok, for all your name resolution needs, go here first and look it
> up....If you cant resolve the hostname over there, try using this other
> method instead....If that fails as well, try this other method as a last
> resort." ...Mind you this is different from simply declaring multiple
> nameservers in /etc/resolv.conf .... A typical "order" statement would read
> something like:
>
> hosts bind nis
>
> Mind you, this "order" statement can vary wildly, depending on which flavor
> of Unix we're talking about. For example, on another box, it may look like
> the following:
>
> hosts=bind,local,yp
> aliases=local,bind,yp
> ....This tells your system that for normal hosts, go ahead and hit up DNS
> first, then look around in /etc/hosts, then try NIS (yp is deprecated. It
> stands for "yellow pages", the old name Sun used to give what we now know as
> NIS.)... Anyway, for local aliases, however, look up any domains in
> /etc/hosts first, then hit up the nameservers defined in /etc/resolv.conf,
> then as a last resort, try to resolve a hostname via NIS.
Thanks for the explanation. My /etc/host.conf is the default:
order hosts,bind
multi on
/etc/resolv.conf is:
joy:/home/paul# cat /etc/resolv.conf
search actiontec
nameserver 209.203.92.100
nameserver 66.181.240.1
The first nameserver must have been automagically added by the DHCP in
the Actiontec. I just added the 'search actiontec' line.
/etc/hosts is now since I removed the fixed IP's
127.0.0.1 (null) localhost loopback joy
192.168.0.1 actiontec
# The following lines are desirable for IPv6 capable hosts
# (added automatically by netbase upgrade)
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
> Now, if _all of that_ fails, you're still not screwed, because Unix is
> beautiful, and sacred. You must bow down to the righteous and holy authority
> that is Unix. Repent! Sit down on a Unix manual and let the lord come into
> you. Drop to your knees, sinner! Drop to your knees and realize there is no
> such thing as "cant do that" in Unix!
I've got the Unix System Administration Handbook in my hand at the moment.
> Then give me a "love gift" of $50, and
> the invisible spook you happen worship will "love" you more.
We'll talk about that when my system knows how to resolve host names. :)
> See, i'm poor, and the advice i'm about to give you would normally cost you
> twice that if it came from a consultant, ya bastard. Gimmie money. Now.
> Gimmie dat money. Bastard. Being unemployed Unix guy in Tucson is a
> redundant statement.
I'm not sure whether teaching part-time for PCC makes me poorer or not
but it might.
> Anyway, here's the last ditch way to resolve hostnames
> on a local network:
>
> If you're using a dedicated DHCP server of some sort, you can utilize that
> box for your local DNS. A nice little feature of DHCP is that it allows for
> machines to pass an optional hostname argument when they request a new DHCP
> lease. So, if all of your machines get their IP's via DHCP, and all of your
> machines have supplied the DHCP server with this optional hostname argument,
> the DHCP server effectively doubles a last-ditch DNS for local machines on
> your network.
Now we're getting close. I left the part about the Actiontec being my
DHCP server. So what do I do to get the DHCP server resolve these names?
Thanks,
Paul