Results 1 to 5 of 5

Thread: Hostname from DNS

  1. #1

    Thread Starter
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423

    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.

  2. #2
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403

    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.

  3. #3

    Thread Starter
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423

    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.

  4. #4

    Thread Starter
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423

    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.

  5. #5
    Hyperactive Member CyberSurfer's Avatar
    Join Date
    Aug 2000
    Location
    Old London Town
    Posts
    425

    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

    Code:
    vi /etc/host.conf
    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).

    Code:
    order hosts,bind
    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
  •  



Click Here to Expand Forum to Full Width