Free Open Source Router and Firewall | How to Install VyOS and Configure OSPF: Step-by-Step Guide

VyOS Installation and Configuration Guide

Introduction

VyOS is an open-source network operating system based on Debian GNU/Linux that provides software-based network routing, firewall, and VPN functionality. This guide covers the installation and configuration of VyOS, including setting up OSPF.

Installation of VyOS

1. Download VyOS ISO:

   – Go to the VyOS download page and download the ISO image of the latest stable version.

2. Create a Bootable USB Drive:

   – For Windows: Use Rufus to create a bootable USB drive.

   – For Linux/macOS: Use the `dd` command.

3. Boot from the USB Drive:

   – Insert the USB drive into your server or PC and boot from it. You may need to change the boot order in the BIOS/UEFI settings.

4. Install VyOS:

   – Once booted, you will be presented with the VyOS live environment. Log in with the default credentials:

     Username: vyos
     Password: vyos

   – To start the installation, enter:

     install image

   – Follow the prompts to select the installation disk, partitioning scheme, and other options. You will also set a password for the `vyos` user and create a GRUB bootloader.

5. Reboot:

   – After the installation completes, reboot the system and remove the USB drive. The system will boot into the installed VyOS.

Basic Configuration of VyOS

1. Log In:

   – Log in with the user `vyos` and the password you set during installation.

2. Enter Configuration Mode:

   configure

3. Set Hostname:

   set system host-name my-router
   commit
   save

4. Configure Network Interfaces:

   – Identify the network interfaces using the `show interfaces` command.

   – Configure an interface (e.g., `eth0`) with a static IP address:

     set interfaces ethernet eth0 address ‘192.168.1.1/24’
     commit
     save

5. Configure Default Gateway:

   set protocols static route 0.0.0.0/0 next-hop 192.168.1.254
   commit
   save

6. Set DNS Servers:

   set system name-server 8.8.8.8
   set system name-server 8.8.4.4
   commit
   save

7. Enable SSH:

   set service ssh port 22
   commit
   save

Configuring OSPF

Enable OSPF

To configure OSPF (Open Shortest Path First) on VyOS:

1. Enter Configuration Mode:

   configure

2. Enable OSPF:

   set protocols ospf parameters router-id 1.1.1.1

   Replace `1.1.1.1` with a unique router ID for the OSPF instance.

Configure OSPF on Interfaces

Specify which interfaces will participate in OSPF and their respective areas:

   set protocols ospf area 0 network 192.168.1.0/24
   set protocols ospf area 0 network 192.168.2.0/24

   Replace `192.168.1.0/24` and `192.168.2.0/24` with the actual network addresses of your interfaces.

Adjust OSPF Interface Parameters (Optional)

You can adjust OSPF interface parameters like cost, hello interval, and dead interval:

   set interfaces ethernet eth0 ip ospf cost 10
   set interfaces ethernet eth0 ip ospf hello-interval 10
   set interfaces ethernet eth0 ip ospf dead-interval 40

   Replace `eth0` with your actual interface name.

Commit and Save the Configuration

   commit
   save

Example Configuration for OSPF

Here is an example configuration where two interfaces (`eth0` and `eth1`) participate in OSPF with different network segments.

Configuration for Router 1:

configure
set interfaces ethernet eth0 address ‘192.168.1.1/24’
set interfaces ethernet eth1 address ‘10.1.1.1/24’

set protocols ospf parameters router-id 1.1.1.1
set protocols ospf area 0 network 192.168.1.0/24
set protocols ospf area 0 network 10.1.1.0/24

commit
save

Configuration for Router 2:

configure
set interfaces ethernet eth0 address ‘192.168.1.2/24’
set interfaces ethernet eth1 address ‘10.1.2.1/24’

set protocols ospf parameters router-id 2.2.2.2
set protocols ospf area 0 network 192.168.1.0/24
set protocols ospf area 0 network 10.1.2.0/24

commit
save

Verifying OSPF Configuration

1. Check OSPF Neighbors:

   show ip ospf neighbor

2. Check OSPF Routes:

   show ip route ospf

3. Check OSPF Interface Status:

   show ip ospf interface

Additional OSPF Configurations

Configuring OSPF Authentication

To enhance security, you can configure OSPF authentication on the interfaces:

1. Set Authentication Type and Key:

   set interfaces ethernet eth0 ip ospf authentication message-digest
   set interfaces ethernet eth0 ip ospf message-digest-key 1 md5 ‘yourpassword’

   Replace `yourpassword` with a secure password.

2. Configure OSPF Area Authentication:

   set protocols ospf area 0 authentication message-digest

Configuring OSPF Redistribution

To redistribute routes from other protocols (e.g., BGP) into OSPF:

1. Set Redistribution:

   set protocols ospf redistribute bgp
   commit
   save

Troubleshooting OSPF

1. Check OSPF Process:

   show ip ospf

2. Check OSPF Logs:

   show log

3. Debug OSPF:

   monitor protocol ospf

LACP Configuration | Increase Bandwidth Between

Link Aggregation Control Protocol (LACP) is a standard that allows you to bundle multiple physical links together to increase bandwidth and provide redundancy. This is often used to improve network performance and ensure high availability. Below are the general steps to configure LACP on network devices such as switches:

1. Ensure LACP Support:

  • Make sure that the network devices (usually switches) you are using support LACP.

2. Identify the Ports:

  • Identify the physical ports on the devices that you want to aggregate. For example, if you have two switches, identify the ports on each switch that will be part of the aggregated link.

3. Access the Device Configuration:

  • Access the command-line interface (CLI) or web-based management interface of your network device. This is typically done through a console cable, SSH, or a web browser.

4. Navigate to Port Configuration:

  • In the device configuration interface, navigate to the port configuration section.

5. Configure LACP:

  • Enable LACP on the ports that you want to aggregate. This is usually done by setting the aggregation mode to “Active” or “Passive” depending on your specific requirements.
  • Active mode means that the port actively initiates the LACP negotiation.
  • Passive mode means that the port responds to LACP negotiation but doesn’t actively initiate it.

Example (Cisco Switch CLI):

interface range GigabitEthernet0/1 - 2

channel-group 1 mode active

In this example, GigabitEthernet0/1 and GigabitEthernet0/2 are part of a channel group with mode set to active.

6. Configure the Same LACP Settings on the Other End:

  • If you are aggregating links between two devices (like two switches), ensure that you configure the same LACP settings on the corresponding ports of the other device.

Example (Cisco Switch CLI – Other End):

interface range GigabitEthernet0/1 - 2

channel-group 1 mode active

7. Verify the Configuration:

  • After configuring LACP on both ends, verify the status of the aggregated link to ensure that the LACP negotiation is successful and that the link is up.

Example (Cisco Switch CLI):

show lacp neighbor

show interfaces port-channel 1

These commands will show the LACP neighbors and the status of the aggregated link.

Keep in mind that specific commands and procedures may vary depending on the vendor and model of your network devices. Always refer to the documentation provided by your device’s manufacturer for accurate and device-specific information.