Configure a VirtualBox Web Server

Using Static IP Address and Bridged Adapter


Here’s a useful tip…

If you want to use a VirtualBox VM as a ‘localhost’ web server, you need two things:

  1. a static IP address for the VM so that you don’t have to update your DNS every time DHCP assigns a new IP
  2. use a Bridged Adapter instead of NAT for the VM so that you have 2-way network access between the guest and host

For the static IP, you’ll also need the DNS server IP address. In my case, I used 192.168.0.1, the same as the gateway address.

I did this as a prelude to setting up a Go web development environment in a VirtualBox Ubuntu Server VM.