티스토리 뷰

CentOS 7 또는 Redhat Enterprise Linux 7 버전을 처음 설치하게 되면 Network Device Name이 이전 버전과는 상이하게 표기되는 것을 확인 할 수 있다.


이는 CentOS 7 버전부터 채택된 systemd를 통해 일관되고 예측가능한 (Consistent and predictable network device naming) 네트워크 장치이름을 제공하는 방식으로 변경되었으며,


BIOS Level에서 인지하는 PCI BUS 주소에 따른 물리적인 장치순서 및 Type에 따라 이름을 지정하는 방식이다.


(참고 - https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/ch-Consistent_Network_Device_Naming.html)


무튼 각설하고~


enp0s3 뭔가 이름이 굉장히 낯설고 어색하다........... -ㅅ -


그래서 "난 저 일관되고 예측가능한 방식의 장치명 보다는 예전 방식이 좋다.." 한다면 아래와 같은 과정을 통해 장치명을 변경 가능하다.



1. Ethernet 장치명 및 상태 확인


[root@centos7 ~]# 

[root@centos7 ~]# ip addr 

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 

    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00

    inet 127.0.0.1/8 scope host lo

       valid_lft forever preferred_lft forever

    inet6 ::1/128 scope host 

       valid_lft forever preferred_lft forever

2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000

    link/ether 08:00:27:19:5c:c6 brd ff:ff:ff:ff:ff:ff

    inet 192.168.137.70/24 brd 192.168.137.255 scope global enp0s3

       valid_lft forever preferred_lft forever

    inet6 fe80::a00:27ff:fe19:5cc6/64 scope link 

       valid_lft forever preferred_lft forever

[root@centos7 ~]# 

[root@centos7 ~]# 

[root@centos7 ~]# find /sys/devices/ -type l | grep enp

/sys/devices/pci0000:00/0000:00:03.0/net/enp0s3/device

/sys/devices/pci0000:00/0000:00:03.0/net/enp0s3/subsystem

[root@centos7 ~]# 

[root@centos7 ~]# 

[root@centos7 ~]# lspci | grep -i eth

00:03.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev 02)

[root@centos7 ~]# 

[root@centos7 ~]# 

[root@centos7 ~]# for LIST in `ifconfig -a | grep enp | awk '{print $1}'`; do echo "${LIST} - `ethtool ${LIST} | egrep 'Speed|Link detected'`" && echo; done

enp0s3: - Speed: 1000Mb/s

Link detected: yes


[root@centos7 ~]# 

[root@centos7 ~]#  



2. Boot Loader grub에서 Kernel 부팅 옵션에 BIOS기반 장치 이름을 사용하지 않도록 Parameter 선언


[root@centos7 ~]#
[root@centos7 ~]# cat /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto  vconsole.keymap=us rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# perl -pi -e 's#rhgb#net.ifnames=0 biosdevname=0 rhgb#g' /etc/default/grub
[root@centos7 ~]#
[root@centos7 ~]# cat /etc/default/grub | grep rhgb
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap vconsole.font=latarcyrheb-sun16 rd.lvm.lv=centos/root crashkernel=auto  vconsole.keymap=us net.ifnames=0 biosdevname=0 rhgb quiet"
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-123.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-123.el7.x86_64.img
Warning: Please don't use old title `CentOS Linux, with Linux 3.10.0-123.el7.x86_64' for GRUB_DEFAULT, use `Advanced options for CentOS Linux>CentOS Linux, with Linux 3.10.0-123.el7.x86_64' (for versions before 2.00) or `gnulinux-advanced-b25b1e98-c089-4c51-902f-678c478175da>gnulinux-3.10.0-123.el7.x86_64-advanced-b25b1e98-c089-4c51-902f-678c478175da' (for 2.00 or later)
Found linux image: /boot/vmlinuz-0-rescue-80837d5f83094e51a40be051fdbc03e3
Found initrd image: /boot/initramfs-0-rescue-80837d5f83094e51a40be051fdbc03e3.img
done
[root@centos7 ~]#
[root@centos7 ~]#


 

3. ifcfg 설정에 정의된 네트워크 장치명 변경

 

[root@centos7 ~]#
[root@centos7 ~]# cd /etc/sysconfig/network-scripts/
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 network-scripts]# mv ifcfg-enp0s3 ifcfg-eth0
[root@centos7 network-scripts]#
[root@centos7 network-scripts]# cat ifcfg-eth0
TYPE=Ethernet
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=enp0s3
UUID=567cbcc2-dd0c-4ea0-af1c-2057b4c4467a
ONBOOT=yes
HWADDR=08:00:27:19:5C:C6
IPADDR=192.168.137.70
NETMASK=255.255.255.0
GATEWAY=192.168.137.1
DNS1=147.6.44.44
[root@centos7 network-scripts]#
[root@centos7 network-scripts]# perl -pi -e 's#NAME=enp0s3#NAME=eth0#g' ifcfg-eth0
[root@centos7 network-scripts]#
[root@centos7 network-scripts]# cat ifcfg-eth0 | grep NAME
NAME=eth0
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#


 

4. Network 서비스 재기동 및 변경된 Network Device Name 확인

 

[root@centos7 network-scripts]#
[root@centos7 network-scripts]# systemctl list-unit-files | grep -i network
dbus-org.freedesktop.NetworkManager.service enabled
NetworkManager-dispatcher.service           enabled
NetworkManager-wait-online.service          disabled
NetworkManager.service                      enabled
network-online.target                       static 
network.target                              static 
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 network-scripts]# systemctl restart NetworkManager.service
[root@centos7 network-scripts]#
[root@centos7 network-scripts]# service network restart
Restarting network (via systemctl):                        [  OK  ]
[root@centos7 network-scripts]#
[root@centos7 network-scripts]#
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# ip addr | grep -w "inet"
    inet 127.0.0.1/8 scope host lo
    inet 192.168.137.70/24 brd 192.168.137.255 scope global eth0
[root@centos7 ~]#
[root@centos7 ~]#

 

 

 

 

 

 

반응형

'System Story > CentOS 7' 카테고리의 다른 글

CentOS7 EPEL 확장 Repository 설정하기  (0) 2016.02.09
CentOS7 System Locale 변경하기  (0) 2015.12.09
CentOS7 네트워크 설정하기  (2) 2015.01.02
CentOS7 서비스활성화 하기  (0) 2015.01.02
CentOS7 Runlevel 변경하기  (0) 2015.01.02
반응형
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday