Skip to content

Instantly share code, notes, and snippets.

View John-Lin's full-sized avatar
👋
hi

Che-Wei Lin John-Lin

👋
hi
View GitHub Profile
@John-Lin
John-Lin / simple_loop.py
Last active November 6, 2025 12:39
Mininet Simple Topology
#!/usr/bin/python
from mininet.topo import Topo
from mininet.cli import CLI
from mininet.net import Mininet
from mininet.util import dumpNodeConnections
from mininet.log import setLogLevel
from mininet.node import RemoteController
#!/usr/bin/env python
"""Run `snort -A console` command using a pipe.
Warning! Alerts are delayed until snort's stdout buffer is flushed.
"""
from __future__ import print_function
from subprocess import Popen, PIPE, STDOUT
snort_process = Popen(['snort', '-A', 'console', '-c', 'snort.conf'],
stdout=PIPE, stderr=STDOUT, bufsize=1,
@John-Lin
John-Lin / Jakefile
Last active May 30, 2016 07:04
iperf command alias
namespace('iperf', function () {
desc('Iperf server receiving 64 byte');
task('s64', { async: true }, function () {
var cmds = ['iperf -s -u -l 64 -i 1'];
jake.exec(cmds, { interactive: true }, function () {
complete();
});
});
desc('Iperf server receiving 128 byte');
@John-Lin
John-Lin / Vagrantfile
Created May 2, 2017 07:20
OVS with Docker Networking
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provider "virtualbox" do |vb|
vb.customize ['modifyvm', :id, '--nictype1', 'Am79C973']
vb.customize ['modifyvm', :id, '--nicpromisc1', 'allow-all']
end
config.vm.provision :shell, path: "bootstrap.sh"
end
@John-Lin
John-Lin / Vagrantfile
Created May 2, 2017 15:51
OVS with Docker Networking (GUI)
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/xenial64"
config.vm.provider "virtualbox" do |vb|
vb.gui = true
vb.customize ['modifyvm', :id, '--nictype1', 'Am79C973']
vb.customize ['modifyvm', :id, '--nicpromisc1', 'allow-all']
end
config.vm.provision :shell, path: "bootstrap.sh"
@John-Lin
John-Lin / ovs
Created May 14, 2017 04:10
An overview of Open vSwitch implementation
+---------+ +-----------+
|ovs-ofctl| |sFlow Trend|
+----^----+ +-----^-----+
| | Remote
+-----------------------------------------------------------------------------------------------+
| |
| sFlow |
| | +---------+ +----------+ +---------+ +------------+
| | |ovs-dpctl| |ovs-appctl| |ovs-vsctl| |ovsdb-client|
| | +----+----+ +------^---+ +-----+---+ +-------^----+
@John-Lin
John-Lin / benchmark.md
Last active October 25, 2017 11:54
Performance loss with VXLAN in OVS

Network performance testing tool

iperf

HOST to HOST

iperf -c 10.240.0.2 -p 12345 -i 1 -t 10 -w 20K

iperf -s -p 12345 -i 1 -M
@John-Lin
John-Lin / nswitch.py
Created September 8, 2017 15:48
SDN application for NORMAL action
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3
class Switch(app_manager.RyuApp):
OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
@John-Lin
John-Lin / Minikube.md
Created December 9, 2017 11:26
How to Minikube

Minikube

Installation

$ curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.24.0/minikube-darwin-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

Quickstart

@John-Lin
John-Lin / Kubeflow.md
Last active November 10, 2022 19:31
Kubeflow on Minikube

Deploy Kubeflow on Minikube

Install minikube

Please see How to Minikube

Running a minikube with 4CPUs and 8GB memory

$ minikube start --cpus 4 --memory 8192