LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   setting up my hostname (https://www.linuxquestions.org/questions/linux-newbie-8/setting-up-my-hostname-137695/)

lawkh 01-23-2004 12:37 AM

setting up my hostname
 
1). How to setup a host name? as I know a host name can be anything u make up, but what about the domain name, can I pick any domain name i want as well?
2). Do I have to associate my ip with the hostname under the HOST tab in network config? If I do, what should I put in the alias field?
3). if all of the above has been done correctly, would there be any problem accessing to my computer from a remote host by ssh? or I need to config something else?

I know these may sound stupid, but I really need someone to help me on this.

I am using redhat 7.2, thx

born4linux 01-23-2004 01:35 AM

set the hostname in /etc/hosts. if u are running a local DNS server, u can set up any domain name you want. that way, u can do 'host based' resolution within your network.

if you only do the hostname assignment via /etc/hosts, remote machines won't know it. u need to set the hostname with the corresponding IP address to other machine's hosts file.

.nyteshyft 01-23-2004 02:05 AM

Here is an example: say my hostname is "nyteshyft", and the domain name that i am associated with is called "nyteshyft.org", and that my IP address is "128.1.1.2".

Code:

edit /etc/sysconfig/network, modify the following entries:
hostname = "nyteshyft"
domainname = "nyteshyft.org"

Restart your machine. Test your hostname and domainname:
Code:

# hostname
nyteshyft

# hostname --fqdn
nyteshyft.nyteshyft.org


# dnsdomainname
nyteshyft.org

Keep all your most used host names and IP addresses in /etc/hosts
Code:

127.0.0.1          localhost.localdomain.com          localhost
128.1.1.2          nyteshyft.nyteshyft.org              nyteshyft

Configure the DNS using /etc/resolv.conf
Code:

search nyteshyft.org
nameserver 0.0.0.0

You can configure the order of the nameservers too with /etc/nsswitch.conf (everything else is unchanged)
Code:

hosts:              dns files
i hope thats all right, worked for me, my friend told me some of it though, pretty easy once you know it :)

lawkh 01-23-2004 04:22 PM

everything i clear, except the part that to configure etc/resolv.conf and etc/nsswitch.conf, what are they doing? what would be the ip of the nameserver?
In etc/nsswitch.conf, I just type in "hosts: dns files", or i have to fill in other information, can u make a concrete example?
also what does the localhost thing do, i read some web page and it says that local host is for some special use.


All times are GMT -5. The time now is 07:28 PM.