ifdown: interface enp0s3 não configurada. Respostas RTNETLINK: O arquivo existe. ifup: falha ao abrir enp0s3

ifdown: interface enp0s3 não configurada. Respostas RTNETLINK: O arquivo existe. ifup: falha ao abrir enp0s3

Eu tenho uma caixa virtual (6.1) com Ubuntu mínimo. nas configurações da máquina virtual na seção de rede, "Adaptador em ponte" está selecionado.

root@ubuntu:/home/mista# dmesg -T|head -1
[Sun Oct 24 10:56:10 2021] Linux version 5.4.0-89-generic (buildd@lgw01-amd64-044) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #100-Ubuntu SMP Fri Sep 24 14:50:10 UTC 2021 (Ubuntu 5.4.0-89.100-generic 5.4.143)

root@ubuntu:/home/mista# ip a

    1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
        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 fq_codel state UP group default qlen 1000
        link/ether 08:00:27:1e:5b:6d brd ff:ff:ff:ff:ff:ff
        inet 192.168.88.236/24 brd 192.168.88.255 scope global dynamic enp0s3
           valid_lft 473sec preferred_lft 473sec
        inet6 fe80::a00:27ff:fe1e:5b6d/64 scope link 
           valid_lft forever preferred_lft forever

root@ubuntu:/home/mista# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

auto enp0s3
iface enp0s3 inet static
address 192.168.88.236
netmask 255.255.255.0
gateway 192.168.88.1

root@ubuntu:/home/mista# ifdown enp0s3
ifdown: interface enp0s3 not configured

root@ubuntu:/home/mista# ifup enp0s3
RTNETLINK answers: File exists
ifup: failed to bring up enp0s3

root@ubuntu:/home/mista# systemctl status networking

● networking.service - Raise network interfaces
     Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Sun 2021-10-24 11:24:35 MSK; 1min 39s ago
       Docs: man:interfaces(5)
    Process: 826 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
   Main PID: 826 (code=exited, status=1/FAILURE)

Oct 24 11:24:35 ubuntu systemd[1]: Starting Raise network interfaces...
Oct 24 11:24:35 ubuntu ifup[844]: RTNETLINK answers: File exists
Oct 24 11:24:35 ubuntu ifup[826]: ifup: failed to bring up enp0s3
Oct 24 11:24:35 ubuntu systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Oct 24 11:24:35 ubuntu systemd[1]: networking.service: Failed with result 'exit-code'.
Oct 24 11:24:35 ubuntu systemd[1]: Failed to start Raise network interfaces.


root@ubuntu:/home/mista# cat /run/network/ifstate
lo=lo

Tentei adicionar a string "enp0s3=enp0s3" a /run/network/ifstate mas não funcionou. Mas /run - é um sistema de arquivos virtual e a string com enp0s3 será excluída após recarregar os daemons ou reiniciar o servidor. Algumas pessoas dizem que todas as interfaces configuradas devem ser exibidas em/run/network/ifstate. Mas por que, então, a interface enp0s3 não é exibida no /run/network/ifstate se estiver registrada no config ?

E posso ter algum erro no arquivo de configuração?

após a reinicialização, o endereço 192.168.88.236/24 aumenta, mas estes comandos não funcionam:

ifup enp0s3
ifdown enp0s3

Não entendo por que os erros estão surgindo:

root@ubuntu:/home/mista# ifdown enp0s3
ifdown: interface enp0s3 not configured

root@ubuntu:/home/mista# ifup enp0s3
RTNETLINK answers: File exists
ifup: failed to bring up enp0s3

Onde ifup e ifdown podem fazer com que a configuração funcione com a interface, exceto para o arquivo /etc/network/interfaces?

O arquivo /etc/networks está vazio.

Responder1

Descobri que o dhcpv4 estava habilitado neste arquivo conf -/etc/netplan/01-netcfg.yaml. Após a reinicialização, o DHCP foi desativado.

quando a máquina virtual foi ligada, o daemon de rede levantou interfaces do/etc/rede/interfaces(endereço estático) configuração e do/etc/netplan/01-netcfg.yaml(DHCP).

portanto, quando o sistema foi iniciado, o sistema operacional tentou aumentar o endereço 192.168.88.236/24 de diferentes configurações por estática e por DHCP. O conflito surgiu por esse motivo.

em/etc/netplan/01-netcfg.yamleu mudei"dhcpv4: sim"paraenp0s3para"dhcpv4: não". E depois de reiniciar o dhcpclient desapareceu.

informação relacionada