VMware ESXi virtual machine image deployment to Digital Ocean (and setup networking after)

Piotr Bracha
3 min readMay 3, 2021

--

1. First you need to export the image. To do this, after logging into the VMware ESXi console, display a list of virtual machines by right-click on the appropriate one and select Export from the context menu. The image will download locally. It should have the extension .vmdk.

2. If the image weighs more than 2GB (which is almost every image) the only option will be to upload it via URL (Images Custom ImagesImport via URL). Any other option will result in an error, because browsers limit the size of the uploaded file.

3. After a successful upload, you need to create a vps server in the typical way, but choose an uploaded image instead of an operating system. This is where the problems start because you will not be able to connect to the freshly created server. You need to go to the client’s panel to the console available in the upper right corner of the main preview window of the created server and click on the Console button and then log in. This console is an emulator of your physical presence at the machine. Below is a list of steps that will allow you to connect via ssh to the server and access the internet from within it.

4. First I created a grub.d directory in /etc/default/. In it a file 50-cloudimg-settings.cfg (in cloud instances this file exists and only one thing needs to be added — I mention it below) containing several lines:

  • GRUB_RECORDFAIL_TIMEOUT=0
  • GRUB_TIMEOUT=0
  • GRUB_CMDLINE_LINUX_DEFAULT="console=tty1 console=ttyS0 net.ifnames=0" - if file exists it is enough to add net.ifnames=0 so that interface names are not custom but standard ones like eth0, eth1
  • GRUB_TERMINAL=console

5. The next step is to run two commands update-grub and reboot. After the reboot you should see two interfaces eth0 and eth1 as a result of one of the commands ip addr or ifconfig (I prefer this one for readability reasons, but it is not available by default, you need to install the net-tools package).

6. Time’s up to allow our server say “hello” to the Internet:

  • ifconfig eth0 X.X.X.X netmask Y.Y.Y.Y up - I assign a given ip address and mask to the eth0 interface and switch the interface on at the same time
  • ip route add default via Z.Z.Z.Z - I add a default route to the network through the gateway

7. Now I was able to log into the server using ssh protocol. Further steps are executed using this connection.

8. Unfortunately I could not ping the domain names from the console yet. Therefore, I added google’s dns to the /etc/resolv.conf file:

  • 8.8.8.8
  • 8.8.4.4

9. I was able to install netplan and cloud-init (updating system repositories requires the server to “understand” domain names). I did this with the apt install netplan cloud-init command.

10. Next I had to prepare the interfaces configuration in /etc/netplan/50-cloud-init.yaml. To be able to do this I first had to create a netplan directory and a 50-cloud-init.yaml file.

11. In the file created in the earlier step, I pasted the configuration I prepared earlier (note that this is a .yaml file, so care should be taken to ensure correct indentation):

network:
version: 2
ethernets:
eth0:
addresses:
- X.X.X.X/NET_MASK --> public addressation from Networking tab
- A.A.A.A/NET_MASK --> private addressation from Networking tab
gateway4: Z.Z.Z.Z --> public addressation from Networking tab
match:
macaddress: aa:bb:cc:dd:ee:ff --> interface's mac address returns ip addr command
nameservers:
addresses:
- 67.207.67.2 --> Digital Ocean DNS
- 67.207.67.3 --> Digital Ocean DNS
search: []
set-name: eth0

12. Using the documentation I ran two commands netplan generate (configuration validation) and second in order netplan apply (configuration application). I had to stop both by pressing ctrl+c because they were blocking the console.

13. I commented out everything in the /etc/network/interfaces file, deleted the google dns in /etc/resolv.conf and restarted the server.

14. Voilà!

Disclaimer:

The steps described in the tutorial were performed on Ubuntu Server 18.04.5 LTS.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response