nmcliコマンド

nmcli コマンドのあんちょこ

バイスの状態を確認
nmcli d

バイスを有効化
nmcli c m enp0s3 connection.autoconnect yes

IPv4アドレスの指定
nmcli c m enp0s3 ipv4.address xxx.xxx.xxx.xxx/xx

ゲートウェイの設定
nmcli c m enp0s3 ipv4.gateway xxx.xxx.xxx.xxx

DNS設定
nmcli c m enp0s3 ipv4.dns xxx.xxx.xxx.xxx

DNS検索ドメインを指定
nmcli c m enp0s3 ipv4.dns-search example.com

IPアドレスの設定一括
nmcli c m enp0s3 ipv4.method manual ipv4.address xxx.xxx.xxx.xxx/xx ipv4.gateway xxx.xxx.xxx.xxx ipv4 dns xxx.xxx.xxx.xxx ipv4.dns-search example.com

IPアドレス手動設定
nmcli c m enp0s3 ipv4.method manual

IPアドレスDHCP設定
nmcli c m enp0s3 ipv4.method auto

設定の反映(インタフェースの再起動)
nmcli c down enp0s3; nmcli c up enp0s3

設定確認
nmcli d show enp0s3

ネットワーク系サービスの再起動
systemctl restart network

設定ファイル
/etc/syscofig/network-scripts/enp0s3-eth0

# nmcli c show
NAME             UUID                                  TYPE      DEVICE
有線接続 1       cea98da4-01c7-3932-a104-xxxxxxxxxxx  ethernet  enp0s3
ethernet-enp0s3  f2b53bdd-9c32-483f-834c-xxxxxxxxxxx  ethernet  --
# nmcli c m "有線接続 1" connection.id "enp0s1"
# nmcli c show
NAME             UUID                                  TYPE      DEVICE
enp0s1           cea98da4-01c7-3932-a104-xxxxxxxxxxx   ethernet  enp0s3
ethernet-enp0s3  f2b53bdd-9c32-483f-834c-xxxxxxxxxxx   ethernet  --