0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

centos7~のNIC ネットワークデバイス名の変更

Posted at

#CentOS7から標準でデバイス名の割当がeth0から変わってる
es@abcのように割り当てられるようになった

@はデバイスの種類を表し o:オンボード p:pci
abcはnicの固有値なのでmacによって決められる

##運用面で使い勝手が悪いので今までのeth0に変更する

現状のデバイス名を確認する
ifconfig -a

esp123がデバイス名だった場合

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

vim /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-enp123 /etc/sysconfig/network-scripts/ifcfg-eth0

ファイルを開き、ens33の部分を2箇所eth0に変更する。
vim /etc/sysconfig/network-scripts/ifcfg-eth0

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

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?