跳到主要內容

Linux Traffic Control 讀書筆記

http://linux-ip.net/articles/Traffic-Control-HOWTO/components.html


4.1. qdisc

For traffic accepted on an interface, the ingress qdisc is traversed. With its limited utility, it allows no child class to be created, and only exists as an object onto which a filter can be attached. For practical purposes, the ingress qdisc is merely a convenient object onto which to attach a policer to limit the amount of traffic accepted on a network interface.

In short, you can do much more with an egress qdisc because it contains a real qdisc and the full power of the traffic control system. An ingress qdisc can only support a policer. The remainder of the documentation will concern itself with traffic control structures attached to the root qdisc unless otherwise specified.


刪除 eth0 上的 filter
sudo tc qdisc del dev eth0 root
sudo tc qdisc del dev eth0 ingress


tc filter show dev eth0 ingress
tc filter show dev eth0 egress

留言

這個網誌中的熱門文章

scapy + python 好用的封包產生器,快速生成 udp packet

範例:  往 192.168.10.10 打 udp packet , src ip 是 192.168.1.0 .. 遞增 1024,UDP dest port 是 8001~8010, UDP src port  是 10001 ~ 10010, payload 是 'hello world',packet 從 eth0 出去 import struct, socket from scapy.all import *  #在這邊用  all 速度會變慢一些 ip2int = lambda ipstr: struct.unpack('!I', socket.inet_aton(ipstr))[0] int2ip = lambda n: socket.inet_ntoa(struct.pack('!I', n)) src_ip_base="192.168.1.0" src_ip_list=[ int2ip(a+ip2int("192.168.1.0")) for a in range(1024)] payload='hello world' packet=Ether(dst="00:e0:4c:68:00:66",src="00:1e:8c:74:b9:47")/ \        IP(dst="192.168.10.10",src=src_ip_list)/ \        UDP(sport=[i+10001 for i in range(10)],dport=[i+8001 for i in range(10)])/ \        payload sendp(packet,iface="eth0")

Python 1900-01-01 到 1970-01-01 時間相減,用秒數呈現

最近剛好需要計算時間差之間的秒數,在 Shell 上可以用 date +%s 這指令輕易地算出 1970-01-01 到現在的秒數,不過在 1970-01-01 之前的就不知道怎麼用 Shell 處理,於是找了 Python 的 datetime module 來協助...筆記一下 import datetime t = datetime.datetime(1970, 1, 1, 0, 0) (t-datetime.datetime(1900,1,1)).total_seconds()