Start Learning
Installation · Networking

Find the Metasploitable 2 IP Address

You need Metasploitable 2's address before you can scan it from another machine. Here are three ways to get it, from most direct to most realistic.

Method 1: Directly Inside the VM

The most reliable method — log into Metasploitable 2's console and run:

ifconfig

Look for the interface on your host-only network (often eth0), typically in the 192.168.56.0/24 range if you're using VirtualBox's default host-only network.

Method 2: From Your Hypervisor's Network Tools

Both VirtualBox and VMware can show DHCP leases for their host-only networks. In VirtualBox, check Tools → Network → Host-Only Networks → DHCP Server settings, or view the lease file if you have command-line access to VBoxManage.

Method 3: Host Discovery From Your Attacking VM

This is the most realistic approach, since it mirrors how you'd find a target on a real assessment where you don't already know its address:

nmap -sn 192.168.56.0/24

A ping sweep across the whole host-only subnet. Metasploitable 2 will show up as a live host; cross-reference the MAC vendor prefix if multiple hosts appear.

Once you have an address from any method, confirm it's actually reachable with ping before moving on to a full scan — see the Nmap scanning tutorial.

i

Write the address down for your session. It commonly changes after a VM reboot since host-only networks assign addresses via DHCP.

FAQ

Why does the IP address change between sessions?

Host-only networks typically hand out addresses over DHCP, so the address can shift after a reboot. Re-check it each time rather than assuming it's fixed.

Can I set a static IP on Metasploitable 2?

Yes, by editing its network interface configuration inside the VM, though most tutorials don't require it. It can make repeated lab sessions more predictable if you prefer a fixed address.

What if nmap host discovery finds nothing at all?

Confirm both VMs are on the same host-only network first (see network configuration) before assuming the target is unreachable for any other reason.