Find the answer to your Linux question:
Results 1 to 2 of 2
gethostname() returns 'karlmalone.localdomain' I need it to return karlmalone.local.tonytyson.com which is the fqdn. I can fix this by manually doing hostname karlmalone.local.tonytyson.com but it gets reset upon reboot. I believe ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    1

    gethostname() returns unexpected result


    gethostname() returns 'karlmalone.localdomain' I need it to return karlmalone.local.tonytyson.com which is the fqdn. I can fix this by manually doing hostname karlmalone.local.tonytyson.com but it gets reset upon reboot. I believe I have /etc/hosts set properly. Any idea why this occurs?

    /etc/hosts

    127.0.0.1 localhost
    192.168.1.99 karlmalone.local.tonytyson.com karlmalone


    [ttyson@karlmalone ~]$ hostname
    karlmalone
    [ttyson@karlmalone ~]$ hostname --fqdn
    karlmalone.local.tonytyson.com
    [ttyson@karlmalone ~]$ hostname -d
    local.tonytyson.com

    gethostname() returns karlmalone.localdomain

    Thanks in advance

  2. #2
    Just Joined!
    Join Date
    Nov 2007
    Location
    Camp Pendleton
    Posts
    55
    Hi,

    You need to setup a search domain in /etc/resolv.conf...

Posting Permissions

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