- Back to Home »
- Centos , Linux , rede , Redes »
- Como alterar o device name do CentOS7 para eth0
Posted by : Rafael Holanda
sexta-feira, 6 de janeiro de 2017
Alterar o arquivo /etc/default/grub, incluindo os parâmetros no kernel para que seja habilitada a opção de renomear a placa de rede para eth0:
net.ifnames=0 biosdevname=0
Edite com o Vi o arquivo de configuração do GRUB (/etc/default/grub) e procure pela linha "GRUB_CMDLINE_LINUX", adicione depois da opção "quiet" os seguintes parâmetros:
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/swap crashkernel=auto rd.lvm.lv=centos/root vconsole.font=latarcyrheb-sun16 vconsole.keymap=br-abnt2 rhgb quiet net.ifnames=0 biosdevname=0"
Depois execute o comando abaixo para que seja efetivada a alteração no GRUB:
# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file
Found linux image: /boot/vmlinuz-3.10.0-121.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-121.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-df30d92ad3eb414583d85bb471003eb4
Found initrd image: /boot/initramfs-0-rescue-df30d92ad3eb414583d85bb471003eb4.img done
Alterar o nome do adaptador de rede:
# mv /etc/sysconfig/network-scripts/ifcfg-enp0s3 /etc/sysconfig/network-scripts/ifcfg-eth0
Confira se o parâmetro "NAME" no arquivo eth0 está como ETH0, se não estiver, altere-o:
NAME=ETH0
Reinicie a máquina para efetivar a alteração do device name para eth0:
# shutdown -r now
Depois de reiniciar, confira com o ifconfig se o nome foi alterado corretamente:
# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.100 netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::a00:27ff:feb5:cdb5 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:b5:cd:b5 txqueuelen 1000 (Ethernet)
RX packets 3363 bytes 268445 (262.1 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 155 bytes 19560 (19.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 0 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Via: VoL