Short summary: Fixed host↔guest host‑only networking between a Kali host (vboxnet0) and a Metasploitable2 guest (eth1) by either enabling host DHCP or assigning a persistent static IP on the guest. Includes quick commands for snapshotting, enabling DHCP on the host, static guest configuration, and safe recon commands.
Metasploitable2 had a second VirtualBox host‑only NIC present (eth1) but no IPv4 address, so the Kali host could not reach it. Common causes: no host-only DHCP server, guest interface not brought up, or temporary static assignment only.
Take a snapshot (recommended before changes):
VBoxManage snapshot "Meta2" take "host-only-up" --description "Host-only and static IP 192.168.56.101"Try DHCP from inside guest:
sudo ip link set eth1 up
sudo dhclient -v eth1
ip addr show eth1Assign a one-off static IP (guest):
sudo ip addr add 192.168.56.101/24 dev eth1
sudo ip link set eth1 up
ip addr show eth1
# From host:
ip addr show vboxnet0
ping -c 4 192.168.56.101Enable host-only DHCP on the Kali host (host-side):
sudo VBoxManage dhcpserver add \
--netname HostInterfaceNetworking-vboxnet0 \
--ip 192.168.56.2 --netmask 255.255.255.0 \
--lowerip 192.168.56.100 --upperip 192.168.56.200Then on the guest:
sudo dhclient -v eth1Create /etc/network/interfaces.d/eth1.cfg on the guest:
auto eth1
iface eth1 inet static
address 192.168.56.101
netmask 255.255.255.0
Then:
sudo ifdown eth1 2>/dev/null || true
sudo ifup eth1
# or reboot if ifup/ifdown not available:
sudo reboot- Snapshot before destructive testing.
- Service scan from host:
nmap -Pn -sV -oN metasploitable-scan.txt 192.168.56.101- Enumerate common services:
ssh,ftp,telnet,rpcbind,mysql,vsftpd, etc. - From the guest, confirm firewall state:
sudo iptables -L -n- Run
VBoxManageas the same user that owns the VM — usingsudocan cause it to look in another user’s registry. - If the VM is in Saved state, discard the saved state before changing adapter settings:
VBoxManage discardstate "Meta2"- Keep Metasploitable isolated — it’s intentionally vulnerable. Use host‑only + NAT; do not expose to the public internet.
fix.md— this filescripts/enable-host-dhcp.sh— host-side DHCP helper (optional)configs/eth1.cfg— example persistent guest network file for Debian-based guestsnmap-examples.txt— useful nmap command collection
mkdir meta2-host-only && cd meta2-host-only
# place fix.md, scripts/enable-host-dhcp.sh, configs/eth1.cfg, nmap-examples.txt into the directory
git init
git add .
git commit -m "Initial: Meta2 host-only networking guide"
# create repo on GitHub, then:
git remote add origin git@github.com:YOURUSER/meta2-host-only.git
git branch -M main
git push -u origin mainMIT
- 2025-10-17 — Initial guide & commands.
