resolving host names to IP addresses without DNS

resolving host names to IP addresses without DNS

Post by Big Bru » Sat, 25 Jan 2003 18:38:50



I have two linux machines connected via twisted pair cable.  Neither
machine is providing DNS, i.e. running named.  If I put the IP address
of machine A in /etc/hosts.allow of machine B, I can start a telnet
session.  However, if I put the fully qualified domain name of machine
A in /etc/hosts.allow of machine B, telnet fails.  Note that
/etc/hosts on machine B has an entry for machine A.

Machine B
------------

/etc/hosts
----------
127.0.0.1 localhost
192.168.0.2 machine_b.domain.com
192.168.0.1 machine_a.domain.com

/etc/hosts.allow  machine_a can't telnet to machine_b unless the IP
address is                     explicitly given in this file
----------------
ALL: LOCAL
ALL: machine_a.domain.com
#ALL: 192.168.0.1   <--- this allows machine_a to telnet to machine_b

It is my understanding that hostnames should be getting resolved via
the /etc/hosts file in the absence of a nameserver.  This is not
happening, in my case.  Any ideas as to what I might have done wrong,
or is my mistake believing that I don't need to run a nameserver.  I
also understand that there was a precursor to DNS, whose daemon
listens on port 42 and is called, simply, nameserver.  Should I have
this running if I am not providing DNS services with named?

Thanks for your help,
Victor Weinstein

 
 
 

resolving host names to IP addresses without DNS

Post by ynotsso » Sat, 25 Jan 2003 18:50:54


[...]

Quote:> /etc/hosts
> ----------
> 127.0.0.1 localhost
> 192.168.0.2 machine_b.domain.com
> 192.168.0.1 machine_a.domain.com

[...]

You should have the hostname as well as the FQDN on the line of the host
machine, e.g for machine B:

    127.0.0.1   localhost.localdomain   localhost
    192.168.0.2 machine_b.domain.com  machine_b
    192.168.0.1 machine_a

and for machine A:

    127.0.0.1   localhost.localdomain   localhost
    192.168.0.2 machine_b
    192.168.0.1 machine_a.domain.com  machine_a

                    tony

--
use hotmail.com for any email replies

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

 
 
 

resolving host names to IP addresses without DNS

Post by Floyd Davidso » Sat, 25 Jan 2003 20:12:02




>[...]
>> /etc/hosts
>> ----------
>> 127.0.0.1 localhost
>> 192.168.0.2 machine_b.domain.com
>> 192.168.0.1 machine_a.domain.com
>[...]

>You should have the hostname as well as the FQDN on the line of the host
>machine, e.g for machine B:

>    127.0.0.1   localhost.localdomain   localhost
>    192.168.0.2 machine_b.domain.com  machine_b
>    192.168.0.1 machine_a

>and for machine A:

>    127.0.0.1   localhost.localdomain   localhost
>    192.168.0.2 machine_b
>    192.168.0.1 machine_a.domain.com  machine_a

First, putting an FQDN in for 127.0.0.1 is wrong, and has been
foisted off by RedHat as a way to correct their
misunderstanding.  For RedHat and systems copying it, that does
work but it isn't the right way to do it.  One possible solution
that I kind of like is,

    127.0.0.1 localhost
    127.0.0.2 localhost.localdomain
    ...

The problem is that you want 127.0.0.1 to resolve to "localhost"
on a reverse lookup, and you want "localhost.localdomain" to
resolve to something that is a loopback.  Since the lo device is
masked at 255.0.0.0, the above accomplishes the required results
nicely.  Other possibly correct configurations would be to use
one of the ethernet interfaces, such as "machine_a.domain.com"
instead of localhost.localdomain in appropriate places such as
the configuration of sendmail, or to install the dummy interface
module and name that interface localhost.localdomain.

As to the machine A and B, each should have the FQDN and the
hostname, hence each /etc/hosts file would look like this:

    127.0.0.1 localhost
    127.0.0.2 localhost.localdomain
    192.168.0.1 machine_a.domain.com  machine_a
    192.168.0.2 machine_b.domain.com  machine_b

--
Floyd L. Davidson         <http://www.ptialaska.net/~floyd>

 
 
 

resolving host names to IP addresses without DNS

Post by ynotsso » Sun, 26 Jan 2003 02:35:33


[...]

Quote:>     127.0.0.1 localhost
>     127.0.0.2 localhost.localdomain
>     192.168.0.1 machine_a.domain.com  machine_a
>     192.168.0.2 machine_b.domain.com  machine_b

The FQDN is only needed on the host machine. Others need
only a hostname.

--
use hotmail.com for any email replies

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 80,000 Newsgroups - 16 Different Servers! =-----

 
 
 

resolving host names to IP addresses without DNS

Post by Big Bru » Sun, 26 Jan 2003 02:57:26


Thanks for the suggested configuration of /etc/hosts.  Having the
alias, i.e. the hostname without the domain name appended, in this
file didn't help.  I checked /var/log/secure, and saw the following:

Jan 24 12:23:12 machine_a in.telnetd[715]: warning: /etc/hosts.allow,
line 29: ca
n't verify hostname: gethostbyname(machine_b.domain.com) failed
Jan 24 12:23:12 machine_a in.telnetd[715]: refused connect from
192.168.0.2

I noticed that if add the line
ALL: PARANOID (or, even in.telnetd: PARANOID ) to /etc/hosts.allow,
the connection is accepted.  I tried replacing tcpd with in.telnetd in
/etc/inetd.conf, but this didn't make any difference.  The difficulty
with converting the IP address to a hostname lies with in.telnetd.  Of
course, this could be a moot point if I had ssh running on machine_a,
but I fear that this translation failure is going to give me headaches
elsewhere, as the resolver library does not appear to be functioning
as I had hoped.  I wrote a simple C program to call gethostbyname( )
on each of { machine_a.domain.com, machine_b.domain.com, machine_a }
and these all returned successfully.

Is it possible that I don't have the required resolver library code
installed on my machines?  Could that be an install option that I
neglected to check off?  I might start blaming aliens pretty soon...

Thanks again, and also to ynotssor,
Victor




> >[...]
> >> /etc/hosts
> >> ----------
> >> 127.0.0.1 localhost
> >> 192.168.0.2 machine_b.domain.com
> >> 192.168.0.1 machine_a.domain.com
> >[...]

> >You should have the hostname as well as the FQDN on the line of the host
> >machine, e.g for machine B:

> >    127.0.0.1   localhost.localdomain   localhost
> >    192.168.0.2 machine_b.domain.com  machine_b
> >    192.168.0.1 machine_a

> >and for machine A:

> >    127.0.0.1   localhost.localdomain   localhost
> >    192.168.0.2 machine_b
> >    192.168.0.1 machine_a.domain.com  machine_a

> First, putting an FQDN in for 127.0.0.1 is wrong, and has been
> foisted off by RedHat as a way to correct their
> misunderstanding.  For RedHat and systems copying it, that does
> work but it isn't the right way to do it.  One possible solution
> that I kind of like is,

>     127.0.0.1 localhost
>     127.0.0.2 localhost.localdomain
>     ...

> The problem is that you want 127.0.0.1 to resolve to "localhost"
> on a reverse lookup, and you want "localhost.localdomain" to
> resolve to something that is a loopback.  Since the lo device is
> masked at 255.0.0.0, the above accomplishes the required results
> nicely.  Other possibly correct configurations would be to use
> one of the ethernet interfaces, such as "machine_a.domain.com"
> instead of localhost.localdomain in appropriate places such as
> the configuration of sendmail, or to install the dummy interface
> module and name that interface localhost.localdomain.

> As to the machine A and B, each should have the FQDN and the
> hostname, hence each /etc/hosts file would look like this:

>     127.0.0.1 localhost
>     127.0.0.2 localhost.localdomain
>     192.168.0.1 machine_a.domain.com  machine_a
>     192.168.0.2 machine_b.domain.com  machine_b

 
 
 

resolving host names to IP addresses without DNS

Post by Floyd Davidso » Sun, 26 Jan 2003 05:07:06




>[...]

>>     127.0.0.1 localhost
>>     127.0.0.2 localhost.localdomain
>>     192.168.0.1 machine_a.domain.com  machine_a
>>     192.168.0.2 machine_b.domain.com  machine_b

>The FQDN is only needed on the host machine. Others need
>only a hostname.

Unless of course you want to *use* the FQDN at some point on
some given machine...  which is not exactly uncommon.

--
Floyd L. Davidson         <http://www.ptialaska.net/~floyd>

 
 
 

resolving host names to IP addresses without DNS

Post by Michael Buchenriede » Sun, 26 Jan 2003 18:36:23


[Please stop top-posting.]


>Thanks for the suggested configuration of /etc/hosts.  Having the
>alias, i.e. the hostname without the domain name appended, in this
>file didn't help.  I checked /var/log/secure, and saw the following:
>Jan 24 12:23:12 machine_a in.telnetd[715]: warning: /etc/hosts.allow,
>line 29: ca
>n't verify hostname: gethostbyname(machine_b.domain.com) failed
>Jan 24 12:23:12 machine_a in.telnetd[715]: refused connect from
>192.168.0.2

[...]

Right. Putting the FQDN into /etc/hosts won't help you, as the
service (in.telnetd) called via TCP wrapper will _always_ do
a rDNS request. It is hardcoded into the application, and can't be
changed without recompilation of the telnet server, at least in my
experience.

Michael
--

          Lumber Cartel Unit #456 (TINLC) & Official Netscum
    Note: If you want me to send you email, don't munge your address.

 
 
 

resolving host names to IP addresses without DNS

Post by Big Bru » Mon, 27 Jan 2003 21:06:20



> [Please stop top-posting.]

Fair enough!

Quote:> [...]

> Right. Putting the FQDN into /etc/hosts won't help you, as the
> service (in.telnetd) called via TCP wrapper will _always_ do
> a rDNS request. It is hardcoded into the application, and can't be
> changed without recompilation of the telnet server, at least in my
> experience.

> Michael

Thanks for this piece of information.  I don't see why I should bother
fighting with the telnet server.  It sounds like you are implying that
any/all services called through tcpd are going to be tripped up if the
IP address isn't provided in hosts.allow.  For my small system, i.e. 2
machines currently, that is not a major inconvenience.

Thanks again,
Victor

 
 
 

resolving host names to IP addresses without DNS

Post by Floyd Davidso » Mon, 27 Jan 2003 23:04:09




>> [Please stop top-posting.]

>Fair enough!

>> [...]

>> Right. Putting the FQDN into /etc/hosts won't help you, as the
>> service (in.telnetd) called via TCP wrapper will _always_ do
>> a rDNS request. It is hardcoded into the application, and can't be
>> changed without recompilation of the telnet server, at least in my
>> experience.

>> Michael

>Thanks for this piece of information.  I don't see why I should bother
>fighting with the telnet server.  It sounds like you are implying that
>any/all services called through tcpd are going to be tripped up if the
>IP address isn't provided in hosts.allow.  For my small system, i.e. 2
>machines currently, that is not a major inconvenience.

Why not just delete /etc/hosts.allow entirely?  I haven't seen any
need for it myself, and nothing you've said indicates you have any
need for it either.

The suggestion to put FQDN's in /etc/hosts was not intended to be
a fix for your stated problem, but it will save you future problems
in other areas.  (E.g., if you want to nfs mount file systems.)

--
Floyd L. Davidson         <http://www.ptialaska.net/~floyd>

 
 
 

resolving host names to IP addresses without DNS

Post by David Bolto » Tue, 28 Jan 2003 00:52:23



>>Thanks for this piece of information.  I don't see why I should bother
>>fighting with the telnet server.  It sounds like you are implying that
>>any/all services called through tcpd are going to be tripped up if the
>>IP address isn't provided in hosts.allow.  For my small system, i.e. 2
>>machines currently, that is not a major inconvenience.

> Why not just delete /etc/hosts.allow entirely?  I haven't seen any
> need for it myself, and nothing you've said indicates you have any
> need for it either.

> The suggestion to put FQDN's in /etc/hosts was not intended to be
> a fix for your stated problem, but it will save you future problems
> in other areas.  (E.g., if you want to nfs mount file systems.)

I didn't notice whether the OP had the following in /etc/host.conf

        order hosts, bind

And you're right, linking two RH's together via a cross-over cable (and
assuming no other connections) should not need /etc/hosts.allow.  If he's
having troubles he should strip the variables down to the bare minimum until he
can ping between computers, then work up from there.

For both computers have just the above line in /etc/host.conf.

Then as root,
        mv /etc/hosts.allow /etc/hosts.allow.tmp

And in each /etc/hosts have only:
        localhost.localdomain localhost
        192.168.0.1
        192.168.0.2

Then see if 192.168.0.1 can 'ping 192.168.0.2', and vice versa, and then try
'telnet 192.168.0.1', ftp, etc.

David

--
Even a fool, when he holdeth his peace, is counted wise.
- Proverbs 17:28

 
 
 

resolving host names to IP addresses without DNS

Post by Michael Buchenriede » Mon, 27 Jan 2003 23:34:42


[...]

Quote:>Thanks for this piece of information.  

Pleasure ;-)

Quote:>I don't see why I should bother
>fighting with the telnet server.  It sounds like you are implying that
>any/all services called through tcpd are going to be tripped up if the
>IP address isn't provided in hosts.allow.  

At least, that was my experience. I therefor simply have always put the
corresponding entries into hosts.allow, as long as the network in question
would allow that. If it's bigger than a couple of machines, setting up
a local DNS is needed, anyway, so I never bothered recompiling in.telnetd
from scratch to circumvent that.

Michael
--

          Lumber Cartel Unit #456 (TINLC) & Official Netscum
    Note: If you want me to send you email, don't munge your address.

 
 
 

resolving host names to IP addresses without DNS

Post by Big Bru » Wed, 29 Jan 2003 05:50:22


Quote:> Why not just delete /etc/hosts.allow entirely?  I haven't seen any
> need for it myself, and nothing you've said indicates you have any
> need for it either.

Because one of the machines has a ppp link to an ISP, I am trying to
limit remote login capabilities to only local machines.  In pursuit of
this aim, I have an /etc/hosts.deny that looks like ALL:ALL, and I am
explicitly allowing access from local machines only, in
/etc/hosts.allow.  If there is a simpler means of achieving this end,
I'd be more than happy to be enlightened.

Quote:> The suggestion to put FQDN's in /etc/hosts was not intended to be
> a fix for your stated problem, but it will save you future problems
> in other areas.  (E.g., if you want to nfs mount file systems.)

Since I'm recently out of work, to keep my mind spinning I'm trying to
get as acquainted with networking as possible.  Chances are I will be
configuring an NFS server and client, so I appreciate the hint.

Thanks,
Victor

 
 
 

resolving host names to IP addresses without DNS

Post by Floyd Davidso » Wed, 29 Jan 2003 12:25:20



>> Why not just delete /etc/hosts.allow entirely?  I haven't seen any
>> need for it myself, and nothing you've said indicates you have any
>> need for it either.

>Because one of the machines has a ppp link to an ISP, I am trying to
>limit remote login capabilities to only local machines.  In pursuit of
>this aim, I have an /etc/hosts.deny that looks like ALL:ALL, and I am
>explicitly allowing access from local machines only, in
>/etc/hosts.allow.  If there is a simpler means of achieving this end,
>I'd be more than happy to be enlightened.

Use iptables to control packet forewarding on the machine with
the PPP link.

Quote:>> The suggestion to put FQDN's in /etc/hosts was not intended to be
>> a fix for your stated problem, but it will save you future problems
>> in other areas.  (E.g., if you want to nfs mount file systems.)

>Since I'm recently out of work, to keep my mind spinning I'm trying to
>get as acquainted with networking as possible.  Chances are I will be
>configuring an NFS server and client, so I appreciate the hint.

Using just the hostname to specify exports is a security risk.
So you either need the FQDN or you'd have to do it by IP address.
Besides, I can't imagine why one would _not_ want the FQDN to be
resolved... :-)

--
Floyd L. Davidson         <http://www.ptialaska.net/~floyd>

 
 
 

1. IP address resolved without NIS,DNS, etc/hosts - HOW ?

I am telnetting to a hostname
on a Solaris 8 box.

# telnet testhost

The telnet works fine but I don't understand how
the name is resolved !!

The host testhost is not in the /etc/hosts file
or the NIS hosts file. There was an /etc/resolv.conf
file previously but I have now temporarily deleted that.
I have also stopped the nscd daemon.

After all this, I can still telnet to the host testhost !!

Can someone explain what is hapenning here and how the IP
address is being resolved ?

Thanks.

2. Are there any tools/methods to capture all data on the console?

3. Name resolving from ip without DNS

4. Lacking ansi functions

5. Can't resolve DNS names, IP addresses OK

6. Recommendations[?]

7. Can't ping the host name or host IP address from host.

8. P4 HyperThreading & scheduler optimization

9. Resolving names without DNS ?

10. how to change domain name, host name, ip address

11. IP Masquerading - Can't use Host names only IP address

12. host command not resolving names to addresses anymore

13. RESOLVE Domain Names: hosts file FIRST, then DNS????