Troubleshooting Vulnhub VM Network Interface Issues in Proxmox

In this post, I show you how to troubleshoot when a VM you've imported from Vulnhub won't receive an IP address from the DHCP server.

2 years ago   •   4 min read

By 0xBEN
Table of contents

Identifying the Issue

I have imported the Sunset: Dawn2 VM from Vulnhub.

sunset: dawn2
sunset: dawn2, made by whitecr0wz. Download & walkthrough links are available.

However, when I powered it on, it is not receiving an IP address from the DHCP pool. Here, I have the VM plugged into vmbr1 and assigned to VLAN 999.

If I check in pfSense to see if the MAC address is in the DHCP leases, it is nowhere to be found. I can assume that the VM is not making a request to the DHCP server for a new lease.





What's the Issue?

ℹ️
The interface name that was used when the VM creator exported the VM from their virtualization platform, which can be attributed to Predictable Network Interface Names
PredictableNetworkInterfaceNames

You can inspect the /etc/network/interfaces file to see which interface(s) the VM was shipped with. Typically, I have noticed that the interface name that the VM ships with is enp0s3. However, if you run the command ip address in the terminal, you will see that your VM likely has a different interface name.

Because, the interfaces defined in /etc/network/interfaces do not match the hardware on the VM, it is unable to communicate on the network.





Fixing the Issue

Edit the Bootloader Options

Turn or reboot the VM, so that you can interact with the bootloader.

Press the e key at this screen to edit the boot configuration. Then, you'll see this screen next.

We want to change this line, so that when the system boots, it mounts the file system as read-write and initializes with /bin/bash. So, we'll change ro to rw and append init=/bin/bash to the end of the linux line.

Before
After

Press CTRL + X or the F10 key to proceed to boot the VM. Next, you'll see that you are running a command prompt.





Inspect the Interfaces File

Run the command cat /etc/network/interfaces to view the system's current network configuration. We don't care about the lo interface, as that is the loopback interface and won't be causing any issues for us.

The primary network interface is where you want to focus. Notice here, that on my VM, the interface is named enp0s3.





Get Your Interface Name

Run the command ip link. You'll see that on my VM, there is a lo interface and an ens18 interface.

The problem is that enp0s3 does not match ens18 and therefore, the VM cannot access the network.





Edit the Interfaces File

Run the command nano /etc/network/interfaces to open your interfaces file in a text editor. Replace enp0s3 with your interface name. I will be entering ens18 in my interfaces file.

Press CTRL + X, then press the Y key, then press the Enter key to save the changes to the file.

Press CTRL + X, then press Y
Press Enter

Your changes should now be permanent at every boot. You only have to do this once.





Boot the VM and Check for a New Lease

Run exec /sbin/init at the prompt here to continue booting the VM after you've made your changes.

Log into pfSense or whatever system is acting as your DHCP server and check if your VM has requested a new DHCP lease.

Perfect.

Spread the word

Keep reading