Ernie Leseberg

Random writings on software & product development, running, business and anything else

Tag: ubuntu

VirtualBox with Static IP on Ubuntu Server Guest

Setup for the following technology:

  • Windows 10 as host machine
  • VirtualBox 6.0.18
  • Guest OS is Ubuntu 20.04 (Focal Fossa) Server Beta [other versions since around 17.10 will work]

The aim is being able to access the guest on a static IP from the host to upload/download files and for the guest to be able to access the internet for API access to external services, apt update etc.

VirtualBox

For this to happen the VM needs 2 network adapters:

  • a host-only network adapter and configure the VM with a static IP address (for host to guest access)
  • NAT network adapter (for access to the outside world)

To begin it is assumed you have downloaded the relevant Ubuntu iso file, created a new virtual machine through VirtualBox and gone through that install process. Do a sudo apt update & sudo apt upgrade to have the OS up to date and then sudo shutdown now.

Back in VirtualBox. For this VM, choose settings and the Network.

VirtualBox Network Adapter 1 image
VirtualBox Network Adapter 1

Now go to Adapter 2, check Enable Network Adapter and choose Attached to ‘Host-only Adapter’.

VirtualBox Network Adapter 2 image
VirtualBox Network Adapter 2

OK to save the new setting and start the VM. You will now be back in the console window.

Ubuntu and Netplan

To see the network interfaces available type:

ip a

and you will get output like:

Ubuntu 20.04 ip a before static IP
Ubuntu 20.04 ip a before static IP

Netplan is the network management tool on Ubuntu these days, so forget the old /etc/network/interfaces.

cd /etc/netplan
ls -la

Depending on your Ubuntu version you will see a filename like 01-netcfg.yaml for my Ubuntu 20.04 server or 50-cloud-init.yaml for Ubuntu 18.04. Make a backup of that file in case something goes wrong and you need to roll back.

sudo cp 01-netcfg.yaml 01-netcfg.yaml.110420

Now edit the config file with your preferred text editor (vi, nano etc). In the image below I have added the other network interface as seen from ip a and have given it the static IP of 192.168.56.108.

Netplan cfg with static IP

sudo netplan apply

ip a

Ubuntu 20.04 ip a after static IP
Ubuntu 20.04 ip a after static IP

And that is it. I can now ssh / ftp into the guest server from the host on its static IP address and the guest can connect to the internet.

Subversion commands in Nautilus

One tool I had missed from Windows days is TortoiseSVN which integrated svn commands into Windows explorer. Often the command line is quick and easy to use, but if I want to check in a subset of changed files I find the GUI way quicker.

In Linux it was all command line until I came across nautilus-script-collection-svn in the Ubuntu repositories which adds a menu on right click to perform subversion commands. In Ubuntu 8.10 also need to issue the following at the command line:

nautilus-script-manager enable Subversion

SVN commands from the Nautilus file manager

There is no visual highlighting of changed files etc in Nautilus like you get in TortoiseSVN.

Light in the Linux laptop tunnel

After my previous post regarding my struggle to find a Linux laptop in Australia, I have now been given a suggestion that may solve the problem. While waiting for my daughter to finish dance class, I stopped into a company called TopBit Computing. I have never dealt with them before, but the sales guy seemed to know his stuff.
Continue reading

© 2020 Ernie Leseberg

Theme by Anders NorenUp ↑