Skip to content

Instantly share code, notes, and snippets.

@curtkim
Created November 9, 2014 02:05
Show Gist options
  • Save curtkim/528efe1f1f7bf81ec525 to your computer and use it in GitHub Desktop.
Save curtkim/528efe1f1f7bf81ec525 to your computer and use it in GitHub Desktop.
network namespace
from http://ko.sdndev.net/2
----------------------------
ip netns add netns1
ip netns exec netns1 ip link list
ip netns exec netns1 ping 127.0.0.1
ip netns exec netns1 ip link set dev lo up
ip link add veth0 type veth peer name veth1
ip link set veth1 netns netns1
ip netns exec netns1 ifconfig veth1 10.1.1.1/24 up
ifconfig veth0 10.1.1.2/24 up
ping 10.1.1.1
ip netns exec netns1 ping 10.1.1.2
ip netns exec netns1 route
ip netns exec netns1 iptables -L
---------------------------------------
ip netns add ns1
brctl addbr br-test
brctl stp br-test off
ip link set dev br-test up
ip link add tap1 type veth peer name br-tap1
brctl addif br-test br-tap1
ip link set tap1 netns ns1
ip netns exec ns1 ip link set dev tap1 up
ip link set dev br-tap1 up
ip link add tap2 type veth peer name br-tap2
brctl addif br-test br-tap2
ip link set dev tap2 up
ip link set dev br-tap2 up
from http://www.topwebhosts.org/tools/traffic-control.php
---------------------------------------------------------
TC=/sbin/tc
IF=eth0 # Interface
DNLD=1mbit # DOWNLOAD Limit
UPLD=1mbit # UPLOAD Limit
IP=216.3.128.12 # Host IP
U32="$TC filter add dev $IF protocol ip parent 1:0 prio 1 u32"
$TC qdisc add dev $IF root handle 1: htb default 30
$TC class add dev $IF parent 1: classid 1:1 htb rate $DNLD
$TC class add dev $IF parent 1: classid 1:2 htb rate $UPLD
$U32 match ip dst $IP/32 flowid 1:1
$U32 match ip src $IP/32 flowid 1:2
http://wiki.linuxwall.info/doku.php/en:ressources:dossiers:networking:traffic_control
http://www.xelloss.pe.kr/258
----------------------------
ethtool -s eth1 speed 10 duplex full autoneg on
http://blog.edseek.com/~jasonb/articles/traffic_shaping/
--------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment