TC-SIMPLE(8)
โจ TC-SIMPLE(8) โจ
Simple action in tc(8) ๐ the bestie of tc actions, fr
๐ NAME
simple - basic example action ๐ง
๐ธ SYNOPSIS
tc ... action simple [ sdata STRING ] [ index INDEX ] [ CONTROL ]
CONTROL := { reclassify | pipe | drop | continue | ok }
๐ DESCRIPTION
okay so this one is a pedagogical example, aka it's literally here to teach you how actions work, not to be useful in your daily life ๐ญ no shade tho. Every single time it gets accessed, it prints the STRING you gave it, and that string can be any length you want ๐ซถ
โจ OPTIONS โจ
sdata STRINGโ the actual string it prints ๐จ๏ธindex INDEXโ an optional action index value ๐ขCONTROLโ tellstcwhat to do next once the action is done running. For the full tea on the possibleCONTROLvalues, peeptc-actions(8)๐
๐ฆ EXAMPLES
this example makes the kernel yell "Incoming ICMP!" every time it spots an incoming ICMP packet on eth0. The vibe check goes like this:
- Add an ingress qdisc point to eth0 ๐
- Start a chain on ingress of eth0 that first matches ICMP, then calls the simple action to shout ๐ข
- Display stats and show that no packet has been seen by the action (zero, bestie, zero) ๐
- Send one ping packet to google (expect to get a response back) ๐
- Grep the logs to see the logged message ๐
- Display stats again and observe the increment by 1 โญ
$ tc qdisc add dev eth0 ingress
$ tc filter add dev eth0 parent ffff: protocol ip prio 5 \
u32 match ip protocol 1 0xff flowid 1:1 action simple sdata "Incoming ICMP"
$ sudo tc -s filter ls dev eth0 parent ffff:
filter protocol ip pref 5 u32
filter protocol ip pref 5 u32 fh 800: ht divisor 1
filter protocol ip pref 5 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1
match 00010000/00ff0000 at 8
action order 1: Simple <Incoming ICMP>
index 4 ref 1 bind 1 installed 29 sec used 29 sec
Action statistics:
Sent 0 bytes 0 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
$ ping -c 1 www.google.ca
PING www.google.ca (74.125.225.120) 56(84) bytes of data.
64 bytes from ord08s08-in-f24.1e100.net (74.125.225.120): icmp_req=1 ttl=53 time=31.3 ms
--- www.google.ca ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 31.316/31.316/31.316/0.000 ms
$ dmesg | grep simple
[135354.473951] simple: Incoming ICMP_1
$ sudo tc/tc -s filter ls dev eth0 parent ffff:
filter protocol ip pref 5 u32
filter protocol ip pref 5 u32 fh 800: ht divisor 1
filter protocol ip pref 5 u32 fh 800::800 order 2048 key ht 800 bkt 0 flowid 1:1
match 00010000/00ff0000 at 8
action order 1: Simple <Incoming ICMP>
index 4 ref 1 bind 1 installed 206 sec used 67 sec
Action statistics:
Sent 84 bytes 1 pkt (dropped 0, overlimits 0 requeues 0)
backlog 0b 0p requeues 0
๐ซถ SEE ALSO
iproute2 ยท 12 Jan 2015 ยท Linux ๐ that's a wrap, bestie, you're literally a Unix legend now ๐โจ
๐ฆ where this page comes from
- alpine 3.22: iproute2-doc 6.15.0-r0 ยท GPL-2.0-or-later
- alpine 3.23: iproute2-doc 6.17.0-r0 ยท GPL-2.0-or-later
- alpine 3.24: iproute2-doc 7.0.0-r0 ยท GPL-2.0-or-later
- arch rolling: iproute2 7.2.0-1
- arch rolling: iproute2 7.3.0-1 ยท GPL-2.0-or-later
- centos-stream 10: iproute-tc 7.0.0-2.el10 ยท GPL-2.0-or-later
- centos-stream 9: iproute-tc 6.17.0-3.el9 ยท GPL-2.0-or-later
- debian trixie: iproute2 6.15.0-1 ยท GPL-2.0-only
- fedora 43: iproute-tc 6.14.0-2.fc43 ยท GPL-2.0-or-later
- fedora 44: iproute-tc 6.17.0-2.fc44 ยท GPL-2.0-or-later
- nixos 26.05: iproute2 7.0.0
- nixpkgs unstable: iproute2 7.2.0
- opensuse-leap 16.0: iproute2 6.12-160000.4.1 ยท GPL-2.0-only
- opensuse-leap 16.0: iproute2 6.12-160000.4.1 ยท GPL-2.0-only
- opensuse-leap 16.0: iproute2 6.12-160000.4.1 ยท GPL-2.0-only
- opensuse-leap 16.0: iproute2 6.12-160000.4.1 ยท GPL-2.0-only
- ubuntu questing: iproute2 6.16.0-1ubuntu2
- ubuntu questing: iproute2 6.16.0-1ubuntu2.1 ยท GPL-2.0-only
- ubuntu questing: iproute2 6.16.0-1ubuntu2.2
- ubuntu resolute: iproute2 6.19.0-1ubuntu1 ยท GPL-2.0-only
- ubuntu resolute: iproute2 6.19.0-1ubuntu1.1 ยท GPL-2.0-only
- ubuntu stonking: iproute2 7.2.0-1ubuntu1 ยท GPL-2.0-only
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms