zoukankan      html  css  js  c++  java
  • Hostname

     Main part from: http://www.cpqlinux.com/hostname.html

    Checking your Linux host name

    First, see if your host name is set correclty using the following commands:
    uname -n
    hostname -a
    hostname -s
    hostname -d
    hostname -f
    hostname
    If the above commands return correctly with no errors then all may be well; however, you may want to read on to verify that all settings are correct.
    --------------------------------------------------------------------------------------------------------------------------------

    Configuring /etc/hosts

    If your IP address is assigned to you by a DHCP server, then /etc/hosts is configured as follows:
    127.0.0.1	mybox.mydomain.com	localhost.localdomain localhost mybox
    If you have a static IP address, then /etc/hosts is configured as follows:
    127.0.0.1	localhost.localdomain localhost
    192.168.0.10 mybox.mydomain.com mybox
    ------------------------------------------------------------------------

    Setting the Host Name using "hostname"

    After updating the /etc/hosts file correctly, the "hostname" command should be run as follows to set your hostname:

    hostname mybox.mydomain.com
    -------------------------------------------------------------------------------------------------------------------------------

    Checking /etc/HOSTNAME (if present)

    You may or may not have the file /etc/HOSTNAME:
    mybox.mydomain.com
    -------------------------------------------------------------------------

    Checking /proc/sys/kernel/hostname

    This is checked with the following command: cat /proc/sys/kernel/hostname If you need to set this file, you can either reboot or set it now with the following command:

    echo mybox.mydomain.com > /proc/sys/kernel/hostname
    ------------------------------------------------------------------------------------------------------------------------------
    It is not reliable to use X tool for my experience.

    What is relationship in these files? I will discover in the future.
  • 相关阅读:
    vim黏贴代码格式混乱的解决方法
    fopen()和fclose()的用法
    简谈switch case
    【转】如何确定Kafka的分区数、key和consumer线程数
    【转】Kafka producer原理 (Scala版同步producer)
    【转】 使用maven创建web项目
    【转】使用Eclipse构建Maven项目 (step-by-step)
    eclipse的安装环境及eclipse下maven的配置安装
    strtol,strtoll,strtoul, strtoull字符串转化成数字
    Kafka Producer相关代码分析【转】
  • 原文地址:https://www.cnblogs.com/ainima/p/6331473.html
Copyright © 2011-2022 走看看