telnet on local LAN question

Tim ignored_mailbox at yahoo.com.au
Tue Aug 16 14:43:04 UTC 2011


On Mon, 2011-08-15 at 22:04 -0700, Paul Allen Newell wrote:
> Each machine has a /etc/hosts looking like (where <name> is the machine 
> name and <other> is any other machine:
> +++
> 127.0.0.1 <name>    localhost.localdomain    localhost <name>.localdomain    localhost4
> ::1 <name>    localhost6.localdomain6    localhost6 <name>.localdomain
> 
> 192.168.2.10 <other1>.localdomain <other1>
> 192.168.2.11 <other2>.localdomain <other2>
> 192.168.2.12 <other3>.localdomain <other3>
> +++
> 
> For the other machines, its name is removed in the 192.168.10.x list and 
> 192.168.2.13 <name>.localdomain <name> is added

That's a rather complex explanation, which sounds like you're giving
each machine a unique hosts file, where their own hostnames are written
differently than the other machines on the LAN.  I wouldn't do that.

Or that you've got two different subnets on the same LAN (192.168.10 and
192.168.2), and you're trying to talk between them.  Again, I wouldn't
do that, unless I had to.  You've either got to have a gateway between
them, at the boundary between the two networks (and all the computers
have to be configured to appropriately use the gateway).  Or, if they
actually are all on the same LAN, you'd set the netmask to be
255.255.0.0 instead of 255.255.255.0 (so they don't try to reach the
other subnet through a gateway).  

Presume that I have about four machines, I've called them fred, george,
martha, and dave.  They'll all have the same hosts file on them, like
this.

127.0.0.1   localhost.localdomain    localhost
::1         localhost6.localdomain6  localhost6

192.168.1.1  fred.localdomain    fred
192.168.1.2  george.localdomain  george
192.168.1.3  martha.localdomain  martha
192.168.1.4  dave.localdomain    dave

None of them will have any part of their hostnames inserted into the
local loopback lines.  That /can/ cause problems with reverse look-ups,
when you want the looked-up IP of a hostname to actually be their IP on
the LAN, not the loopback address (which is identical on each machine).

It gets messier if a box has two addresses (whether or not it has two
network interfaces.  In that situation, I don't try associating the same
hostname with two different addresses, it causes problems.  I'll have a
variation for the second address.

e.g. 192.168.1.1 fred.localdomain fred
     192.168.2.1 fred-two.localdomain fred-two


Do you really have:

> NTPSERVERARGS=iburst

In the /etc/sysconfig/network file?

> I didn't see any reference to <name> or <otherX> in 
> /etc/sysconfig/network-scripts/ifcfg-eth0, so I am not including it ... 
> if there should be something, I'd love to know! I can't think of any 
> other place for <otherX> or <otherX>.localdomain, but that's out of 
> ignorance as I haven't encountered this sort of problem before.

You don't need to put hostnames into specific interface configuration
files.  The computer *works* *out* its host name from its IP.

i.e. From the computer's point of view, it's told I'm 192.168.1.2 (by
any of several means of configuring an IP).  I do a reverse look-up of
that IP, and find out that it's george.localdomain.  I do a forward
look-up of george.localdomain and find out I'm 192.168.1.2 (I could have
more than one, and if it's different, I cycle through looking forward
and back).  I work out that my hostname is george, and my domain name is
localdomain (there's a configuration option of how many dots in a name,
to handle multiple dots in fully-qualified domain names, to work out the
separation between hostname and domain name).

The point being that name resolution of what name is associated with
what IP, tells me what the hostname is (whether by hosts file, DNS
look-ups, or some other method).  Rather than hardcoding I am george,
into some configuration file.  Although that is also possible.

> Ping works great between all of the machines for both <otherX> and 
> <otherX>.localdomain, lists the 192.168.10.x address like a happy camper 
> should
> 
> But a telnet <otherX> 25 or telnet <otherX>.localdomain 25 fails.

The default configuration for a mail server has it only listening to the
local loopback addresses, it needs customising to accept connections
from another machine.  And may need customising for the domain names
that you are using.  And, you may have fun with mail is you don't use a
DNS server, since hosts files can't answer MX queries.  Mailservers will
also do the IP/name look-up game that I've already detailed.

> I also can't use mail/mailx between the machines. I noticed that 
> mail/mailx always resolves <otherX> to <otherX>.localdomain (and sending 
> to self is resolved to <name>.localdomain), so I changed network to use 
> the localdomain suffix and added it in /etc/hosts before the instance of 
> <other>. Neither telnet or mail/mailx worked with just <name>, so I am 
> pretty certain that I didn't break anything by changing <name> to 
> <name>.localdomain.

You might want to expand upon *why* you're wanting to use different
FQDNs for machines.  That may point out where the snag is.

As I outlined, above, how a machine works out its address.  When it
comes to multiple addresses, the sequence will determine which out of
many it may make use of.

e.g. I'm 192.168.1.1.  If there are two different names attached to that
IP, the first answer is the answer.  If I do a look-up for that name and
a different IP is the answer, the cycle is repeated to find the name for
that IP.

This gets fun with DNS records and CNAMES that point to other CNAMES
(i.e. aliases, to describe CNAMES in another way).

> Some machines were already using hostname of <name>.localdomain and my 
> records aren't good enough to know how I specified the name of the 
> machine when I installed F14 (it never was an issue as everything worked 
> until I tested mail/mailx and telnet so I never documented exactly how I 
> should set machine name on install).
> 
> It seems that the telnet problem is a simpler one than the mail/mailx 
> and if I can at least get telnet working, then I am closer to getting 
> mail/mailx working.

It does sound like IP and name resolution is your prime problem.

For anything more than about three machines I prefer using DNS than
hosts files.  It gets a pain having to synchronise changes across
several computers, particularly if you experiment and change names and
IPs around.

Years ago I did mess around with the notion of each machine being its
own mail server, and being able to directly mail between machines.  But
it was more painful than setting up one machine as the server for all,
and less practical.

-- 
[tim at localhost ~]$ uname -r
2.6.27.25-78.2.56.fc9.i686

Don't send private replies to my address, the mailbox is ignored.  I
read messages from the public lists.





More information about the users mailing list