/etc/hosts: Can I bind my dynamic DNS hostname to 127.0.0.1/localhost?

michaelsanford

Translator, Web Developer
I use a dynamic DNS client (no-ip.com).

Is it possible to add a line to /etc/hosts like:
Code:
127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 
[b]amras.no-ip.com localhost[/b]

The idea behind this is to prevent an outgoing WAN connection if I enter my no-ip.com aliased hostname locally (web browser, terminal, etc) to save speed and bandwidth.

I know I can just substitute 127.0.0.1/localhost in most instances, but that requires updating (or keeping multiple copies of) some scripts that use absolute hostnames.

I'm only asking because I could try this, but not notice any difference, so I might not know if it's actually doing anything :p
 
Close don't add it as a new entry but as an alias on the original like this
Code:
127.0.0.1       localhost amras.no-ip.com
You can also add it as a new independent entry like this
Code:
127.0.0.1       amras.no-ip.com

Either one should work if your mac is doing its name resolution in the right order.

-Eric
 
You should not have to do anything, But I could be wrong so if it doesn't work the would reboot will fix it though I am loathe to do that.

-Eric
 
I just played with it and I noticed a dramatic speed increase on FTP connection, directory listing, etc; so it seems to be working after all without reloading anything.
 
You can also add this in with NetInfo, then Cocoa apps would benefit too. I did it.

Open up Netinfo Manager, authenticate yourself, go to machines -> localhost

Click on the name property, choose Insert Value from the Directory Menu, and add in amras.no-ip.com.

Then go and click on broadcasthost. That's just so NetInfo Manager asks if you want to save & update. (I suppose you can do command-s as well :D)

Then go up to the Management menu and choose Restart Local Netinfo Domains. That'll put it into effect.
 
Or (riffing on that other thread), you could use amras.no-ip.local. and not have to modify any configs at all...
 
Back
Top