TC-ROUTE(8)

โœจ Route classifier in tc(8) โœจ

okay bestie, let's talk about the route filter! ๐ŸŽ€ It's a traffic control filter for tc(8), and it's the one that sorts packets by their routing table entries ๐Ÿฆ‹

๐Ÿ’– NAME

route - route traffic control filter

๐Ÿงš SYNOPSIS

tc filter ... route [ from REALM | fromif TAG ] [ to REALM ] [ classid
        CLASSID ] [ action ACTION_SPEC ]

๐ŸŒธ DESCRIPTION

Match packets based on routing table entries. โœจ The whole vibe of this filter is that you can give a routing table entry a realm ๐Ÿ‘‘ For any packet this filter looks at, it does a routing table lookup, grabs the returned realm, and uses that to decide whether the packet is a match or not ๐Ÿ’…

๐Ÿ’œ OPTIONS

  • action ACTION_SPEC โ€” slap an action from the generic actions framework onto every matching packet โœจ
  • classid CLASSID โ€” yeet matching packets straight into the class identified by CLASSID ๐Ÿš€
  • from REALM
  • fromif TAG โ€” do source route lookups ๐Ÿ” TAG is the name of an interface, and it has to actually exist on the system when you run tc or it's a no-go ๐Ÿ™ˆ
  • to REALM โ€” match if the normal (aka destination) routing hands back the given REALM ๐Ÿฆ‹

๐ŸŽ€ EXAMPLES

Okay so imagine the subnet 192.168.2.0/24 is attached to eth0 ๐ŸŒˆ

ip route add 192.168.2.0/24 dev eth0 realm 2

Next up, this route filter will catch packets from that subnet ๐Ÿซถ

tc filter add ... route from 2 classid 1:2

and then it passes them along to class 1:2. Iconic. ๐Ÿ’…โœจ

โญ NOTES

โš ๏ธ Heads up! Due to implementation details, realm values have to be in a range from 0 to 255, inclusive. No going outside that range ๐Ÿ˜ญ Alternatively, you can use a verbose name defined in /etc/iproute2/rt_realms instead, which is lowkey so much easier to read ๐Ÿ“

๐ŸŒˆ SEE ALSO

tc(8), ip-route(8) ๐Ÿ’œ


Thanks for hanging with me through this one, bestie! ๐Ÿซถ iproute2 ยท 21 Oct 2015 ยท Route classifier in tc(8) ๐Ÿ’–

๐Ÿ“ฆ where this page comes from