LoginSignup
0
0

More than 3 years have passed since last update.

CentOS 7 ネットワーク設定の自分用まとめ

Posted at

VirtualBox上のCentOS 7で設定を参照・変更する機会が多くなったので自分用メモ。

確認

デバイスの状況確認

nmcli d

DEVICE TYPE STATE CONNECTION
enp0s3 ethernet 接続済み enp0s3
lo loopback 管理無し --

インターフェースの状況確認

nmcli d show enp0s3

GENERAL.DEVICE: enp0s3
GENERAL.TYPE: ethernet
...

接続

デバイス追加

nmcli c add type ethernet ifname enp0s3 con-name enp0s3

自動接続を有効にする

nmcli c m enp0s3 connection.autoconnect yes

インターフェースダウン

nmcli connection down enp0s3

インターフェースアップ

nmcli connection up enp0s3

インターフェースダウンアップ(設定反映

nmcli connection down enp0s3; nmcli connection up enp0s3

設定

DHCP

nmcli c modify eth0 ipv4.method auto

手動設定

nmcli c modify eth0 ipv4.method manual

IPアドレス

nmcli c mod enp0s3 ipv4.addresses 10.0.2.1/24
第3オクテッドは最初に作ったVMから、2、3、4・・・となる模様。

デフォルトゲートウェイ

nmcli c mod enp0s3 ipv4.gateway 10.0.2.2
第4オクテッドは2っぽい。

DNS

nmcli c mod enp0s3 ipv4.dns 8.8.8.8

0
0
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
0
0