TC-XT(8)

๐Ÿ“ฆ
version 6.1.0 ยท 2 versions
, in debian bookworm, ubuntu noble

โœจ xt โ€” tc iptables action โœจ

okay bestie, pull up a chair because we're talking about the xt action from the iptables action in tc(8) manual ๐Ÿ’… yes that's the whole name, she's long but she's iconic.


๐ŸŒธ NAME ๐ŸŒธ

xt โ€” the tc iptables action ๐Ÿฆ‹


๐ŸŽ€ SYNOPSIS ๐ŸŽ€

tc ... action xt -j TARGET [ TARGET_OPTS ]

๐Ÿ’– DESCRIPTION ๐Ÿ’–

okay so here's the tea: the xt action is your little backstage pass ๐ŸŽŸ๏ธ it lets you call arbitrary iptables targets for the packets that match the filter this action is attached to. that's it, that's the whole vibe. match a filter โ†’ jump into iptables target land. no cap. ๐Ÿ”ฅ


โœจ OPTIONS โœจ

  • -j TARGET [ TARGET_OPTS ] โ€” do a lil jump into the iptables target you name in TARGET, and if you want you can also pass along any target-specific options in TARGET_OPTS. literally just "hey kernel, go here, and take these with you" ๐Ÿซถ

๐ŸŒˆ EXAMPLES ๐ŸŒˆ

okay this one is genuinely so fun. the following will attach a u32 filter to the ingress qdisc, matching ICMP replies, and then use the xt action to make the kernel yell 'PONG' every single time ๐Ÿ˜ญ๐Ÿ“ it's giving ping-pong but the kernel is the one talking back.

tc qdisc add dev eth0 ingress
tc filter add dev eth0 parent ffff: proto ip u32 \
     match ip protocol 1 0xff \
     match ip icmp_type 0 0xff \
     action xt -j LOG --log-prefix PONG

obsessed with her honestly ๐Ÿ‘‘


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

tc(8), tc-u32(8), iptables-extensions(8) โ€” go read these too, bestie, they're the supporting cast ๐Ÿ’œ


that's a wrap, babe ๐Ÿ’… this page came from the iproute2 girlies, dated 3 Mar 2016, and it lives in the iptables action in tc(8) section of the manual. periodt. โœจ๐Ÿ’–๐ŸŽ€

๐Ÿ“ฆ where this page comes from