11

Error after starting command > nmap

dnet: Failed to open device eth0 after installing NMAP.
QUITTING!
Potherca
  • 13,207
  • 5
  • 76
  • 94
Davor
  • 676
  • 1
  • 11
  • 15

6 Answers6

35

In my case, the error was caused by nmap being installed through Snap.

In order to get nmap to work, I had to tell snap to connect it to the network-control:

sudo snap connect nmap:network-control

After that everything worked fine.

Potherca
  • 13,207
  • 5
  • 76
  • 94
5

TLDR: Use the --unprivileged nmap option.

I just suffered the same problem when tried to scan/test hosts thru a Wireguard 0.3.14 tunnel in Windows 8.1 and Windows 7 using the last available versions, nmap 7.91, npcap 1.31. Tried several solutions/combinations, running as admin, reinstalling, etc., except downgrading to Winpcap 4.1.3 (the last available) with the same result:

C:\Windows\system32>nmap -n -P0 -p 22 192.168.20.1
Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower.
Starting Nmap 7.91 ( https://nmap.org ) at 2021-06-08 13:28 Hora de verano central (México)
dnet: Failed to open device eth0
QUITTING!

It's strange that the interface listing of nmap --iflist does not show a device name associated with eth0 (also doesn't show a MAC address, maybe it's Wireguard interface driver install/hooks at fault here). Relevant lines:

C:\Windows\system32>nmap --iflist
Starting Nmap 7.91 ( https://nmap.org ) at 2021-06-08 13:32 Hora de verano central (México)
************************INTERFACES************************
DEV  (SHORT) IP/MASK                      TYPE     UP   MTU   MAC
eth0 (eth0)  10.10.252.92/32              ethernet up   65535 00:00:00:00:00:00
    :
DEV  WINDEVICE
eth0 <none>

Relevant route print:

C:\Windows\system32>route print
===========================================================================
Interface list
8...........................Wintun Userspace Tunnel #77
  :
IPv4 Route table
===========================================================================
Active routes:
Network Destination       Net mask   Gateway   Interface       Metric
192.168.20.0         255.255.255.0   On-link   10.10.252.92      5
192.168.20.255     255.255.255.255   On-link   10.10.252.92    261

Solved it using the --unprivileged option:

C:\Windows\system32>nmap --unprivileged -n -P0 -p 22 192.168.20.1
Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower.
Starting Nmap 7.91 ( https://nmap.org ) at 2021-06-08 13:22 Hora de verano central (MÚxico)
Nmap scan report for 192.168.20.1
Host is up (0.20s latency).

PORT   STATE SERVICE
22/tcp open  ssh

Nmap done: 1 IP address (1 host up) scanned in 0.29 seconds
not2qubit
  • 14,531
  • 8
  • 95
  • 135
Fjor
  • 320
  • 4
  • 6
  • 1
    Just found the same question in Networking Stack Exchange (I suppose it is a more proper location for asking): https://networkengineering.stackexchange.com/questions/20265/nmap-failed-to-open-device-eth1, but also didn' t have working solutions, so added mine there. I hope that does not violate some SE/NSE rule. – Fjor Jun 08 '21 at 18:58
  • Thanks. This "fixed" it for me. Zenmap/nmap use to tell you to add this flag, but it didn't this time. Just the "Failed to open device eth0" - nothing else. This is why I didn't try it initially. – B. Shea Dec 17 '21 at 16:32
1

After installing nmap-7.80-setup.exe, install please install npcap-0.9986.exe which is fully compatible with latest Windows 10 releases.

Davor
  • 676
  • 1
  • 11
  • 15
1

You can try this: nmap (IP) -P (puerto) --interface (ethX) or install npcap from oficially page https://nmap.org/npcap/#download

1

Not always too late.. I've seen this "reinstall or install npcapxversion all around the web but my solution was simple and logic based. Just enable NPCAP protocols ONLY in the network adapter you want to use, disable on the others.

The logic on reinstalling may be the order in wich npcap disable and reenable network interfaces giving top priority (disabling and re-enabling at last) to the actual one you are using. But if you don't wanna mess with interface priorities.. do as I said and just enable NpCap only in the adapter you need nmap to.

El Mauro
  • 31
  • 5
0

If you are using Nessus also in the same machine, you are not able to use nmap. NPCAP will be used by Nessus and same is required for NMAP as well.