Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

telnet 0 vs telnet `hostname` vs telnet 127.0.0.1

1,804 views
Skip to first unread message

Legend

unread,
Oct 5, 1999, 3:00:00 AM10/5/99
to
Hello all,

I have a question in networking

What does the command telnet 0 do? I know it will telnet to itself, but does
it go through anything? I mean gateway and anything else? How is it
different from telnet-ing to its nodename? Also What about "telnet
127.0.0.1?" All these telnet do the same thing but are they different? and
How?

Regards,


Benny Pei

Barry Margolin

unread,
Oct 6, 1999, 3:00:00 AM10/6/99
to
In article <%6xK3.627$N64....@dfw-read.news.verio.net>,

Legend <leg...@spacelab.net> wrote:
>What does the command telnet 0 do? I know it will telnet to itself, but does
>it go through anything? I mean gateway and anything else? How is it
>different from telnet-ing to its nodename? Also What about "telnet
>127.0.0.1?" All these telnet do the same thing but are they different? and
>How?

When an application uses 0.0.0.0 (the same as 0) as the address in a
connect() call, the OS looks for one of the system's actual addresses and
replaces it with that. So "telnet 0" is essentially the same as "telnet
`hostname`" if the host only has one address.

telnet 127.0.0.1 will connect to the loopback interface rather than the
systems's network interface.

The differences are very slight. For instance, if you do "telnet
127.0.0.1" and login, "who" will show that you logged in from localhost.
But if you do "telnet 0" or "telnet `hostname`" you will be shown as having
logged in from your hostname.

--
Barry Margolin, bar...@bbnplanet.com
GTE Internetworking, Powered by BBN, Burlington, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

tushar

unread,
Oct 26, 1999, 3:00:00 AM10/26/99
to
Barry,


I tried to telnet 127.0.0.1 and 0.0.0.0 and 0. All of them indicates that I am logged in from local
host. So please explain it better or leave it.


Thanks,


NOT a UNIX Guru
 

hambo...@googlemail.com

unread,
Aug 23, 2017, 10:20:25 PM8/23/17
to
On Tuesday, October 5, 1999 at 12:00:00 AM UTC-7, Legend wrote:
> Hello all,
>
> I have a question in networking
>
> What does the command telnet 0 do? I know it will telnet to itself, but does
> it go through anything? I mean gateway and anything else? How is it
> different from telnet-ing to its nodename? Also What about "telnet
> 127.0.0.1?" All these telnet do the same thing but are they different? and
> How?
>
> Regards,
>
>
> Benny Pei

Hey, I'm not Linux guru either but I remember coming by some instructions on how to change the address for telnet 0. I believe the difference between telnet 0 and 127.0.0.1 is that you can define 0 as anything you want to. The instructions are below.

Overview
With the newer versions of iDX, the telnet 0 option may not work because the “hosts” file is lacking the entry to point the “0” portion of the command back to the home address of 127.0.0.1. This issue can be resolved by editing the “hosts” file using the vi command.

Modifying the “hosts” file

1. Log in to the machine and ensure you have the root access, as indicated by the # prompt, using the correct login and password. Once at the # prompt, follow the directions below:

Type cd /etc/ and hit enter (there is a space between the cd and the /etc/).

#cd /etc/

Type vi hosts and hit enter.

#vi hosts

Note: DO NOT MODIFY THE FIRST LINE!!

2. Arrow down to the last entry and using the arrow keys, move to the end of the line. Once there, type the letter “i”, and arrow to the right one more space. Then hit the enter key and then add the following:

127.0.0.1 localhost 0

Hit the escape key.
Type :wq! and press the enter key.
:wq!
This will save the updated hosts file, and the telnet 0 function will be restored.

Lew Pitcher

unread,
Aug 24, 2017, 11:49:59 AM8/24/17
to
hambo...@googlemail.com wrote:

> On Tuesday, October 5, 1999 at 12:00:00 AM UTC-7, Legend wrote:
>> Hello all,
>>
>> I have a question in networking
>>
>> What does the command telnet 0 do? I know it will telnet to itself, but
>> does it go through anything? I mean gateway and anything else? How is it
>> different from telnet-ing to its nodename? Also What about "telnet
>> 127.0.0.1?" All these telnet do the same thing but are they different?
>> and How?
>>
>> Regards,
>>
>>
>> Benny Pei
>
> Hey, I'm not Linux guru either but I remember coming by some instructions
> on how to change the address for telnet 0. I believe the difference
> between telnet 0 and 127.0.0.1 is that you can define 0 as anything you
> want to. The instructions are below.
[snip]

First off, you replied (today, Wednesday 23 August 2017 22:20:16) to a
question posted almost 18 years ago, on Tuesday, October 5, 1999. I
sincerely doubt that the OP cares about the answer any more.

Secondly, your suggested "fix" (snipped, both for brevity and accuracy) is
incorrect; in /etc/hosts, the "hostname" part (including aliases) must begin
with an alphabetic character; 0 is not a hostname or an alias, and breaks
the format and functionality of /etc/hosts

Thirdly, "telnet 0" is a valid telnet command to connect to IPv4 address
0.0.0.0. On Unix systems, IPv4 address 0.0.0.0 is a special-case address,
reserved for "any local IP address". Telnet will, in this case, connect to
the first available /local/ IP address accessable telnet server. If the OP
has a public IP address on his system, and the loopback 127.0.0.1, and
telnet is accessable from either address, "telnet 0" will connect to one of
those two addresses. If the OP's "telnet 0" does not connect to any telnet
server, changing the /etc/hosts will not solve his problem.

--
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request

Moe Trin

unread,
Aug 24, 2017, 11:47:37 PM8/24/17
to
On Thu, 24 Aug 2017, in the Usenet newsgroup comp.unix.admin, in article
<onmsb2$qtn$1...@dont-email.me>, Lew Pitcher wrote:

>hambo...@googlemail.com wrote:

>> On Tuesday, October 5, 1999 at 12:00:00 AM UTC-7, Legend wrote:

uhuh

>>> What does the command telnet 0 do? I know it will telnet to itself,
>>> but does it go through anything? I mean gateway and anything else?
>>> How is it different from telnet-ing to its nodename? Also What about
>>> "telnet 127.0.0.1?" All these telnet do the same thing but are they
>>> different? and How?

>> Hey, I'm not Linux guru either

Actually, it's a networking question, rather than *nix

>First off, you replied (today, Wednesday 23 August 2017 22:20:16) to a
>question posted almost 18 years ago, on Tuesday, October 5, 1999. I
>sincerely doubt that the OP cares about the answer any more.

PICKY PICKY PICKY!

>the "hostname" part (including aliases) must begin with an alphabetic
>character; 0 is not a hostname or an alias, and breaks the format and
>functionality of /etc/hosts

Welll.... we'll ignore IDN for now - technically, RFC0952 was based on
ASCII characters.

>On Unix systems, IPv4 address 0.0.0.0 is a special-case address,

IPv4 address 0.0.0.0 is a special-case address - not limited to *nix

See RFC6890 section 2.2.2 (which actually refers back to RFC1122 from
1981). It means "This host on this network", and is a legal (though
restricted) source address, but it's not a legal _destination_ address.
"You can't get there from here." But the same token, 127.0.0.0/8 is
also a special address (same reference). The exact behavior of a
system is dependent on what's coded in the networking software ("the
stack") of the operating system, but 0.0.0.0/8 and 127.0.0.0/8 are most
often interpreted as meaning "me". If hambo...@googlemail.com
isn't familiar with this notation, the "/8" means all addresses in the
range "x.0.0.0" to "x.255.255.255". Try telnetting to 127.127.127.127
and see what happens. (Of course few sane systems are running telnet
rather than SSH, but hey!)

Old guy

Lew Pitcher

unread,
Aug 25, 2017, 10:35:24 AM8/25/17
to
Moe Trin wrote:

> On Thu, 24 Aug 2017, in the Usenet newsgroup comp.unix.admin, in article
> <onmsb2$qtn$1...@dont-email.me>, Lew Pitcher wrote:
>
>>hambo...@googlemail.com wrote:
>
>>> On Tuesday, October 5, 1999 at 12:00:00 AM UTC-7, Legend wrote:
>
> uhuh
>
>>>> What does the command telnet 0 do? I know it will telnet to itself,
>>>> but does it go through anything? I mean gateway and anything else?
>>>> How is it different from telnet-ing to its nodename? Also What about
>>>> "telnet 127.0.0.1?" All these telnet do the same thing but are they
>>>> different? and How?
>
>>> Hey, I'm not Linux guru either
>
> Actually, it's a networking question, rather than *nix
>
>>First off, you replied (today, Wednesday 23 August 2017 22:20:16) to a
>>question posted almost 18 years ago, on Tuesday, October 5, 1999. I
>>sincerely doubt that the OP cares about the answer any more.
>
> PICKY PICKY PICKY!

Duh

>>the "hostname" part (including aliases) must begin with an alphabetic
>>character; 0 is not a hostname or an alias, and breaks the format and
>>functionality of /etc/hosts
>
> Welll.... we'll ignore IDN for now - technically, RFC0952 was based on
> ASCII characters.

No. Here, I'm referring to the actual format of the /etc/hosts file, which
hambone318 suggested editing. Specifically, in the part that I snipped,
hambone318 suggested that the OP should add an alias to his localhost entry
in /etc/hosts, changing
127.0.0.1 localhost
to
127.0.0.1 localhost 0

thus giving the "hostname" 0 an IP address of 127.0.0.1.

I point out that this is not legal in /etc/hosts.
"Host names may contain only alphanumeric characters, minus signs
("-"), and periods ("."). They must begin with an alphabetic character
**---------------------------==============================================
and end with an alphanumeric character. Optional aliases provide for
name changes, alternate spellings, shorter hostnames, or generic hostnames
(for example, localhost)."

>>On Unix systems, IPv4 address 0.0.0.0 is a special-case address,
>
> IPv4 address 0.0.0.0 is a special-case address - not limited to *nix

Since hambone318 was talking specifically about a Unix/Linux "fix" to an 18-
year-old non-problem posted in comp.unix.admin, I decided to keep my remarks
specific to Unix/Linux. Yes, I know about the RFC; I doubt that hambone318
even knows how to spell RFC.

> See RFC6890 section 2.2.2 (which actually refers back to RFC1122 from
> 1981). It means "This host on this network", and is a legal (though
> restricted) source address, but it's not a legal _destination_ address.
> "You can't get there from here." But the same token, 127.0.0.0/8 is
> also a special address (same reference). The exact behavior of a
> system is dependent on what's coded in the networking software ("the
> stack") of the operating system, but 0.0.0.0/8 and 127.0.0.0/8 are most
> often interpreted as meaning "me". If hambo...@googlemail.com
> isn't familiar with this notation, the "/8" means all addresses in the
> range "x.0.0.0" to "x.255.255.255". Try telnetting to 127.127.127.127
> and see what happens. (Of course few sane systems are running telnet
> rather than SSH, but hey!)
>
> Old guy

--
Lew Pitcher (also an old guy ;-)

Moe Trin

unread,
Aug 25, 2017, 6:07:45 PM8/25/17
to
On Fri, 25 Aug 2017, in the Usenet newsgroup comp.unix.admin, in article
<onpcb6$uob$1...@dont-email.me>, Lew Pitcher wrote:

>Moe Trin wrote:

>> Lew Pitcher wrote:

>>> First off, you replied (today, Wednesday 23 August 2017 22:20:16) to
>>> a question posted almost 18 years ago, on Tuesday, October 5, 1999.
>>> I sincerely doubt that the OP cares about the answer any more.

>> PICKY PICKY PICKY!

>Duh

It happens when the poster is using google rather than a regular news
server. ;-} None the less, I was tempted to point the poster to the
Linux Documentation Project - specifically the Networking-Overview-HOWTO
and the NET3-4-HOWTO from that era. Hitting a search engine looking for
those two strings may help. (Hmmm... sunsite is gone, and ibiblio.org
is refusing a connection - well, tldp.org is still ok.)

The Linux Networking Overview HOWTO
Updated: Jul 2000. Overview of the networking capabilities of the
Linux Operating System; provides pointers for further information
and implementation details.

Linux Networking HOWTO
Updated: Aug 1999. Aims to describe how to install and configure
the Linux networking software and associated tools.

>>> the "hostname" part (including aliases) must begin with an
>>> alphabetic character

as it says in the hosts(5) manual page - hambone318 should try the
command 'man 5 hosts'

>> Welll.... we'll ignore IDN for now - technically, RFC0952 was based
>> on ASCII characters.

>No. Here, I'm referring to the actual format of the /etc/hosts file,

I've noticed that there isn't much material on i18n relating to host
names and domains. You and I were used to top-level domains being
limited to a half-dozen generics (.com, .edu, .gov, .org, and so-on)
and ISO-3166 country codes. IANA in their "wisdom" has dramatically
increased the name-space, as seen in http://www.iana.org/domains/root/db
which now lists

[juno ~]$ sed -n '/.aaa /,/Zimbabwe/p' < db | awk '{ print $2 }' |
sort | uniq -c | column
311 country-code 1 infrastructure
1232 generic 15 sponsored
3 generic-restricted 11 test
[juno ~]$

a few more than that. If you look near the end of that web-page, there
are over 150 top-level-domains that don't render in ASCII, much less
follow the hosts(5) man-page. i18n hostnames _usually_ use character
sets other than ASCII - see RFC3290 and RFC4290. I also know that Linux
does support non-ASCII hostnames (which wouldn't follow hosts(5)).

>Yes, I know about the RFC; I doubt that hambone318 even knows how to
>spell RFC.

He appears to have found a search-engine/data-miner, which is a start

Old guy

Lew Pitcher

unread,
Aug 25, 2017, 7:44:21 PM8/25/17
to
ITYM RFC3492 (not RFC3290).

RFC3492 references PunyCode, which is a standardized algorithm to encode
UTF8 "international" strings in 7-bit ASCII, and decode them again. It was
selected as a method to permit non-ASCII charactersets in the (already
defined as ASCII) Domain Name system. Modern programs that manipulate domain
names (such as your browser, etc) should already have the punycode transform
coded into it such that a non-ASCII domain name (as shown, for instance, in
the URL bar of the browser) is silently and invisibly translated into
Punycode ASCII for a DNS lookup.

> I also know that Linux
> does support non-ASCII hostnames (which wouldn't follow hosts(5)).
>
>>Yes, I know about the RFC; I doubt that hambone318 even knows how to
>>spell RFC.
>
> He appears to have found a search-engine/data-miner, which is a start
>
> Old guy


--
Lew Pitcher

Moe Trin

unread,
Aug 25, 2017, 11:58:10 PM8/25/17
to
On Fri, 25 Aug 2017, in the Usenet newsgroup comp.unix.admin, in article
<onqcgf$55o$1...@dont-email.me>, Lew Pitcher wrote:

>Moe Trin wrote:

>> i18n hostnames _usually_ use character sets other than ASCII - see
>> RFC3290 and RFC4290.

>ITYM RFC3492 (not RFC3290).

Actually, what I was thinking of was

3490 Internationalizing Domain Names in Applications (IDNA). P.
Faltstrom, P. Hoffman, A. Costello. March 2003. (Format: TXT=51943
bytes) (Obsoleted by RFC5890, RFC5891) (Status: PROPOSED STANDARD)
(DOI: 10.17487/RFC3490)

>RFC3492 references PunyCode, which is a standardized algorithm to encode
>UTF8 "international" strings in 7-bit ASCII, and decode them again.

I've seen a bit of that during DDOS episodes - usual mess was some id10t
banging on open DNS servers in .cn with various names. I think they're
using random-number generators to come up with the "requested" hostnames,
because most of the time, the reply is NXDOMAIN (with the b0rken DNS
server repeating the whole query back to be "helpful"). It's UDP, so
there is no "connection", and a faked request can come from anywhere.
My firewall normally simply drops unexpected "replies", but I can still
see the bandwidth being wasted.

Old guy
0 new messages