zoukankan      html  css  js  c++  java
  • 配置主机名和名称解析

    1、查看当前主机名

        1.1 显示当前主机名 

             $ hostname

        1.2 显示主机名状态

             $ hostnamectl status

    2、设置静态主机名

        2.1 更改主机名和主机名配置文件

             $ sudo hostnamectl set-hostname server0.example.com

        2.2 查看网络启动时提供主机名的配置文件

           $ cat /etc/hostname

       2.3 显示主机名状态

           $ hostnamectl status

    3、 临时更改主机名

       3.1更改主机名

            $ sudo hostname testname

       3.2 显示当前主机名状态

            $ hostnamecatl status

            显示当前主机名

            $ hostname

      3.3 查看网络启动时提供主机名的配置文件

           $ cat /ect/hostname

      3.4 重启系统

           $ reboot

      3.5 显示当前主机名

          $ hostname

    4、为服务器增加一个本地别名

        4.1 查询classroom.example.com的IP

           $ host classrom.example.com

       4.2 修改/etc/hosts使class具有IP172.25.254.254,并用于与classroom.example.com通信

           $ sudo vim /etc/hosts

           $ cat /etc/hosts

       4.3 查找class的IP

          $ host class

       4.4 ping class

          $ ping -c3 class

    快速配置主机名和IP的命令是: nmtui, 这个命令是交互式的,配主机名是永久生效的,IP是可选动态和静态。配置好后要reboot.  记忆方法:nmtui 尼妈腿

  • 相关阅读:
    WebStorm 2017.1.2 汉化破解
    gulp实时刷新页面
    图片转base64
    swiper使用案例一
    js生成GUID
    css实现0.5像素
    mac上搭建appium+IOS自动化测试环境(二)
    6. 使用antd pro构建web页面
    5. 使用Flask蓝图(blueprint)
    4. 为HelloWorld添加日志
  • 原文地址:https://www.cnblogs.com/zhg1016/p/5508838.html
Copyright © 2011-2022 走看看