As described in one of my previous post -> Run CentOS VM on your windows laptop, it is easy to get an Oracle VirtualBox VM to host CentOS on your windows laptop.
On a Wifi network the VM fires up fine and is able to access the outside world. However, if you’re a road warrior and need to be able to use the VM while being connected through the Tata Photon Plus data card then follow the steps below –
So let’s get the VirtualBox VM Manager and the CentOS VM to work fine in the following scenarios –
- Office/home network with wifi connectivity
- Tata Photon data card – USB connectivity
For #1 – Office/home network with wifi connectivity
- Setup the eth0 in DHCP mode as described previously
For #2 – Tata Photon data card – USB connectivity
Setting up Internet connectivity
- In Windows, Go to -> Control Panel\Network and Internet\Network Connections
- On the Photon Plus network connection, do a Right Click -> Properties -> Sharing
- Select “Allow other network users to connect through this …. “
- In the drop down select “VirtualBox Host-Only Network”. Hit OK. If you were previously connected, disconnect and connect again.
- Open up a dos console and hit “
ipconfig“, note down the IP that you see against “Ethernet adapter VirtualBox Host-Only Network:”
Setting up VM Networking
- In the Oracle VM Virtual Box Manager interface, located your VM instance.
- Open up Network
- Adapter 1 is setup for Wifi access. Leave it alone.
- Click on Adapter 2, Select the following values
- Attached to -> Host Only Adapter
- Name -> VirtualBox Host-Only Virtual Adapter
- Jot down the MAC address as shown in Advanced
- Now you’ve exposed Virtual Adapter #2 to your VM.
- Now power up your VM instance
- It might take an unusually long time as it might unsuccessfully try to acquire an IP address for eth0, which was set to auto-start previously. Inhale slowly and deeply. Exhale. 50% done.
- Log into the instance via the console
- Now go to
- Fire up your favorite editor (mine’s VI) and punch in the following
HWADDR="08:00:27:24:7D:07"#this is the MAC address that you jotted down above in step “VM Networking #4->3.”
IPADDR="192.168.137.10"#this is a hard-coded IP address from the same series (just change the last octet) that you jotted down in “Internet connectivity #5”
GATEWAY="192.168.137.1"#this is the hard-coded IP address as jotted down in “Internet connectivity #5”
- Save and rename the file “ifcfg-eth1”
- Almost there. About 80% done.
- Now open up
- Add “
nameserver 22.214.171.124” as the first line in the file. Save.
- Now let’s bring up the eth1 interface.
- Run the following command ->
- If all goes okay, you should instantly come back to the command prompt, without any errors.
- Now do a “
ping google.com” to see if you are able to access the internet.
- From putty you should be able to connect just fine to this server using the IP address as given in step “VM Networking #10->4”
When you’re connected via Wifi connection do remember to turn off
ifdown eth1 (to bring it back up use
When you’re connected via Tata Photon Plus connection do remember to turn off the
ifdown eth0 (to bring it back up use