I wanted to add a Virtual Router into my portable Lab – the reason for this was, I want to have a bunch of my VMs on a Private Network for testing – but no and again I want to patch them or give them temporary access to the Internet.  For this I am going to use a VyOS Virtual Machine and test with an Ubuntu Server I have.  I am using VMware Fusion on my Mac but the same process can be used in Workstation but using the Network Editor

For this example, I have created a Custom Network and called vmnet3


I already have an Ubuntu Server sitting on that network with a Static IP (and Gateway, DNS Servers etc..) that has no access to the Internet


I have downloaded the latest OVA. Select Import from Fusion, navigate to the OVA if necessary and select Continue


Give it a Name and Choose where you want it to be stored


Once this has finished – we need to Customize the VM to add it to the correct Network


So we have 2 Network Adaptors added by Default


Select the first Network Adapter.  I want this to be the External Interface – so ensure it is set to Autodetect and also that it is Connected


Now select Network Adapter 2, ensure it is Connected and we will select vmnet3 in my case.


Now we can power on the VM and login with the following default credentials:

Login to the Router with the following credentials:
Username: vyos
Password: vyos


To ensure the Router has both interfaces added type: show interfaces 


You can see that my Interface has an IP on the 10 Network already.  I dont want it to use that IP, so I am going to delete it


Now we need to add the IP Details to each Interface, to edit any config we need to enter: configure

The commands I am going to use are in the follow structure:

Set interfaces ethernet <interface> address <address>
Set interfaces ethernet <interface> description <description>

So I am going to add:

set interface ethernet eth0 address
set interface ethernet eth0 description Internal
set interface ethernet eth1 address dhcp
set interface ethernet eth0 description External


Now I have my 2 Interfaces added, let make sure I can talk to it from my Ubuntu Server.
I can Ping the Interface on the router but I cant get out onto the Internet

I now need to create a NAT rule to get to the Internet from my Ubuntu Server, to do this I need to use the following structure:

edit nat source rule <Number>
set source address <Internally facing IP>
set outbound-interface <Externally facing Interface>
set translation address masquerade

For me this looks like:

edit nat source rule 10
set source address
set outbound-interface eth1
set translation address masquerade

Now I am going to test Internal and External Routing again: