1

I am running a kali linux terminal using wsl2. I seem to be having some network issus or possebly missing something.

When I try to ping anything on my local network or outside I get no response at all
I also made a script that should ping every machine connected to the network and I get no response there eiter, here is the code for that :

from scapy.all import Ether, ARP, srp
if __name__ == "__main__":
    #If all bits of a MAC address is set to 1 it will broadcast to all devices in a network
    broadcast = "FF:FF:FF:FF:FF:FF"
    #Create a ethernet layer packet
    ether_layer = Ether(dst = broadcast)
    #This represent that we want to scan all devices with IP addresses from 192.168.74.1 up tp 192.168.74.255
    ip_range = "192.168.0.1/24"

arp_layer= ARP(pdst = ip_range)
packet = ether_layer / arp_layer

ans, unans = srp(packet, iface="eth0", timeout=2)

for snd, rcv in ans:
    ip = rcv[ARP].psrc
    mac = rcv[Ether].src
    print("IP = ", ip, " MAC = ", mac)

Any tip would be greatly appreciated.[PingTest][1]
[1]: https://i.sstatic.net/S2Iqg.png
2
  • Kali is best suited to a real VM (posting from that here) or its own machine (for penetration testing) .
    – anon
    Commented Mar 12, 2022 at 15:07
  • So I got Kali running on VirtualBox and tried the scrip from there and it worked great.
    – Viktor J
    Commented Mar 12, 2022 at 23:16

1 Answer 1

2

While you can use layer 3 ICMP ping to reach other hosts, both on the local network and externally, you appear to be using layer 2 ARP for discovery.

Note that WSL2's layer 2 network is a virtual, internal, Hyper-V network switch. As such, you aren't going to see hosts on other layer 2 networks using ARP in WSL2.

While WSL2 is great, if you are attempting to learn networking or pen testing with Kali, WSL is likely not the right tool for you. As @John mentioned in the comments, consider a VM or physical machine where you will have more control over the network.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .