0

I am running kali linux on a virtual machine (VM). I started the machine today and noticed that the interface eth0 is missing.

So I tried ifup eth0 to start it, but got output: unknown interface eth0.

But if I execute ethtool eth0 then I get this output:

Settings for eth0:
    Supported ports: [ TP ]
    Supported link modes:   10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Supported pause frame use: No
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes:  10baseT/Half 10baseT/Full 
                            100baseT/Half 100baseT/Full 
                            1000baseT/Full 
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Speed: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: Unknown (auto)
    Supports Wake-on: d
    Wake-on: d
    Current message level: 0x00000007 (7)
                   drv probe link
    Link detected: no
3

The reason of this error is that here, eth0 means two different things:

  • either the actual interface name, as seen by the kernel, iproute2 tools, ethtool, dhclient, etc. which does exist,

  • or the interface configuration in the ifupdown tools, pointing to the actual interface name. Here, if eth0 was never defined in the configuration, then it's not known by ifup: that's the error message.

    An easy way to reproduce this error:

    # ip link add name veth5 type veth peer name veth6
    # ethtool veth5
    Settings for veth5:
        Supported ports: [ ]
    [...]
        Link detected: no
    # ifup veth5
    ifup: unknown interface veth5
    

So the interface is not missing. the ifupdown tool has not been configured to use it.

For your case, you could add at the end of /etc/network/interfaces (or in a separate file for example /etc/network/interfaces.d/eth0 if the interfaces file includes the interfaces.d directory in its config) these two lines:

auto eth0
iface eth0 inet dhcp

To have the ifupdown tools and so the ifup command know about it and configure it with DHCP at boot. I have no idea why this wasn't in place before.

In my previous fake example where I added likewise veth5's definition (on Debian 9):

# ifup -a
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/veth5/1e:96:59:c3:e4:0c
Sending on   LPF/veth5/1e:96:59:c3:e4:0c
Sending on   Socket/fallback
DHCPDISCOVER on veth5 to 255.255.255.255 port 67 interval 8
0

I solved it by executing the command dhclient

dhclient - Dynamic Host Configuration Protocol Client

The Internet Systems Consortium DHCP Client, dhclient, provides a means for configuring one or more network interfaces using the Dynamic Host Configuration Protocol, BOOTP protocol, or if these protocols fail, by statically assigning an address.

...

The names of the network interfaces that dhclient should attempt to configure may be specified on the command line. If no interface names are specified on the command line dhclient will normally identify all network interfaces, eliminating non-broadcast interfaces if possible, and attempt to configure each interface.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.