Skip to content

Instantly share code, notes, and snippets.

View mathershifter's full-sized avatar

Jesse Mather mathershifter

View GitHub Profile
#!/bin/sh
#
# Lab / Testing CA
#
# generates:
# - a local authority
# - signs a server cert with a CN matching the hostname
# - client server for auth
#
# config:
@mathershifter
mathershifter / docker_wsl2_containerlab.md
Last active January 15, 2025 19:16
Docker + WSL2 + Containerlab

Docker + WSL2 + Containerlab

Hyper-V

  • Open a PowerShell prompt as Administrator

  • Enable Hyper-V

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
@mathershifter
mathershifter / goeapishowrib.go
Last active March 14, 2024 19:44
Example user-defined module for goeapi
package main
import (
"fmt"
"github.com/aristanetworks/goeapi"
)
type ShowRibRouteIp struct {
RibRoutesByProtocol map[string]Protocol
! **Make sure to change the common-name to match your environment**
security pki certificate generate self-signed switch.crt key switch.key generate rsa 2048 validity 30000 parameters common-name myswitch.lab.lan
!
configure
!
management security
ssl profile SELFSIGNED
certificate switch.crt key switch.key
!
management api gnmi
@mathershifter
mathershifter / arssh.py
Last active March 17, 2021 21:10
Arista SSH client
# -*- coding: utf-8 -*-
# Copyright (c) 2017 Arista Networks, Inc. All rights reserved.
# Arista Networks, Inc. Confidential and Proprietary.
"""
Example:
>>> sess = ssh.Session()
>>> sess.open("ck327", auth=("admin", ""))
>>> print(sess.send("show ver"))
@mathershifter
mathershifter / eossdk_helloworld_config.md
Last active November 13, 2020 23:48
EOSSDK HelloWorld configuration

EOSSDK Agent Install Example

copy the agent

host# chmod +x HelloWorld.py
host# scp HelloWorld.py admin@<switch>:/mnt/flash/HelloWorld

create the mount profile script

@mathershifter
mathershifter / docker-snat.md
Last active October 30, 2020 17:38
Example docker network to source packets from a specific IP address/interface

Example TOPO:

[      Node A     ]           [        Node B       ]           [     Node C      ]
[Lo0:1.1.1.1] [et0] <- Eth -> [et0] lo0:1.1.1.2 [et1] <- Eth -> [et1] [lo0:1.1.1.3]

Note: EtX interface IP addresses are not advertised; packets must be sourced from a loopback interface to make a successful round trip.

Sample Script

# Example:
#
# source ceoslab.rc
#
# run-netc ceos1-net
# run-netc ceos2-net
#
# for i in `seq 1 16`
# do
# link-netc ceos1-net ceos2-net eth${i} eth${i}
@mathershifter
mathershifter / tunnelmon.go
Last active August 14, 2020 20:25
Golang eAPI example
package main
import (
"fmt"
"net"
"github.com/aristanetworks/goeapi"
)
type ShowIsisDatabase struct {
@mathershifter
mathershifter / eapiclient.py
Last active November 16, 2021 20:40
Python3 eAPI client with no external dependencies
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) 2020 Arista Networks, Inc. All rights reserved.
# Arista Networks, Inc. Confidential and Proprietary.
"""Simple EAPI Client
API Usage:
import eapiclient