In most cases, I want my development server to be it’s own machine, with it’s own IP address. It can connect to the internet, databases, and other APIs and other devs in the office can access my machine via shell, webmin etc.
On my laptop, I wanted an completely offline system. I built a light version of our database and files and stored them locally on my laptop hard disk. How you do that will depend on your architecture. Below, I’ll document the changes I made to my parallels install and my Ubuntu virtual machine.
I am running Parallels 12 currently.
Step 1 – Make your virtual machine have a dynamic IP address
You need to edit a file on your virtual machine:
If you have the tools installed, you can use gedit via shell:
$ sudo gedit /etc/network/interfaces
Or FTP in and edit the file with a text editor.
If you have a static IP address already, you will see something similar to this:
iface eth0 inet static
In my case, it was using the keyword eth1 instead of eth0. I changed this block of code to:
iface eth0 inet dhcp
Then I restarted my network adapter on my virtual machine:
$ sudo /etc/init.d/networking restart
I did have trouble once getting these setting to take so I had to reboot the virtual machine.
Now you should have a dynamic IP address. Which means it could change and is assigned dynamically by the router.
Step 2 – Change the network adapter in Parallels
In the control center for your virtual machine, you want to select “shared network”. You can read more about it here:
Now your virtual machine will not require an internet connection for your Mac to access it. You will need to edit your hosts files to point to the new IP address assigned to the virtual machine by parallels. You can get the IP address via shell using the command ifconfig.
Step 3 – Edit host files
You will need to edit the file:
You probably have some lines in there with an IP address space development domain. Change the IP address to match the new IP address of your virtual machine. Now your mac will not go out through a router to access your virtual machine.
Posted by Daniel