Trying to setup network for server, but unsure how to edit /etc/hosts

Asked by jbowen7

I've got a home server 9.10 server ed. and I'm trying to set it up as a web server following the guide on http://www.howtoforge.com/perfect-server-ubuntu-9.10-karmic-koala-ispconfig-2-p3, but I'm stuck at editing /etc/hosts. I'm not sure how to edit this file

In it mine has:

127.0.0.1 localhost
127.0.1.1 Server.oc.cox.net Server

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

the forum suggests this:

127.0.0.1 localhost.localdomain localhost
192.168.0.100 server1.example.com server1

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

How do I go about configuring this correctly?

Thanks for your help, networking is not my specialty.

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu gnome-nettool Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Andy Hodges (ahodges) said :
#1

What do you need to do with this file?

Basically it's purpose is to translate a human friendly computer address "server1.example.com" into a computer friendly numerical address "192.168.0.100"

you put the IP of the destination first, followed by the human friendly name. 1 IP per line.

I'd expect what you're after is changing the hosts file inside another computer, so that computer can find your server?

Revision history for this message
jbowen7 (jbowen7) said :
#2

Thanks Andy,

Well I wanted to assign my new domain name to my server's ip address.
So would I add (assuming my ip address is 192.168.1.103)

192.168.1.103 www.mynewdomainname.com

or should it be:

192.168.1.103 server.mynewdomainname.com

also must I edited my
127.0.0.1 localhost
to
127.0.0.1 localhost.newdomainname.com

The only consideration here is that my home server is serving two main functions: One hard drive on it is for file sharing on my local network (backup, music, etc.) and I wanted the hostname to be "server"

But the main intention of the server is to host my own websites. This is the first time of set up a server from scratch. I've always been lucky enough to have cpanel or plesk.

Revision history for this message
actionparsnip (andrew-woodhead666) said :
#3

use:

127.0.0.1 localhost.newdomainname.com localhost

so that localhost will be resolved to 127.0.0.1 or you will get lots of issues

Can you help with this problem?

Provide an answer of your own, or ask jbowen7 for more information if necessary.

To post a message you must log in.