Skip to content

Instantly share code, notes, and snippets.

@gizmoguy
gizmoguy / all-locations-of-interest.sh
Last active November 3, 2021 05:34
Get all locations-of-interest.csv files from git repo
#!/bin/bash
# Get all versions of a file in a git repo
# Where to output new files
output_dir="/tmp/all_loc_csvs"
# Which file are we interested in?
file_of_interest="locations-of-interest/august-2021/locations-of-interest.csv"
mkdir -p "${output_dir}"
@gizmoguy
gizmoguy / faucet-l2.yaml
Created April 15, 2020 04:10
split faucet l3/l2
vlans:
guest:
vid: 200
description: "guest network"
faucet_mac: "0e:00:00:00:20:01"
faucet_vips: ['20.0.0.254/8']
dps:
sw3:
dp_id: 0x3
hardware: "Open vSwitch"
@gizmoguy
gizmoguy / update-galmon.sh
Last active January 16, 2020 00:33
Galmon auto-update in docker
#!/bin/bash
git_tmp_dir=$(mktemp -d /tmp/galmon-XXXXX)
git clone --recursive https://github.com/ahupowerdns/galmon.git "${git_tmp_dir}"
cd "${git_tmp_dir}"
running_ver=$(sudo docker exec -it galmon cat githash.h | grep -Eo 'GIT_HASH "[a-z0-9]+"' | cut -d ' ' -f 2 | tr -d '"')
upstream_ver=$(git describe --always --dirty=+ | tr -d '\n')
vlans:
vlan100:
vid: 100
name: vlan100
faucet_vips:
- 192.168.2.254/24
faucet_mac: '00:00:00:00:00:22'
dps: {}
acls: {}
meters: {}
@gizmoguy
gizmoguy / faucet.yaml
Created August 13, 2019 10:31
faucet multidp routing example
vlans:
office:
vid: 100
description: "office network"
faucet_mac: "0e:00:00:00:10:01"
faucet_vips: ['10.0.100.254/24', '2001:100::1/64', 'fe80::c00:00ff:fe00:1001/64']
guest:
vid: 200
description: "guest network"
faucet_mac: "0e:00:00:00:20:01"
@gizmoguy
gizmoguy / acls.yaml
Last active July 22, 2019 09:43
Dynamically assign hosts to VLANs with FAUCET SDN Controller
acls:
assign-host-to-experiment-vlan:
# Send packets from host1 to experiment1 vlan
- rule:
eth_src: 2e:f6:43:15:c1:7d # host1 mac
actions:
output:
swap_vid: 101 # experiment1 vlan
allow: 1 # allow
- rule:
@gizmoguy
gizmoguy / faucet.yaml
Created February 1, 2019 04:20
NZNOG19 Faucet Configuration
---
dps:
atx930:
description: allied telesis
dp_id: 0x0000eccd6def54fe
hardware: "Allied-Telesis"
interfaces:
openli_server:
number: 1
native_vlan: lan
@gizmoguy
gizmoguy / faucet.yaml
Last active September 28, 2017 20:18
Reconfigure FAUCET configuration based on hostapd events, more information here: https://faucet-sdn.blogspot.co.nz/2016/07/8021x-authentication-on-faucet-nfv.html
version: 2
acls:
eapoll_offload:
# Send EAP over LAN packets towards hostapd port
- rule:
dl_type: 0x888e # EAP over LAN
actions:
output:
vlan_vid: 10
@gizmoguy
gizmoguy / python_introspection.py
Created April 30, 2017 03:24
Python inspect module parsing faucet config options
#!/usr/bin/env python3
import inspect
import pprint
from dp import DP
from vlan import VLAN
from port import Port
pp = pprint.PrettyPrinter(indent=4)
@gizmoguy
gizmoguy / .travis.yml
Created March 13, 2017 02:01
Travis.yml for faucet
# Check with travis lint .travis.yml.
# TODO: we want this to be xenial, but travis doesn't support it yet.
# dist: xenial
language: python
python:
- "2.7"
before_install:
- "sudo -H apt-get install graphviz"
- "pip install influxdb"
install: