Posted in Blog, Resources

Lab Troubleshooting – Converting and IPs

Part of learning is labbing. There is a lot of practice that can be on online through a browser, but there’s often a need to use a virtual machine. There are a lot of write-ups on the basics of VM setup. I want to do a quick run down of 2 issues I’ve come across recently getting a VMWare machine converted to VirtualBox and adjusting the IP address of the VM.

Converting VMs

VirtualBox and VMWare Workstation Player are common hypervisors. Most of the practice VMs I’ve found are designed and tested on one or the other. I have and use both. For the most part, using the hypervisor that the VM came in isn’t a problem. Occasionally, like a Linux pivoting lab I’m working on for The Hacker Playbook 3, I need to switch from one to the other. This lab involves a Linux environment where Peter Kim has set up static IPs on the VMs. To use it, you need to get your attack machine in the same range. I’ve not found a way to do this in the free VMWare Workstation Player. I’ve found that changing the IPs used when the designer specifies them often results in broken labs (or more trouble than their worth to fix labs).

This How-To Geek tutorial has solid instructions for converting between the two hypervisors. The only issue I ran into was getting the OVFTool open in the Windows command line. The easiest way should be to right-click in the folder where it is and use “Open command window here”. I didn’t have that option – I have open in PowerShell instead. The easiest adjustment for me was to copy the file path, open a command prompt, and just use cd "<copied filepath>".

Converting the files was simple and straightforward. Then it’s a matter of importing them into the appropriate hypervisor. But I found when I opened up the VM, the only connection I had was the loopback interface. For some reason, converting from a VMWare VM to a VirtualBox machine broke the networking. It took some creative googling to figure out what happened. The VMs for the lab were running Ubuntu that was recent enough to use Predictable Network Interface Names. These were different in the VMs after converting them to VirtualBox. A StackOverflow question had a solution that worked since creds were provided for the VMs. You do need sudo access, but it got the job done.

Basic steps:

  1. See what interfaces are available.

  2. Update the /etc/network/interfaces to reflect the appropriate interface name.

  3. Restart networking services by restarting VM or /etc/init.d/networking restart

  ip a # or ifconfig -a to see what interfaces are available
  sudo vi /etc/network/interfaces # enter sudo password and update file as needed
  /etc/ini.d/networking restart

The file will look something like:

  # The primary network interface
  auto enp0s3
  iface enp0s3 inet dhcp

Just switch out whatever your interface is for whatever is in the same location as enp0s3. Not a big deal to fix, but would be problematic without creds. Little nuances like this are why I keep the lab VM in the original format whenever I can. Learning how to convert and fix what breaks is valuable, but I’d prefer to spend that time working on my intended goals.

Specifying IP range in VirtualBox

Sometimes labs will specify the IP ranges to use. It’s not always necessary to change them, but if it’s a more complex lab where multiple VMs are setup as a network, I’ve found it works better to take the time to make the IPs match. You can configure the VM using command utilities or VirtualBox settings. This post from Debugging Code has walkthroughs for several options.

VirtualBox has a lot of options for connecting the VM to the Internet. I recommend reading through the documentation to get a better understanding of what you should use when. I keep my labs in host-only for the most part, using NAT for external labs, and occasionally the other settings. It’s a good idea to check the network settings on the VMs you import. Since most are vulnerable by design, you don’t want them exposed to the Internet.

The typical situation I’ve encountered is needing to get everything on the same range, so the static IPs setup in the downloaded VMs will function as expected. My preferred approach is to use the host-only adapter. Open up VirtualBox then use Global Tools > Host Network Manager. Then you can configure/create/remove adapters as needed. You can also use the NAT network option if you will need outbound connections. Open VirtualBox, then File > Preferences > Network. You can add and configure NAT Networks here. You add then network, and then configure it.

Both options are easy to do – you just need to decide which is the better option for your situation. If you aren’t sure what the settings mean or what you should do with things like DHCP, take some time to research the protocols and learn what you need to know to make your labs function.

Wrap Up

Working on labs is important, and labs are much more fun when they work properly. Since these are things I’ve run into, I wanted a quick write-up for my reference. Hopefully it might help others as well.

Happy labbing!

Disclaimer – don’t do illegal stuff, etc.


Lifelong paradox - cyber sec enthusiast - loves to learn

One thought on “Lab Troubleshooting – Converting and IPs

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.