How to Build a VMware Homelab – Step-By-Step Tutorial Series: Configure VyOS for Routing

How to Build a VMware Homelab – Step-By-Step Tutorial Series:  Configure VyOS for Routing

This is part 3 in my homelab rebuild series. In Part 1 we prepared our environment and created a bootable USB drive which we used in Part 2 to install ESXi on the physical server. We also deployed our three nested ESXi servers. We are making use of VLANs in the nested homelab, so we need to introduce L3 routing. Without L3 routing there is obviously no connectivity between these different networks. The following diagram shows the network topology we are going to build:

The yellow router on the left will be the focus of this part of the build process. I’m using a VyOS appliance in my homelab. You are free to use one of the Nightly Builds from https://vyos.net/get/nightly-builds/. I will be using the VyOS 1.3.2 generic ISO image. 

Creating the VyOS appliance Virtual Machine

Create a new Virtual Machine on the physical ESXi server:

Make sure to select Guest OS version Debian GNU/Linux 11 (64-Bit):

Make sure Network Adapter 1 is connected to the Home-Network portgroup and the Adapter Type is VMXNET 3. Add Network Adapter 2 and connect this to the Nested-ESXi-Trunk portgroup. The uplink of the router is now connected to the physical home network (subnet 192.168.2.0/24), and the downlink of the router will be a trunk port where we can create Virtual Interfaces (VIFs) for all our VLANs:

Installing VyOS to the Virtual Machine

Start the VM and mount the ISO file you downloaded from the VyOS website:

The default login and password are ‘vyos’ and ‘vyos’:

Now use the ‘install image’ command to install VyOS to the virtual hard disk of the VM. The installation wizard is very straightforward. Disconnect the ISO file when the installation is done and issue the ‘reboot’ command:

Configuring the VyOS appliance

The VyOS CLI is very intuitive: 

  • Type ‘config’ to enter configuration mode. 
  • Type ‘commit’ to make your config active
  • Type ‘save’ to save to your boot config

First, we will configure the IP address on the uplink interface with “set interfaces ethernet eth0 address 192.168.2.145/24”. It’s good practice to provide a description and label your interfaces for future reference: “set interfaces ethernet eth0 description Home-Network

Type ‘commit

The downlink interface eth1 needs to support jumbo frames so we set the MTU size of the interface to 9000 with the command “set interfaces ethernet eth1 mtu 9000”. 

Next, we will create the Virtual Interface (VIF) for VLAN 10, our management network, configure the IP address and include a description:

set interfaces ethernet eth1 vif 10 address 10.0.10.252/24
set interfaces ethernet eth1 vif 10 description ESXi-Management

Type ‘commit’ to effectuate the changes.

We should now change the Gateway of our Windows jumphost from 192.168.2.254 (my ISP router) to the new VyOS appliance with IP address 192.168.2.145/24:

After this change we should now be able to ping the VLAN 10 interface (10.0.10.254/24) on the VyOS appliance from our Windows jumphost (192.168.2.36/24): 

It is now a good moment to enable SSH so can easily connect to the VyOS appliance and copy/paste configuration commands. Type ‘set service ssh port 22’:

Make sure to commit and save your changes and try to SSH into the VyOS appliance. We will need VLANs for VSAN and vMotion as well so copy and paste the following config commands:

set interfaces ethernet eth1 vif 4 address ‘10.0.4.254/24’
set interfaces ethernet eth1 vif 4 description ‘vMotion’
set interfaces ethernet eth1 vif 4 mtu ‘9000’
set interfaces ethernet eth1 vif 8 address ‘10.0.8.254/24’
set interfaces ethernet eth1 vif 8 description ‘VSAN’
set interfaces ethernet eth1 vif 8 mtu ‘9000’

Both vMotion and VSAN traffic will benefit from the MTU 9000 size so make sure to configure this on both VIFs.

Finally, we need to set a default route with the ISP router as the gateway so we can connect to the internet: “set protocols static route 0.0.0.0/0 next-hop 192.168.2.254 distance 1

Once you commit this config change, you can route via the VyOS appliance, to the ISP router, to the internet:

To round things up, let’s verify we can connect from our jumphost in the physical home network with IP address 192.168.2.36/24 to our nested ESXi host 01 in the ESXi-Management VLAN10 with IP adderess 10.0.10.101/24:

Pro tip: is you use ‘show configuration’ or ‘show config’ you will see the entire VyOS configuration file. If you append this with ‘commands’ you will get the config command statements that you can easily copy and paste. Here are the relevant commands we used in this part of the tutorial:

vyos@vyos:~$ show configuration commands
set interfaces ethernet eth0 address '192.168.2.145/24'
set interfaces ethernet eth1 mtu '9000'
set interfaces ethernet eth1 vif 4 address '10.0.4.252/24'
set interfaces ethernet eth1 vif 4 description 'vMotion'
set interfaces ethernet eth1 vif 4 mtu '9000'
set interfaces ethernet eth1 vif 8 address '10.0.8.252/24'
set interfaces ethernet eth1 vif 8 description 'VSAN'
set interfaces ethernet eth1 vif 8 mtu '9000'
set interfaces ethernet eth1 vif 10 address '10.0.10.254/24'
set interfaces ethernet eth1 vif 10 description 'ESXi-Management'
set protocols static route 0.0.0.0/0 next-hop 192.168.2.254 distance '1'
set service ssh port '22'
set system host-name 'tor01'
set system name-server '192.168.2.36'
set system ntp server 192.168.2.36

Next steps

In the next part of this tutorial series, we will download, install, and configure vCenter Server. Stay tuned!


Leave a Reply