connecting to localhost while off line

Derek Broughton news at pointerstop.ca
Sat Aug 2 20:25:16 UTC 2008


dave selby wrote:

> I cannot get access to my localhost when I am off line. Googleing
> https://answers.launchpad.net/ubuntu/+question/36754
> you have to amend /etc/hosts which I have done (my system name is
> dev-system) but this has still not resolved my problem.

Arg.  My biggest and longest standing complaint about Kubuntu, but I didn't
think it applied to ubuntu, in that it's usually only an issue with
Konqueror.  Konqueror has some $%^&*( annoying interaction with avahi which
basically argues that you can't possibly have running servers if you don't
have a network.

So I have to wonder what exactly it is that you can't access.  What _ports_? 
Have you tried accessing those ports via telnet?

> my /etc/hosts file is now ...
> 
> 127.0.0.1 localhost.localdomain localhost dev-system
> 127.0.0.1 localhost dev-system
> 127.0.0.1       localhost
> 127.0.1.1       dev-system

There's a lot of redundancy there.  You really shouldn't have three lines
for localhost, and you can't give "dev-system" two different IPs (well,
obviously you _did_, but only one will resolve) .

I'd delete "dev-system" from the first line, remove the second and third (of
the lines that actually have contents), and keep the fourth. 
Putting "dev-system" on a different IP from 127.0.0.1 is just a matter of
preference.

Mine looks like:
$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 bella.pointerstop.ca bella
127.0.2.1 nagisa.pointerstop.ca nagisa
127.0.2.2 plonevdc.pointerstop.ca plonevdc
127.0.2.3 nagisa2.pointerstop.ca nagisa2
...

Where "bella" is my machine's real name (depending which network I'm
connected to, my external name will be "bella.pointerstop.ca"
or "bella.some-other-domain"); nagisa, plonevdc, and nagisa2 are projects
I'm working on, and I like them to resolve to different addresses for my
apache development server to be able to treat them as virtual hosts.
-- 
derek





More information about the ubuntu-users mailing list