Business, Technology, Tutorial

How to make a Virtual Machine (VM) Visible on the LAN with Virtualbox and Ubuntu

Why this post?

Some new owners took over a company. The previous owner had delivered a crm system to the new owners which ‘ran on a server upstairs’. The buyers asked for all admin passwords to the server which the Sellers provided. However, these were just user passwords and not actual root passwords or system passwords to the actual box. A few short weeks after taking over the company, the physical server died dead.

The goal was to take this good hard drive and make it work again ‘like it was’ on a different machine.

The other goal of this post is to hopefully help someone else who is stuck with a dead server and needs to make it work again somehow ‘as was’.

I won’t claim this is a one-shoe-fits all blog, but hopefully the process of what I went through will also help and you might have to tweak it a bit for your unique situation (ie. Perhaps you don’t run into a Red Hat server but something different).

From here forward this assumes that you are running Ubuntu (or something linux) as the host machine with Virtualbox installed.

SECTION 1 – MAKING VIRTUALBOX RECOGNIZE AN EXTERNAL DRIVE

The first thing I had to do was physically move the server’s hard drive to the new machine and plug it in, which I did.

Then, I had to make Virtual box recognize that drive which was, let’s just say, not quite as simple as just plugging it in. This blog is a great walk through of what you need to do:

Blog showing how to connect physical drive to Virtualbox

SECTION 2 – CRACKING THE WINDOWS 7 PASSWORD

At least I knew from trying to boot the hard drive on another failed computer that it was Windows OS on the drive.

QUICK RELATED BUNNY TRAIL
This is a good point to stop and say again how bad Windows is. I didn’t realize that Windows is actually linked to the hardware of the computer so tightly so that if you try to simply put the drive in another box and boot it it says “This isn’t the original hardware, I won’t boot”. Really dumb. I never recall having that issue with Ubuntu: it just seems to boot.

Now that I have this thing booted, I’m greeted with an admin password. Sadly, we would never see this password as the person who sold the business (as mentioned above) would not give it to us and claimed they never had it. As such, the only option left was to break the password of this Windows 7 thing. The good news is that all I had to do was download an ISO and boot it as an optical drive in the same Virtual box that has this Windows 7, and it did all the work. First, here is the link to that resource:

The Pogostick thing that resets admin password to Windows

Just follow the blog and it’s pretty much exactly has he says. However, there are a few steps to do in Virtualbox that took me a while so I’ll maybe map out the workflow here. I’ll be honest that I let too much time elapse here before I logged this so it might need a ‘minor’ tweak but it should be pretty close:

  1. Download the ISO
  2. Put the ISO on (perhaps) a USB stick or drive
  3. Stick it in the Ubuntu machine with Virtualbox in it
  4. In Virtualbox, and inside the Windows VM, choose ‘settings’
  5. “Add new storage attachement’
  6. Optical drive
  7. “Add”
  8. Search for your Pogostick ISO file
  9. Go to ‘settings’ again for your Windows VM
  10. Adjust boot order to put the optical drive first (so that it boots to your Pogostick ISO)

Save changes and start it up. This will get the windows box unlocked

SECTION 3 – CRACKING THE RED HAT AND RESETTING ROOT

Ironically, as soon as I got in I discovered that their ‘server’ was actually running on VirtualBox inside this half-dead windows machine. However, I had to adjust network settings in the server and as such needed root access which also was not given us. So, here is my section on cracking a Red Hat Fedora password. Of course we don’t call it ‘cracking’ we call it ‘resetting root’ because that’s nicer. 🙂

In short, this blog got me 90% of the way there. However, it assumed that you know how to get to grub and all that boot stuff. That’s not a fair assumption so I wanted to build it up a bit more.

Before embarking on the blog above, if you have never done this, I suggest watching this video for a kind of ‘quick 5 minute tutorial’ about the process in general. However, this is NOT for Red Hat / Fedora, but it is a very nice and smooth presentation about ‘generally’ what you will do.

After watching it, start the blog above.

When you hit step 3 of that blog things weren’t clear for me but what worked was to edit the kernel line and add single init=/bin/sh to the end, and then proceed as normal as per videos / blogs

The part that threw me off was this sh-3.00# stuff which much be Red Hat version to show you you are root.

After you change the password and get the ‘successful tokens’ message, there is one more thing that wasn’t clear – how to get out.

It asked to do /sbin/reboot which for me did not work.

I reached out to someone who said ‘just do control + d’ which i then did. It gave some ‘kernel panic’ messages and cryptic looking stuff, and then I did a full power-off and rebooted.

When it came back I had full root access.

I hope some or all of this helps some or all of you 😉

SECTION 4 – MAKING THE SERVER VISIBLE ON THE NETWORK

This also was hard for me as I’m not a network guy. It seemed no matter what I did I could not get the VM guest to show up on the Local Area Network (LAN) for the rest of the computers in the office, even though I now had ful access to the server. I watched countless videos which told me not to use ‘bridged mode’ but actually bridge mode was the thing that finally got me up and running. Of course do your own research but in my case I had one very simple need: make this old server visible to the office again. I didn’t care about the host computer to the VM as its only function was to make the guest do its thing. As such here is the setup I finally used to get things going:

  1. In my wired settings (the host computer is plugged in via ethernet, adjust according to your needs) I set a static IP of the host machine to 192.168.0.3 (example). I gave it googles’ DNS 8.8.8.8 because they are reliable. I’ll likely get rid of these soon but ‘they work’
  2. In in my Virtual Box File/Preferences/Host Network Manger settings I gave the default ‘vboxnet0’ connection a manually configured IP of 192.168.0.4 and the usual 255.255.255.0 netmask
  3. While powered off, in the VM in the ‘settings/network’ section, I set ‘Adapter 1’ to ‘Bridged Adapter’ for the ‘Attached to:” field.
  4. While logged into the newly resurrected Red Hat server thing, I gave it a manual IP of 192.168.0.5 and the usual netmask and 8.8.8.8 for DNS

And that’s pretty much it.

I did a ping to / from the Host and Guest and it worked and the I did a ping test to google.com from each and they also worked. After these were working I was then able to reach the server from the other ‘real’ computers on the 192.168.0.1 network (gateway).

I hope some or all of this post helped you get through either

  • Mounting a physically drive on a virtual machine
  • Gaining access to an old Windows machine that someone unethically locked you out of
  • Gaining access to an old random Red Hat Fedora server
  • Making a virtual server visible to your local area network (LAN)
Tagged , ,

1 thought on “How to make a Virtual Machine (VM) Visible on the LAN with Virtualbox and Ubuntu

  1. Hope someone Clonezilla’ed the working drive in case it’s about to quit. (And then worked out a real backup scheme)

Leave a Reply

Your email address will not be published. Required fields are marked *