LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   assign hostname (https://www.linuxquestions.org/questions/linux-newbie-8/assign-hostname-875058/)

ansrewdps 04-14-2011 02:28 PM

assign hostname
 
I've installed a new copy of Ubuntu 10.10.Now the big question for me is how do we assign hostname to a given ip?

I've given the hostname during the server installation and "cat hosts" says "ebox" hostname I'm trying to put on.Also,I modified the network/interfaces to static and assigned proper values.

#hostname returns ipaddr not the hostname. Also nslookup hostname/ipaddr says server can't find ....

So,is installing dns through bind and setting-up the only way to do that?

Any suggestions?

Thanks

repo 04-14-2011 02:33 PM

To which IP?
You can add in /etc/hosts
Code:

127.0.0.1        localhost
10.0.0.44        ebox

Kind regards

ansrewdps 04-14-2011 02:36 PM

I've an entry in /etc/hosts

like

127.0.0.1 localhost
127.0.1.1 ebox.mydomain.com ebox

do I replace 127.0.1.1 ebox.mydomain.com ebox with 10.0.0.44 ebox.mydomain.com ebox

Thanks

repo 04-14-2011 02:38 PM

Quote:

do I replace 10.0.0.44 ebox.mydomain.com ebox with 127.0.1.1 ebox.mydomain.com ebox
Code:

127.0.1.1 ebox.mydomain.com ebox
replace 127.0.1.1 with the ip from your server.

Kind regards

ansrewdps 04-14-2011 02:55 PM

#hostname now returns "ebox" but nslookup still says "server can't find ebox".

What could be the problem

regards

repo 04-14-2011 03:02 PM

Did you configured a DNS entry for ebox?
What do you want to achieve?
If you use
Code:

ping ebox
it should give you the correct IP

Kind regards

ansrewdps 04-14-2011 03:18 PM

to my knowledge I'm sure of the dns entries in resolv.conf


ping ebox from outside hosts says unknown host;ping ebox from localmachine gives the correct ipaddr and finally ping ipaddr reply back too

Regards


Andrew

repo 04-14-2011 03:21 PM

Quote:

ping ebox from outside hosts
Do you mean from inside your LAN?
Just add the ip and name in /etc/resolv.conf
from the outside host.
If you mean from outside the network, via the internet, you need to register your domain, and create a DNS entry.

/etc/resolv.conf is not DNS, ping etc first look in this file, if they find it, they will use it, else they will use global DNS

Kind regards

ansrewdps 04-14-2011 03:31 PM

I'm sorry but is it just "nameserver ip" (or) "ebox ip" in the other /etc/resolv.conf. And when I mean hosts,it means any terminal in the network,via the internet. Sorry if this confused you. Domain is already registered and has a DNS entry

repo 04-14-2011 03:38 PM

Quote:

I'm sorry but is it just "nameserver ip" (or) "ebox ip" in the other /etc/resolv.conf.
The same entry as in the resolv.conf on the server.
Quote:

Domain is already registered and has a DNS entry
If the domain is registered, and the dns entry is made, then your server has a public ip, right?
If not, the name will resolve to the public ip from the router.
If you want to use nslookup, you need to give the whole domainname mydomain.com
If this doesn't work, it's possible DNS isn't propagated yet.

Kind regards


All times are GMT -5. The time now is 11:46 PM.