LoginSignup
7
6

More than 5 years have passed since last update.

CentOS-Atomic-Host-7でのネットワーク設定

Last updated at Posted at 2015-07-11

etcがリードオンリーの為、ifcfg ファイルが編集できない。
nmcli 設定のメモ。

IPアドレス固定設定

# nmcli connection modify ens1 \
ipv4.method manual \
ipv4.addresses 10.1.0.201/24 \
ipv4.gateway 10.1.0.2 \
ipv4.dns "8.8.8.8 8.8.4.4" \
ipv4.dns-search "local.dev.net" \
connection.autoconnect yes

IPアドレス自動設定(DHCP)
# nmcli connection modify ens1 ipv4.method auto

設定確認
# nmcli --fields ipv4 connection show ens1


ipv4.method: manual
ipv4.dns: 8.8.8.8, 8.8.4.4
ipv4.dns-search: local.dev.net
ipv4.addresses: { ip = 10.1.0.201/24, gw = 10.1.0.2 }
ipv4.routes:

ipv4.ignore-auto-routes: no
ipv4.ignore-auto-dns: no
ipv4.dhcp-client-id: --
ipv4.dhcp-send-hostname: yes
ipv4.dhcp-hostname: --
ipv4.never-default: no
ipv4.may-fail: yes


インターフェイスActive
# nmcli connection up ens1

インターフェイスDeactive
# nmcli connection down ens1

onboot yes
# nmcli connection modify ens1 connection.autoconnect yes

ホスト名変更
# nmcli general hostname ホスト名

設定反映
# systemctl restart NetworkManager

設定変更
フィールド名の前に -, + をつける
# nmcli con mod ens1 -ipv4.dns 1
# nmcli --fields ipv4.dns con show ens1
ipv4.dns:8.8.8.8

# nmcli con mod ens1 +ipv4.dns 129.250.35.250
# nmcli --fields ipv4.dns con show ens1
ipv4.dns:8.8.8.8,129.250.35.250

7
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6