Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View djoreilly's full-sized avatar

Darragh O'Reilly djoreilly

View GitHub Profile
@djoreilly
djoreilly / mk-vxlan.sh
Created February 17, 2020 10:08
Linux VxLAN performance test setup script
#!/bin/bash
set -xe
# $0 host dev remote_ip
# host is 1 or 2
# on vmA
# ./mk-vx.sh 1 ens3 10.10.10.9
# on vmB
# ./mk-vx.sh 2 ens3 10.10.10.15
@djoreilly
djoreilly / ovs-cheat.md
Last active March 15, 2024 13:02
OVS cheat sheet

DB

ovs-vsctl list open_vswitch
ovs-vsctl list interface
ovs-vsctl list interface vxlan-ac000344
ovs-vsctl --columns=options list interface vxlan-ac000344
ovs-vsctl --columns=ofport,name list Interface
ovs-vsctl --columns=ofport,name --format=table list Interface
ovs-vsctl -f csv --no-heading --columns=_uuid list controller
ovs-vsctl -f csv --no-heading -d bare --columns=other_config list port
@djoreilly
djoreilly / Open vSwitch Lab.md
Last active December 30, 2023 14:28
Open vSwitch Lab

#Open vSwitch Lab

Get started with Open vSwitch, flows and OpenFlow controllers.

##Pre-reqs

Linux system with OVS installed.

##Setup

@djoreilly
djoreilly / ovs-sort-flows.py
Created January 19, 2021 15:16
Sort and tabulate the output of ovs-ofctl dump-flows
'''
Make the output of ovs-ofctl dump-flows more readable
'''
import re
import sys
from tabulate import tabulate
PAT = re.compile("^ cookie.*table=(\d+), n_packets=(\d+).+ priority=(\d+),*(.*) actions=(.+)")
if len(sys.argv) == 2:
@djoreilly
djoreilly / disable_OS_firewalls.md
Last active December 29, 2023 07:07
Howto disable OpenStack firewalls

Howto disable OpenStack firewalls

tested on kilo, juno and liberty. This breaks creating instances in horizon - on liberty anyway, maybe older too.

People usually want to do this because the anti-spoofing rules are dropping packets transmitted by Nova instances that do not have the source MAC or IP address that was allocated to the instance. Note: allowed-addresses-pairs or port-security extension can fix that. Also there is a performance drop using the hybrid plugging strategy (veth+linuxbridge+iptables).

But Nova needs a security groups API or it will refuse to start instances. It needs to be configured to use its own or Neutron's. Here we configure it to use the Nova security groups API, but disable nova-compute (and the Neutron L2 agent - just to be sure) from applying any iptables rules.

On each controller and compute node, change:

@djoreilly
djoreilly / multicast-openstack.md
Last active December 29, 2023 07:06
Multicast on OpenStack

Multicast on OpenStack

The following works with Neutron VLAN provider networks, and requires configuration on the physical switches. Multicast works on br-int because the ML2 OVS driver/agent uses OVS in standalone mode (no external controller). The packets on br-int hit the NORMAL flow action, and so get treated by the ovs-vswitchd code that does IGMP snooping (when enabled). All IGMP packets are sent to the slow path (userspace ovs-vswitchd).

The following will not work on Neutron tunnel backed networks (VxLAN, GRE), as the neutron-openvswitch-agent hardcodes flows on br-tun that treats multicast the same as broadcasts and the NORMAL action is not used.

+----------------------------+      +----------------------------+
|      +----+    +----+      |      |      +----+    +----+      |
|      | VM |    | VM |      |      |      | VM |    | VM |      |
|      +-+--+    +--+-+      |      |      +-+--+    +--+-+      |
@djoreilly
djoreilly / pp-iptables.py
Last active October 10, 2023 18:41
Pretty print iptables output. Align columns and strip out comments.
#!/usr/bin/python3
import re
import sys
from tabulate import tabulate
comments_re = re.compile(r'/\*.*\/')
in_chain, eof = False, False
headers, table = [], []
@djoreilly
djoreilly / poolBench_test.go
Last active September 14, 2023 10:01 — forked from 0xc0d/poolBench_test.go
sync.Pool Benchmark test
// go test -bench=.
package main
import (
"sync"
"testing"
)
type Person struct {
@djoreilly
djoreilly / bgpd.conf
Last active August 28, 2023 15:14 — forked from heri16/bgpd.conf
AWS VPC VPN StrongSwan Virtual Tunnel Interface (VTI)
#@ /etc/quagga/bgpd.conf (Centos & Ubuntu)
hostname <Local OS hostname>
password <Any random phrase>
enable password <Any random phrase>
!
log file /var/log/quagga/bgpd
!debug bgp events
!debug bgp zebra
debug bgp updates
@djoreilly
djoreilly / meta_svr.py
Last active May 17, 2023 08:04
Metadata server to allow booting cloud-init images on Libvirt
"""
Server to answer requests from Libvirt VMs to http://169.254.169.254/
Cloud images usually don't have a preset user/password, and this is needed to add a ssh pub key to .ssh/authorized_hosts.
Change SSH_PUB_KEY path below.
pip install bottle
sudo ip address add 169.254.169.254 dev virbr0
open firewall
-A ufw-user-input -s 192.168.122.0/24 -d 169.254.169.254/32 -i virbr0 -p tcp -m tcp --dport 80 -j ACCEPT