Forge Home

routing

Manages Quagga (ospfd, bgpd, zebra), and GRE tunnels

10,371 downloads

10,002 latest version

3.4 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.1.2 (latest)
  • 0.1.1
  • 0.1.0
released Oct 24th 2013

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'johann8384-routing', '0.1.2'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add johann8384-routing
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install johann8384-routing --version 0.1.2

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download
Tags: ospf, bgp, gre, bgpd, ospfd, quagga

Documentation

johann8384/routing — version 0.1.2 Oct 24th 2013

Quagga Routing Module

This module configures GRE tunnels and then uses Quagga (ospfd and bgpd) to do dynamic routing across the tunnels.

I'll do some refactoring over the next few weeks to add IPSEC support, as well as make it so you can mix OSPF and BGP and control whether or not to share routes between the two protocols.

License

Apache v2.0

Contact

Jonathan Creasy jonathan.creasy@gmail.com

Support

Please log tickets and issues on the issues tab

Examples

/usr/bin/puppet apply  --verbose --confdir ./ --modulepath ./modules ./manifests/quagga.pp

Define your peers:

$peer1 = '65.175.90.34'
$peer2 = '199.119.124.102'
$peer3 = '199.119.123.200'

Each peer needs to have some information:

    $lan_interface    = 'virbr0'
    $lan_description  = 'LAN'
    $lan_cidr         = '192.168.122.0/24'
    $asn              = '65531'
    $tunnels = {
      'tun0' => { 'peer' => $peer2, 'interface' => 'tun0', 'description' => 'peer2', 'local' => '10.0.0.1', 'remote' => '10.0.0.2', 'remoteasn' => '65532' },
      'tun1' => { 'peer' => $peer3, 'interface' => 'tun1', 'description' => 'peer3', 'local' => '10.0.0.5', 'remote' => '10.0.0.6', 'remoteasn' => '65533' }
    }

I use this switch statement to define the standard variables for each peer:

case $fqdn {
  'peer1': {
    $lan_interface    = 'virbr0'
    $lan_description  = 'LAN'
    $lan_cidr         = '192.168.122.0/24'
    $asn              = '65531'
    $tunnels = {
      'tun0' => { 'peer' => $peer2, 'interface' => 'tun0', 'description' => 'peer2', 'local' => '10.0.0.1', 'remote' => '10.0.0.2', 'remoteasn' => '65532' },
      'tun1' => { 'peer' => $peer3, 'interface' => 'tun1', 'description' => 'peer3', 'local' => '10.0.0.5', 'remote' => '10.0.0.6', 'remoteasn' => '65533' }
    }
  }
  'peer2': {
    $lan_interface    = 'bond1.4001'
    $lan_description  = 'LAN'
    $lan_cidr         = '10.50.66.0/24'
    $asn              = '65532'
    $tunnels = {
      'tun0' => { 'peer' => $peer1, 'interface' => 'tun0', 'description' => 'peer1', 'local' => '10.0.0.2', 'remote' => '10.0.0.1', 'remoteasn' => '65531' },
      'tun2' => { 'peer' => $peer3, 'interface' => 'tun2', 'description' => 'peer3', 'local' => '10.0.0.9', 'remote' => '10.0.0.10', 'remoteasn' => '65533' }
    }
  }
  'peer3': {
    $lan_interface    = 'em3'
    $lan_description  = 'LAN'
    $lan_cidr         = '192.168.4.1/24'
    $asn              = '65533'
    $tunnels = {
      'tun1' => { 'peer' => $peer1, 'interface' => 'tun1', 'description' => 'peer1', 'local' => '10.0.0.6', 'remote' => '10.0.0.5', 'remoteasn' => '65531' },
      'tun2' => { 'peer' => $peer2, 'interface' => 'tun2', 'description' => 'peer2', 'local' => '10.0.0.10', 'remote' => '10.0.0.9', 'remoteasn' => '65532' }
    }
  }
}

Create the GRE tunnels:

define create_tunnels($peer, $interface, $description, $local, $remote, $remoteasn) {
  routing::gre { "tunnel_to_${peer}":
    peer_outer_ip => $peer,
    peer_inner_ip => $remote,
    my_inner_ip   => $local,
    interface     => $interface,
  }
}

create_resources (create_tunnels, $tunnels)

Now start configuring the routing protocols:

class { 'routing::zebra':
  lan_interface   => $lan_interface,
  lan_description => $lan_description,
  lan_cidr        => $lan_cidr,
  tunnels         => $tunnels,
}

Use OSPF:

class { 'routing::disable::bgpd': }
class { 'routing::ospfd':
  lan_interface   => $lan_interface,
  lan_description => $lan_description,
  lan_cidr        => $lan_cidr,
  tunnels         => $tunnels,
}

Or BGPD:

class { 'routing::disable::ospfd': }
class { 'routing::bgpd':
  lan_interface   => $lan_interface,
  lan_description => $lan_description,
  lan_cidr        => $lan_cidr,
  tunnels         => $tunnels,
}