Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    rhel 5.5 /etc/hosts file

    Hi ,
    I have not configured DNS in rhel /etc/hosts i have to rename my hostname.Say my hostname is System how do i enter that? please provide syntax. in addition to that /etc/hosts contains :1 a new line what is that really?

  2. #2
    Trusted Penguin Irithori's Avatar
    Join Date
    May 2009
    Hi and welcome

    The hostname and its dns resolution are related, but still different things.

    Look at /etc/sysconfig/network to define a HOSTNAME

    The /etc/hosts file is just a static mapping file between IPs and hostnames, mostly if a real DNS is not available or undesired and/or for localhost lookups.

    ::1 is the shortened ipv6 interface-local scope IP address.
    More or less the same as for ipv4.
    You must always face the curtain with a bow.

  3. #3
    Linux Engineer
    Join Date
    Apr 2012
    Virginia, USA
    Best / most correct way from command line is run the command
    as root.

    Then in DNS settings you can set your hostname.

  4. $spacer_open
  5. #4

    I'm unclear as to what exactly you are trying to do here. First, the hostname of the box is usually taken from /etc/HOSTNAME (SuSE) or similar or is given by the DHCP server.

    If you are playing around with /etc/hosts, I assume you are using a fixed IP address for the box in which case the entry in /etc/hosts is IP Address whitespace host name. If you want more than one host name to be resolve to that IP address, enter them all on the same line separated by whitespace.

    Finally, make sure that your /etc/nsswitch.conf contains appropriate entries.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts