# This is black.(none) (Linux i686 2.4.20-gentoo-r5)

## hackerError

I am trying to set up my box as a webserver.  The (none) should be jeremybox.com (or so I think) Anyone know what I may have done wrong, I don't know what other information would be helpful.

----------

## ben

Hi,

in your /etc/hosts you probably have:

127.0.0.1 localhost

a.b.c.d black

and you should have :

127.0.0.1 localhost

127.0.0.1 black.jeremybox.com black

a.b.c.d black.jeremybox.com black

and /etc/hostname should be :

black.jeremybox.com

Beside, jeremybox.com is not taken as public domain name, so if you want your website to be seen on the internet under this name, you must register it.

Have a nice day

----------

## Zu`

 *ben wrote:*   

> 
> 
> 127.0.0.1 black.jeremybox.com black
> 
> 

 

You shouldn't need this line. In fact it's recommended not to have it.

AFAIK, 127.0.0.1 should always resolve to localhost in reverse lookups.

----------

## ben

You may well be right.

Still I do it always like this to enable talking to say black even when I don't have the net connection working (so no public or private IP address beside 127.0.0.1).

You did see that I said to put :

127.0.0.1 black.jeremy.com black IN ADDITION to

127.0.0.1 localhost 

so that ping localhost works as well as ping black, as do reverse lookup

----------

## fragbert

 *Zu` wrote:*   

> You shouldn't need this line. In fact it's recommended not to have it.
> 
> AFAIK, 127.0.0.1 should always resolve to localhost in reverse lookups.

 

Hm, but why not? What about if you use DHCP, or if the interface goes down? Not having your local hostname resolve to a loopback address will give X and some other services serious headaches.

Michael

----------

## paolo

```
# domainname your.domain
```

ByEZz,

Paolo

----------

## Zu`

Seems like I'm misunderstood.

Ok, I'll try to be more clear on this  :Wink: 

 *ben wrote:*   

> 
> 
> and you should have :
> 
> 127.0.0.1 localhost
> ...

 

My opinion on this is, that you only need

```

127.0.0.1 localhost

192.168.1.1 black.jeremybox.com black

```

or:

```

127.0.0.1 localhost.jeremybox.com localhost

192.168.1.1 black.jeremybox.com black

```

Whereas 192.168.1.1 is ofcourse just an example and could be any address that is suitable for LAN usage, see RFC1918. I assume this is the a.b.c.d you were talking about.

Ofcourse, the question is why?.

Consider black.jeremybox.com a network address that could be used on a LAN. And saying black or black.jeremybox.com is just another way to say 192.168.1.1

If other machines on the LAN are talking about black.jeremybox.com they should mean 192.168.1.1 just aswell, not 127.0.0.1 or they would be talking about themselves, so to speak.

If you respect that, and put in all the IP addresses and hostnames of the machines on your LAN, it'll make more sense. 

Then you can even copy your /etc/hosts file to all the machines on your LAN, it'll work like a charm (a better way is ofcourse running a DNS server, but that's off topic).

Ofcourse this makes more sense on a LAN than with a standalone machine (whereas you don't even need a machine/domainname), and ofcourse you're free to do whatever you like, since I don't know of any real issues, although I've read somewhere that it's not recommended to do otherwise (ofcourse I can't find that entry anywhere right now...).

----------

## fragbert

 *Zu` wrote:*   

> If other machines on the LAN are talking about black.jeremybox.com they should mean 192.168.1.1 just aswell, not 127.0.0.1 or they would be talking about themselves, so to speak.
> 
> 

 

OK, but how in the world are they going to use someone else's /etc/hosts file to resolve a name? This is a moot point...

 *Zu` wrote:*   

> If you respect that, and put in all the IP addresses and hostnames of the machines on your LAN, it'll make more sense. 
> 
> Then you can even copy your /etc/hosts file to all the machines on your LAN, it'll work like a charm

 

If you're going to replicate the same hosts file across a LAN (which is not good practice), that may be the one reason to have your hostname point directly to your non-loopback address. Still, there are many situations where this will certainly not work, which you have not addressed:

A) What if the client is using DHCP, which is very widespread? Should he have to change his /etc/hosts file every time his lease is renewed? 

B) What if, for some reason, your interface goes down? Now your hostname resolves to an address with no route to reach it, and many of your services (X, etc) are b0rked.

 *Zu` wrote:*   

> (a better way is ofcourse running a DNS server, but that's off topic).

 

Agreed... It is very easy to set up a local, non-Internet DNS though -- definitely way to go if you have the time.

Michael

----------

## Genone

Question for the OP: is this message from the webserver or from the login prompt on the console ?

----------

