Member-only story

How to Setup Virtual Box with a Static IP Address

Bryant Jimin Son
4 min readDec 31, 2020

--

How to setup Virtual Box with a Static IP Address

To run Ansible for learning and testing purpose, it is quite tricky to figure out how to begin. A biggest challenge for me is how to setup a right environment that can be executed and tested easily without costing me a dime. Many people suggested to use a public cloud platform like Digital Ocean, but I am quite cheap. I can use a container platform like Docker, but that is not exactly a VM. Raspberry is alright, but I need to purchase one. Besides, I need to carry that with me all the time. I want something more simple solution like running VMs in my local laptop.

There are many options out there, but I decided to VirtualBox in my Mac. A tricky thing about this is that the default network is set as NAT (Network Address Translation), which gives an internet access but your host (like your Mac) cannot make the connection to the VM. Bridged network option is another way, which basically ties the your VM network with your host network, but this poses a potential challenge that your VM’s IP address changes whenever your Mac IP address changes. What we are going to do is to leverage Host-only network, which creates a virtual bridge between your VM and your host machine, while falling back to NAT as your primary internet network.

Assumptions:

  • Assumes that you already installed VirtualBox and know how to…

--

--

Bryant Jimin Son
Bryant Jimin Son

Written by Bryant Jimin Son

A cloud practitioner talking about technology, travels & career tips. But I will sometimes cover financial advises and some random stuffs.

No responses yet