DC@Home 4 – MPLS WAN improvements, monitoring and backup

So I have been working quite a bit on the MPLS WAN setup the past few weeks. Currently I have two sites running the new MPLS nodes as their gateway and one more currently staged which will be installed in the coming weeks.

I still have some work to do for the sites which use multiple wan connections, but the primary WAN works great! I have also setup network monitoring using LibreNMS which allows me to do ICMP and SNMP monitoring, while also letting me build custom triggers for alerts. As of right now it covers all of my needs. 🙂

One note is that I had to adjust the MPLS MTU for the undelay DMVPN tunnel, but I will do a seperate post regarding MPLS MTU specifically.

Another project I have been working on is handeling backups of network configuration. So yesterday I set up an Ansible playbook which logs into network devices and checks if the configuration has been changed. If it detects a change it will grab the output of the following commands and write them to a file locally on the server. If there are any changes to the local backup files, it will then execute a python script which adds, commits and pushes the changes to Github.

---
- name: gurfininfra backup playbook
  hosts: all
  gather_facts: no
  tasks:

    - name: Show run
      cisco.ios.ios_command:
        commands: show running-config
      register: run_out

    - name: Check if configuration has changed
      template:
        src: /yeet/yeet/network_backups/backup_only_config_template.j2
        dest: "/yeet/yeet/network_backups/backups_config/{{ inventory_hostname }}_config_only_backup.txt"
      register: running_config

    - name: Get inventory
      cisco.ios.ios_command:
        commands: show inventory
      register: inventory_out
      when: running_config.changed

    - name: Get version
      cisco.ios.ios_command:
        commands: show version
      register: version_out
      when: running_config.changed

    - name: Get lldp neighbors
      cisco.ios.ios_command:
        commands: show lldp neighbors
      register: lldp_out
      when: running_config.changed

    - name: Get cdp neighbors
      cisco.ios.ios_command:
        commands: show cdp neighbors
      register: cdp_out
      when: running_config.changed

    - name: Get bgp summary
      cisco.ios.ios_command:
        commands: show ip bgp all sum
      register: bgp_out
      when: running_config.changed

    - name: Create backup file
      template:
        src: /yeet/yeet/network_backups/backup_template.j2
        dest: "/yeet/yeet/network_backups/backups/{{ inventory_hostname }}_backup.txt"
      when: running_config.changed

    - name: Push to Github
      ansible.builtin.script:
        cmd: /yeet/yeet/network_backups/github_upload.py 
        executable: /usr/bin/python3
      register: result
      when: running_config.changed

I would really like to get the secondary MPLS links up and running and also connect the network backup Ansible inventory, as well as the LibreNMS monitoring, to my Netbox instance, so that I can provision backup and monitoring directly in the IPAM.

yeet

Leave a Reply

Your email address will not be published. Required fields are marked *