Link to home
Start Free TrialLog in
Avatar of avimal
avimal

asked on

why do we always have 127.0.0.1 as destination address for loopback interface?

I could not understand the logic behind keeping 127.0.0.1 as loopback interface. What is special about this address. Why not something else like 127.0.0.2 or 128.0.0.1.

Regards,
Vimal
ASKER CERTIFIED SOLUTION
Avatar of Teaman27
Teaman27

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Les Moore
Because that is the standard specified in the RFC 3330.
http://www.faqs.org/rfcs/rfc3330.html
" 127.0.0.0/8 - This block is assigned for use as the Internet host
   loopback address.  A datagram sent by a higher level protocol to an
   address anywhere within this block should loop back inside the host.
   This is ordinarily implemented using only 127.0.0.1/32 for loopback,
   but no addresses within this block should ever appear on any network
   anywhere [RFC1700, page 5]."


The significance is in the bit pattern.


Avatar of Ned_LeB
Ned_LeB

There is nothing special about it.  This number could easely have been any other IP number.  It's just a convention that was accepted years ago.

Ned
Like lrmoore said "The significance is in the bit pattern."

You'll notice that in binary, a 127 is "01111111".  It could have been anything, but this is pretty recognizable so my assumption has always been that this is why it is used.  If you look at the network classfully, it is still within the class A range, so the 127.0.0.1 is the first address in the range.  Pretty noticable again.  Beyond that, who knows?  You'd probably have to do some serious reading of the RFC's to find the logic behind it.
It's not just 127.0.0.1 but the whole range of 127.0.0.1 thru 127.255.255.254.  There sure are a lot of wasted IPs there.

Paka
Like lrmoore says, it's the standard.  If you want to know why we *still* do it this way, then the answer (aside from the above), is that many software vendors have incorporated this standard into their software as though it were written in stone - change the standard (or even what address you want to call "localhost"), and their products fall apart.  Ever see that warning about not changing the top line in /etc/hosts on a unix system (the line that contains localhost?).  Ever ignore that advice?  Not instantly noticeable, but painful in the end.

Cheers,
-Jon

On the flip side, ever see the results of someone adding a loopback virtural interface on a Cisco router and addressing it with 127.0.0.1? Bad things happen to traceroutes....
Hehe - Indeed...

Cheers,
-Jon
Avatar of avimal

ASKER

As scraig84 and lrmoore referred, I need to get in details of RFCs to understand the logic behind this. For the time being I got the basic understanding that all networking s/w is written with hardcoded 127.0.0.1 as localhost. I will update you later if I get anything interesting in RFCs about it.
>I got the basic understanding that all networking s/w is >written with hardcoded 127.0.0.1 as localhost.

I wouldn't even say all (I write networking software all the time that doesn't need to know about localhost), but enough so that it's a bad idea to change it.

Cheers,
-Jon
Doesnot it look like there is  mathematics involved.127 looks like a magic number 01111111 and it certainly has something to do with the selection of this  network for loopback.Technically speaking ,we r bridging RX and the TX ,hence what we send is what we receive.Does this mechanism has somwething to do with 127 .