LoginSignup
10
15

More than 5 years have passed since last update.

CentOS7での基本操作[ネットワーク周り]

Posted at

NetworkManager様に逆らっては生きていけないようなのでとりあえずまとめ。

ホストネーム

確認

hostnamectl [status]
nmcli g hostname

設定

hostnamectl set-hostname centos7.youyo.info

IPアドレス

確認

nmcli c show enp5s0

設定

  • 追加
nmcli c add autoconnect yes type ethernet con-name enp5s0 ifname enp5s0 ip4 10.0.0.210/24 gw4 10.0.0.1
nmcli c up ethernet-enp5s0
  • 修正
nmcli c modify enp5s0 ipv4.addresses "10.0.0.220/24 10.0.0.1"
nmcli c modify enp5s0 +ipv4.dns "8.8.8.8 8.8.4.4"
  • 反映
systemctl restart network.service
  • 削除
nmcli c delete enp5s0

便利パッケージ

コマンド補完が強力になる。必須。

yum install bash-completion
10
15
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
10
15