Explore a simple network automation approach for constructing a BGP network in VYOS Equuleus using Ansible and Vagrant within a VirtualBox environment. This setup has been successfully tested on Fedora Core 37 and Windows 10 using WSL. When executing $ vagrant up
from Windows, it will likely prompt you to specify the bridge interface, as demonstrated below.
The public_network functions as a bridge to your existing home network, enabling direct SSH access to reconfigure the management IP of the VYOS accordingly. The default management IP utilizes the 192.168.123.0/24 subnet. Meanwhile, the private_network employs the 192.168.5.0/30 and 192.168.56.4/30 subnets for point-to-point connectivity, respectively. This demo doesn't change the default password for vyos.
I have disabled SSH host key verification in ansible.cfg, so exercise caution while working with this setup.
- Ansible (for Windows follow the instructions from this link)
- Vagrant
- Virtualbox
- Git
Host | Interface | IP Address |
---|---|---|
router1 | management | 192.168.123.103 |
router2 | management | 192.168.123.104 |
router3 | management | 192.168.123.105 |
If you're planning to change the management IP, you must change the Vagrantfile and the inventory file respectively.
For e.g., changing from 192.168.103.X network to 192.168.1.X
Vagrantfile:
router1.vm.network "public_network", bridge: "eno1", ip: "192.168.123.103"
inventory:
router1.mylab.com:
ansible_host: 192.168.123.103
Vagrantfile:
router1.vm.network "public_network", bridge: "eno1", ip: "192.168.1.103"
inventory:
router1.mylab.com:
ansible_host: 192.168.1.103
- Clone this repo using git.
- run
$ vagrant plugin install vagrant-vyos
- run
$ vagrant up
- run
$ ansible-playbook -i inventory bgp.yaml
- ssh to one of the VYOS and run
sh ip ro
to check the routes. You will find the BGP routes marked as B>*
- Add another tasks to apply the same management IP address defined in the inventory file using ansible. (TIP: host_vars, jinja2 templating, or lookup)
- Automatically provision a new VYOS router (router4) to build this network:
- Extend the tasks to provision a three-tier application in the advertised network 172.21.100.X