This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"io" | |
"log" | |
"net" | |
"net/http" | |
"sync" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""etcd3 Leader election.""" | |
import sys | |
import time | |
from threading import Event | |
import etcd3 | |
LEADER_KEY = '/leader' | |
LEASE_TTL = 5 | |
SLEEP = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### dhcp example | |
ovs-appctl ofproto/trace br-int in_port=7,udp,dl_src=fa:16:3e:f4:bd:de,dl_dst=ff:ff:ff:ff:ff:ff,nw_dst=255.255.255.255,udp_dst=67,udp_src=68 | |
Megaflow: recirc_id=0,udp,tun_id=0,in_port=7,dl_src=fa:16:3e:f4:bd:de,dl_dst=ff:ff:ff:ff:ff:ff,nw_ecn=0,nw_frag=no,tp_src=68,tp_dst=67 | |
Datapath actions: tnl_push(tnl_port(2),header(size=50,type=4,eth(dst=52:54:00:9b:2f:62,src=1e:36:0f:9e:1d:41,dl_type=0x0800),ipv4(src=11.0.0.21,dst=11.0.0.26,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=4789,csum=0x0),vxlan(flags=0x8000000,vni=0x138a)),out_port(4)),tnl_push(tnl_port(2),header(size=50,type=4,eth(dst=2a:da:01:b8:5f:46,src=1e:36:0f:9e:1d:41,dl_type=0x0800),ipv4(src=11.0.0.21,dst=11.0.0.28,proto=17,tos=0,ttl=64,frag=0x4000),udp(src=0,dst=4789,csum=0x0),vxlan(flags=0x8000000,vni=0x138a)),out_port(4)) | |
###vxlan packet | |
ovs-appctl ofproto/trace br-int in_port=4, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yum --enablerepo=base-debuginfo install -y kernel-debuginfo-$(uname -r) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ns0 | |
ip netns del natns0 | |
ip netns add natns0 | |
ip netns exec natns0 ip link set lo up | |
ip link add natp0 type veth peer name natp0p | |
ip link set natp0 netns natns0 | |
ip link set natp0p up | |
ip netns exec natns0 ip link set natp0 up | |
ip netns exec natns0 ip link set natp0 address 80:88:88:88:88:88 | |
ip netns exec natns0 ip addr add 10.1.1.1/24 dev natp0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Compile: | |
* | |
* gcc sctptest.c -o server -lsctp -Wall | |
* ln -s server client | |
* | |
* Invoke: | |
* | |
* ./client | |
* ./server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
//#include<stdio.h> | |
//void inC() { | |
// printf("I am in C code now!\n"); | |
//} | |
import "C" | |
import "fmt" | |
func main() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$4" == "" ]; then | |
echo "usage: $0 <local_ip> <remote_ip> <new_local_ip> <new_remote_ip>" | |
echo "creates an ipsec tunnel between two machines" | |
exit 1 | |
fi | |
SRC="$1"; shift | |
DST="$1"; shift |