紅帽7之hostnamectl 實用小命令用法

2021-09-20 23:29:43 字數 3310 閱讀 3386

rhel7 很多命令和rhel6 都不一樣了,大家需要學習嘍。

先從hostnamectl 開始哈

[root@roidb02 ~]#hostnamectl

static hostname: roidb02

icon name: computer-vm

chassis: vm

machine id: c3e6a26e2e00481f928f0c38b97cf5ab

boot id: f7d681692d96485ea81b3524c7743647

virtualization: kvm

operating system: red hat enterprise linux server 7.3 (maipo)

cpe os name: cpe:/o:redhat:enterprise_linux:7.3:ga:server

kernel: linux 3.10.0-514.el7.x86_64

architecture: x86-64

[root@roidb02 ~]#hostnamectl status

static hostname: roidb02

icon name: computer-vm

chassis: vm

machine id: c3e6a26e2e00481f928f0c38b97cf5ab

boot id: f7d681692d96485ea81b3524c7743647

virtualization: kvm

operating system: red hat enterprise linux server 7.3 (maipo)

cpe os name: cpe:/o:redhat:enterprise_linux:7.3:ga:server

kernel: linux 3.10.0-514.el7.x86_64

architecture: x86-64

[root@roidb02 ~]#hostnamectl --help     幫助非常重要啊

hostnamectl [options...] command ...

query or change system hostname.

-h --help              show this help

--version           show package version

--no-ask-password   do not prompt for password

-h --host=[user@]host  operate on remote host

-m --machine=container operate on local container

--transient         only set transient hostname

--static            only set static hostname

--pretty            only set pretty hostname

commands:

status                 show current hostname settings

set-hostname name      set system hostname

set-icon-name name     set icon name for host

set-chassis name       set chassis type for host

set-deployment name    set deployment environment for host

set-location name      set location for host

[root@roidb02 ~]# cat /etc/hostname   --配置檔案

roidb02

[root@roidb02 ~]# hostnamectl set-hostname roidb01

[root@roidb02 ~]# cat /etc/hostname    --配置檔案直接生效了有沒有

roidb01

[root@roidb02 ~]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

[root@roidb02 ~]# 

[root@roidb02 ~]# 

[root@roidb02 ~]# init 6  --重啟驗證

last login: sun oct 15 07:23:33 2017 from gateway

不拉不拉省略.........

..................

[root@roidb01 ~]# 

[root@roidb01 ~]# 

[root@roidb01 ~]# 

[root@roidb01 ~]# 

[root@roidb01 ~]# 

[root@roidb01 ~]#hostnamectl

static hostname: roidb01

icon name: computer-vm

chassis: vm

machine id: c3e6a26e2e00481f928f0c38b97cf5ab

boot id: ec156edd01a84bdf8a4d8c91350a2ef2

virtualization: kvm

operating system: red hat enterprise linux server 7.3 (maipo)

cpe os name: cpe:/o:redhat:enterprise_linux:7.3:ga:server

kernel: linux 3.10.0-514.el7.x86_64

architecture: x86-64

[root@roidb01 ~]# cat /etc/hostname

roidb01

[root@roidb01 ~]# 

紅帽7 配置網絡卡

1 配置網絡卡引數 開啟真機的網路連線中可以看到vmnet1和vmnet8兩個虛擬出來的網絡卡 vmnet1就是虛擬機器網路設定中的僅主機模式,vmnet8是nat模式,區別是vmnet1是真機和虛擬機器中的linux系統互聯,虛擬機器可以與真實系統相互共享檔案,但是虛擬機器無法訪問外部網際網路,而...

紅帽5 紅帽6 紅帽7 高可用解決方案的組合程式

紅帽6 corosync 版本1 pacemaker pcs或crmsh corosync 版本1 cman pacemaker 紅帽7 corosync pacemaker pacemaker作為crm執行 pcs crmsh corosync是用於高可用環境中的提供massage layer,它...

搭建Kickstart無人值守(紅帽7)

1.安裝服務 五個服務 2.配置dhcp vim etc dhcp dhcpd.conf 多新增兩行 subnet 192.168.100.0 netmask 255.255.255.0 systemctl restart dhcpd netstat antulp grep dhcp 3.配置tft...