After installing NMAP: dnet: Failed to open device eth0?
Asked Answered
M

6

17

Error after starting command > nmap

dnet: Failed to open device eth0 after installing NMAP.
QUITTING!
Messier answered 3/1, 2020 at 0:30 Comment(0)
A
48

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.

Austinaustina answered 6/6, 2021 at 12:4 Comment(2)
Confirmed on Ubuntu 22.04 LTS.Murphey
It helped me as well when I had a smimilar issue on RPi4 Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-1035-raspi aarch64) In my case it was complainining about wlan0 instead of eth0. sudo nmap -O -sV -v 192.168.1.0/24 Starting Nmap 7.94 ( nmap.org ) at 2023-09-10 11:54 EDT NSE: Loaded 46 scripts for scanning. Initiating ARP Ping Scan at 11:54 dnet: Failed to open device wlan0 QUITTING!Tidbit
G
8

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
Graycegrayheaded answered 8/6, 2021 at 18:46 Comment(2)
Just found the same question in Networking Stack Exchange (I suppose it is a more proper location for asking): networkengineering.stackexchange.com/questions/20265/…, but also didn' t have working solutions, so added mine there. I hope that does not violate some SE/NSE rule.Graycegrayheaded
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.Infantine
M
1

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

Messier answered 3/1, 2020 at 0:30 Comment(0)
P
1

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

Prorogue answered 20/5, 2020 at 6:19 Comment(0)
G
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.

Gnarly answered 3/3, 2022 at 6:1 Comment(0)
A
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.

Audryaudrye answered 27/7, 2020 at 12:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.