|
-
Jan 16th, 2008, 10:57 AM
#1
Thread Starter
Hyperactive Member
Hostname from DNS
By default, linux and other unix derived systems set the hostname value based on what their IP is listed as in DNS. Is it possible to disable this behavior and have hostname statically defined and to remain as this value regardless of what is in DNS?
My monkey wearing the fedora points and laughs at you.
-
Jan 16th, 2008, 01:13 PM
#2
Re: Hostname from DNS
You can set the hostname to whatever you want it to be. Either set it during the install, or:
1. use the 'hostname' command followed by the new hostname
2. change the value stored in the file /etc/hostname
You will also need to make sure to update the entry for 127.0.0.1 in /etc/hosts, or you might run into problems using some commands.
It's a pretty good idea to reboot your system after updating the hostname, too.
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Jan 16th, 2008, 01:33 PM
#3
Thread Starter
Hyperactive Member
Re: Hostname from DNS
I know that I can change it with the hostname command, but the problem is that every time I connect back to the network, it erases whatever I had set and replaces it with what is stored in DNS. I also don't have control over the DNS server and thus can't put my computer in it as the correct name.
I will try the hosts file thing and see if that helps though. Thanks for your reply.
My monkey wearing the fedora points and laughs at you.
-
Jan 23rd, 2008, 10:36 AM
#4
Thread Starter
Hyperactive Member
Re: Hostname from DNS
UPDATE: I have tried this, but for some reason, I am unable to authenticate to the wireless server when I insert the 127.0.0.1 pointing to the name I want in the hosts file.
My monkey wearing the fedora points and laughs at you.
-
Jan 23rd, 2008, 12:15 PM
#5
Hyperactive Member
Re: Hostname from DNS
You can change what order Linux looks up hostnames, ie make it look up the hosts file before DNS etc.
Open /etc/nsswitch.conf file using text editor:
Code:
vi /etc/nsswitch.conf
Look for the hosts line, ie :
Code:
hosts: files dns mdns4
Set above order as per your requirement (the example will look up the hosts file before consulting DNS). Close and save the file.
Open /etc/host.conf file
Find order line which specifies in which order host lookups are to be performed. It should be followed by one or more lookup methods, separated by commas. Valid methods are bind (dns server), hosts (/etc/hosts file), and nis (old method).
Save and close the file.
And that should do it
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|