Im a little unsure about the localhost ip address. Why is it there and what is its purpose.
short and quick question today.
Thanx
-SOIA
Printable View
Im a little unsure about the localhost ip address. Why is it there and what is its purpose.
short and quick question today.
Thanx
-SOIA
Short and quick question and a short and quick answer :).
127.0.0.1 (localhost) is the loopback address on a machine. It means a packet for that address is looped back to the same machine. It does not even come on the network. This is also one of the reserved IP addresses.
~micael
Why is it necessary to have the loopback address though????
The loopback address is used by the host to enable it to direct network traffic to itself. The purpose can be many and Im not skilled in programming and the possible use there.. But for example can I use the "loopback" adress to connect to services (ie http) in a more secure way then if I connected through the "wild wild west" known as your LAN or Internet. local services can also talk to each other the same way.
Im not that good in explaining but I will see if I can find a good piece of paper for you :).
~micael
...Plus, when trying out your webserver or whatever, wouldn't it be easier to type 127.0.0.1 instead of doing 68.blah.453.blah? It would be easier for admin's and it is used even more for ftp services, http services, etc. Like miceal said, it's hard to explain.
I am sorry soia. I can't find a really good document since there are to many of them and its a bit to wide subject, seems like your short question has a long answer :D.
If you really want to dig into this then my advice is to use a RFC search engine or do a search with google and continue from there.
~micael
Will do. ill check out some rfc's and google to try and find things. If you find anything put up a post.
-SOIA
If memory serves, the loopback address is actually part of the IP version 4 standard. In that standard certain addresses are set aside for special purposes (other examples are 224.0.0.0 for multicasting, 10.0.0.0, 192.168.0.0 as private networks, etc). I am not exactly sure if it was the original intent (i assume it was), but the loopback is used if you want to access a service from your computer but you wouldn't necessarily want anyone else to connect to the service (one of the more common examples would be the rpc daemon (at least my version of unix, X windows uses rpc queries to the daemon listening on localhost to do some calls for X, RPC meaning remote procedure call)). Another example of why maybe you would want to do this, maybe you are developing a web page that isn't fully tested or fully functional...do you really want people from the outside to access it yet? Probably not...the answer would be to bind to the loopback address..you could then test it from the server itself and you wouldn't have to worry about any external people accessing it (another user on the same server would be a different story).
Hope that helps at least set you on the right track.
/nebulus
EDIT: Force9's post also reminded me of something else that I found amusing. When Alldas.de was Dos/DDos'd off of the net, they updated the DNS records to resolve the hostname to 127.0.0.1. I hope it is obvious what would happen if someone tried to attack that address :) But that is also a reason why you might want to use the loopback.
I keep Banner ads from my browser by looping back all known banner ad web sites to 12.0.0.1
Example Win2000 Hosts file Entry
The File is huge and still growing
#=remarks
# 123Banners
127.0.0.1 123banners.com
127.0.0.1 control.123banners.com
127.0.0.1 ftp.123banners.com
127.0.0.1 ftp.control.123banners.com
127.0.0.1 www.123banners.com
# 247Media (Sabela)
127.0.0.1 247media.com
127.0.0.1 ad.connect.247media.com
127.0.0.1 adserv.247media.com
127.0.0.1 agami.247media.com
127.0.0.1 ap.www.sabela.com
127.0.0.1 au.www.sabela.com
127.0.0.1 exchange.247media.com
127.0.0.1 ftp.247media.com
127.0.0.1 FW-1250.247media.com
127.0.0.1 gw-7200-1250.247media.com
127.0.0.1 lists.247media.com
127.0.0.1 ms1.247media.com
127.0.0.1 ns.netsol.com
127.0.0.1 ns1.247media.com
127.0.0.1 ns4.247media.com
127.0.0.1 Oracle-p-app.247media.com
127.0.0.1 Oracle-p-data.247media.com
127.0.0.1 Oracle-t-app.247media.com
127.0.0.1 Oracle-t-data.247media.com
127.0.0.1 sdns.247media.com
127.0.0.1 sol.247media.com
127.0.0.1 uk.www.sabela.com
127.0.0.1 us.www.sabela.com
127.0.0.1 uzilla.247media.com
127.0.0.1 was.www.sabela.com
127.0.0.1 www.247media.com
Just out of curiosity, If I was to do that with my host file but instead of putting 127.0.0.1 and putting an IP address of a friend or something would that make all the ads go to that address? Just made me think if it would do something or no.
No, it would make your browser try to go to that IP to pull the ad. When you have those addresses resolve to the loopback, what happens is your browser sends the queries for the ad to your computer, your computer of course doesn't have them and the ads are therefore not shown on the page. The reason that works is because you have hardwired the name resolution to your computer and the only thing that would happen if you chose something other than the loopback is you would go to whatever IP you chose looking for the ads rather than your own computer (which probably wouldn't be appreciated by those IP's).
/nebulus
A slightly diffrent explanation for the loopback address (/subnet):
TCP/IP is basically just another IPC (Inter Process Communication) mechanism. This means that it allows two processes ("running programs") to exchange information between each other.
Using that point of view, there's absolutly nothing to say that two such process that want to exchange info can't be on the same machine, nor that that machine has to be connected to a network. As so, a machine not on a network most likely has no unique IP address assigned to it. So it makes sence to have an IP address that's a loopback to enable IPC communications (over TCP/IP) on the same machine.
Further more, there's acually more than one loopback address: 127.0.0.0 is acually a class A net (127.0.0.0/8 or 127.0.0.0 netmask 255.0.0.0). This gives you an almost limitless amount of IPC channels!
Ammo
A slightly diffrent explanation for the loopback address (/subnet):
TCP/IP is basically just another IPC (Inter Process Communication) mechanism. This means that it allows two processes ("running programs") to exchange information between each other.
Using that point of view, there's absolutly nothing to say that two such process that want to exchange info can't be on the same machine, nor that that machine has to be connected to a network. As so, a machine not on a network most likely has no unique IP address assigned to it. So it makes sence to have an IP address that's a loopback to enable IPC communications (over TCP/IP) on the same machine.
Further more, there's acually more than one loopback address: 127.0.0.0 is acually a class A net (127.0.0.0/8 or 127.0.0.0 netmask 255.0.0.0). This gives you an almost limitless amount of IPC channels!
Ammo
Loopback actually goes through its own "interface" - this is a virtual interface which can't talk to any other machines. It has the advantage of having a lower overhead of having to go via an ethernet or ppp interface (for example) and will work even if no other interfaces are configured.
Additionally on machines that have demand-dialling, applications can use loopback even when the dialling is down without any risk of triggering a dial-up.
Most OSs also provide other IPC mechanisms for local IPC which may be more efficient than say TCP over loopback (which still requires the IP packets to be assembled and disassembled with headers), but it's there for compatibility with apps which can also run over a real IP network.
On most OSs, sending a packet to your own (real, non-loopback) IP address won't actually cause it to go on to a physical medium (for example ethernet), but involves some processing by the various layers before it works this out. Loopback avoids this by having an interface which automatically recieves all (and only) packet it transmits.
Finally note that it's not just IP address 127.0.0.1, but 127.anything at all.
Loopback actually goes through its own "interface" - this is a virtual interface which can't talk to any other machines. It has the advantage of having a lower overhead of having to go via an ethernet or ppp interface (for example) and will work even if no other interfaces are configured.
Additionally on machines that have demand-dialling, applications can use loopback even when the dialling is down without any risk of triggering a dial-up.
Most OSs also provide other IPC mechanisms for local IPC which may be more efficient than say TCP over loopback (which still requires the IP packets to be assembled and disassembled with headers), but it's there for compatibility with apps which can also run over a real IP network.
On most OSs, sending a packet to your own (real, non-loopback) IP address won't actually cause it to go on to a physical medium (for example ethernet), but involves some processing by the various layers before it works this out. Loopback avoids this by having an interface which automatically recieves all (and only) packet it transmits.
Finally note that it's not just IP address 127.0.0.1, but 127.anything at all.
One thing I find useful is you can ping 127.0.0.1 to make sure that tcp/ip is installed correctly.
w00t 1000 post seems like just yester day I still had my newbie tag. Thanks to everyone for teaching me so much.
One thing I find useful is you can ping 127.0.0.1 to make sure that tcp/ip is installed correctly.
w00t 1000 post seems like just yester day I still had my newbie tag. Thanks to everyone for teaching me so much.