Adding a Virtual Router into Home Lab using VyOS

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 192.168.10.0 and called vmnet3

R1.png

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

2

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

3_1.png

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

3_2

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

3_1.png

So we have 2 Network Adaptors added by Default

6

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

7

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

8

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

9

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

10

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

11

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 192.168.10.9/24
set interface ethernet eth0 description Internal
set interface ethernet eth1 address dhcp
set interface ethernet eth0 description External
save
commit

15.png

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
16
17.png

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
commit
save

For me this looks like:

edit nat source rule 10
set source address 192.168.10.1/24
set outbound-interface eth1
set translation address masquerade
commit
save

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

18.png

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s