Eu uso a rede através do networking.service
e do /etc/network/interfaces
arquivo de configuração em um sistema Debian 12 (como mostrado aqui ).
Problema
Adicionei uma GPU e depois de reiniciar, o computador ficou offline. É um NAS sem display, então tive que conectar uma tela e um teclado.
E vi que ip addr
reportou uma nova interface: enp3s0
.
Problema: minha configuração é /etc/network/interfaces
mencionada apenas enp2s0
:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp2s0
iface enp2s0 inet dhcp
Solução temporária
Tive que substituir enp2s0
e enp3s0
correr systemctl restart networking
para recuperar a rede, e funcionou.
Se algum dia eu remover a GPU ou adicionar um dispositivo PCI-Express, o nome da interface de rede poderá mudar novamente e o servidor ficará offline.
Então eu alterei o arquivo conf para gerenciar enp2s0
ou enp3s0
:
# The primary network interface
# without GPU
allow-hotplug enp2s0
iface enp2s0 inet dhcp
# with GPU
allow-hotplug enp3s0
iface enp3s0 inet dhcp
Solução definitiva?
É seguro declarar conf para interfaces que podem ou não existir? Existe uma maneira mais limpa?