How are you determining the IP address you’re attacking? 10.0.2.4 was just the address that my VM picked up but yours will likely be different.
There are a number of ways that you could determine the address that your VM has picked up:
would give you a list of machines on the local network. To determine which machine was the VM you’re attacking you would need to get the MAC address that has been assigned within Virtual Box.
nmap -sn <network range you’re in> (e.g., 10.0.0.0/24)
this does a ping scan and will quickly give you the hosts responding on your network segment.
Alternatively, as I did in this write-up you could run the:
nmap 10.0.2.0/24 -A -Pn
which will be slow but will be more comprehensive. (This, it turns out, is not an ideal early scan but it will work.)