Find the answer to your Linux question:
Results 1 to 4 of 4
Hi , I have not configured DNS in rhel 5.5.in /etc/hosts i have to rename my hostname.Say my hostname is System how do i enter that? please provide syntax. in ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2013
    Posts
    1

    rhel 5.5 /etc/hosts file


    Hi ,
    I have not configured DNS in rhel 5.5.in /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
    Location
    Munich
    Posts
    3,380
    Hi and welcome

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

    Look at /etc/sysconfig/network to define a HOSTNAME
    https://access.redhat.com/knowledge/...config-network

    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 127.0.0.1 for ipv4.
    You must always face the curtain with a bow.

  3. #3
    Linux Engineer
    Join Date
    Apr 2012
    Location
    Virginia, USA
    Posts
    886
    Best / most correct way from command line is run the command
    system-config-network
    as root.

    Then in DNS settings you can set your hostname.

  4. #4
    Linux Newbie
    Join Date
    Nov 2009
    Posts
    222
    vivekredhat.

    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
  •