LoginSignup
5
3

More than 5 years have passed since last update.

CentOS 7 NIC ネットワークデバイス名の変更

Last updated at Posted at 2018-02-25

動作確認環境

  • 仮想環境 VMware Workstation Player 14.1.1
  • OS Windows 10 Pro 64bit

仮想環境

  • OS CentOS 7.4 (1708) minimalインストール
  • メモリ 2GB
  • HDD 250GB

変更方法

CentOS 7では標準でデバイス名がens33になっている。
これを一般的な名称eth0に変更する。

1 カーネル起動時の変更
grubの編集

vi /etc/default/grub

net.ifnames=0 biosdevname=0を追記する。

GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet net.ifnames=0 biosdevname=0"

編集後、内容を反映するためにコマンドを実行する。

grub2-mkconfig -o /boot/grub2/grub.cfg

以下のような文が表示され、最後にdoneと表示されればよい。

Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-693.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-693.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-9346d04a2bfa47d89e7523247656d127
Found initrd image: /boot/initramfs-0-rescue-9346d04a2bfa47d89e7523247656d127.img
done

2 NICの設定ファイルの変更
NICの設定ファイル名の名前を変更する。

mv /etc/sysconfig/network-scripts/ifcfg-ens33 /etc/sysconfig/network-scripts/ifcfg-eth0

ファイルを開き、ens33の部分を2箇所eth0に変更する。

vi /etc/sysconfig/network-scripts/ifcfg-eth0

3 設定反映
再起動するとNICのデバイス名が変更される。

shutdown -r now

参考

CentOS 7でNICのデバイス名を変更する | 俺的備忘録 〜なんかいろいろ〜


目次

5
3
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
5
3