読者です 読者をやめる 読者になる 読者になる

AKAI TSUKI

System development or Technical something

Network configuration with nmcli on CentOS 7

[root@localhost ~]# nmcli device
DEVICE  TYPE      STATE         CONNECTION 
enp0s3  ethernet  disconnected  --         
lo      loopback  unmanaged     --         
[root@localhost ~]# nmcli c m enp0s3 ipv4.method manual ipv4.addresses 192.168.0.30/24 ipv4.gateway 192.168.0.1 ipv4.dns 8.8.8.8
[root@localhost ~]# nmcli c m enp0s3 connection.autoconnect yes
[root@localhost ~]# nmcli c up enp0s3
[root@localhost ~]# nmcli d s
DEVICE  TYPE      STATE      CONNECTION
enp0s3  ethernet  connected  enp0s3
lo      loopback  unmanaged  --
[root@localhost ~]# nmcli c s enp0s3 |grep ipv4.addresses
ipv4.addresses:                         192.168.0.30/24
[root@localhost ~]#

and

[root@localhost ~]# hostnamectl set-hostname docker01
[root@localhost ~]# hostname
docker01
[root@localhost ~]#