carapace-sh/carapace-bin / skills/iproute2
iproute2
VerifiedUse when working with the Linux iproute2 networking commands — ip, ss, bridge, tc, and related tools. Covers the ip command argument structure, object types (address, link, route, rule, neighbour, tunnel, xfrm, netns, mptcp, ioam, l2tp, etc.), subcommands, selectors, and value types. Triggers on: "iproute2", "ip command", "ip address", "ip link", "ip route", "ip rule", "ip neighbour", "ip neigh", "ip tunnel", "ip xfrm", "ip netns", "ip mptcp", "ip ioam", "ip l2tp", "ip vrf", "ip token", "ip ntable", "ip tcp_metrics", "ip maddress", "ip mroute", "ip mrule", "ip addrlabel", "ip tuntap", "ip monitor", "ip stats", "ip nexthop", "ip netconf", "ip fou", "ip macsec", "ip sr", "ss command", "bridge command", "tc command", "IFADDR", "CONFFLAG", "SELECTOR", "ROUTE", "NUD state", "addrlabel", "ipproto".
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.7 KB |
| references/address.md | markdown | 3.7 KB |
| references/link.md | markdown | 4.6 KB |
| references/misc.md | markdown | 10.1 KB |
| references/neighbour.md | markdown | 2.3 KB |
| references/netns.md | markdown | 1.4 KB |
| references/overview.md | markdown | 4.7 KB |
| references/route.md | markdown | 5.4 KB |
| references/rule.md | markdown | 4.3 KB |
| references/tunnel.md | markdown | 2.8 KB |
| references/xfrm.md | markdown | 2.7 KB |
references/rule.md
View on GitHub# ip rule — Routing Policy Database
Manage routing policy rules — control which routing table is consulted for a given packet.
## Commands
| Command | Aliases | Description |
|---------|---------|-------------|
| `show` | `list`, `lst` | List rules (default) |
| `add` | — | Insert a new rule |
| `del` | `delete` | Delete a rule |
| `flush` | — | Flush all rules |
| `save` | — | Save rules table to stdout (raw) |
| `restore` | — | Restore rules table from stdin |
## SELECTOR (usable in show, add, del)
```
SELECTOR := [ not ] [ from PREFIX ] [ to PREFIX ] [ tos TOS ]
[ dscp DSCP[/MASK] ] [ fwmark FWMARK[/MASK] ] [ iif STRING ]
[ oif STRING ] [ priority PREFERENCE ] [ l3mdev ]
[ uidrange NUMBER-NUMBER ] [ ipproto PROTOCOL ]
[ sport [ NUMBER[/MASK] | NUMBER-NUMBER ] ]
[ dport [ NUMBER[/MASK] | NUMBER-NUMBER ] ]
[ tun_id TUN_ID ] [ flowlabel FLOWLABEL[/MASK] ]
```
| Keyword | Aliases | Value Type | Description |
|---------|---------|------------|-------------|
| `not` | — | *(prefix modifier)* | Negate the following selector (no value) |
| `from` | — | `PREFIX` | Source prefix to match |
| `to` | — | `PREFIX` | Destination prefix to match |
| `tos` | `dsfield` | `TOS` | TOS/DSCP value |
| `dscp` | — | `DSCP[/MASK]` | DSCP value with optional mask |
| `fwmark` | — | `FWMARK[/MASK]` | Firewall mark (optional mask) |
| `iif` | — | `STRING` | Incoming interface name |
| `oif` | — | `STRING` | Outgoing interface name |
| `priority` | `preference`, `order` | `NUMBER` | Rule priority |
| `l3mdev` | — | *(boolean)* | Match on L3 master device (no value) |
| `uidrange` | — | `NUMBER-NUMBER` | UID range |
| `ipproto` | — | `PROTOCOL` | IP protocol (name or number) |
| `sport` | — | `NUMBER[/MASK]` or `NUMBER-NUMBER` | Source port, port with mask, or range |
| `dport` | — | `NUMBER[/MASK]` or `NUMBER-NUMBER` | Destination port, port with mask, or range |
| `tun_id` | — | `TUN_ID` | Tunnel ID |
| `flowlabel` | — | `FLOWLABEL[/MASK]` | Flow label with optional mask |
### ipproto Values
IP protocol names from `/etc/protocols`:
```
ah | dccp | egp | eigrp | esp | gre | hopopt | icmp | icmpv6 | igmp |
igp | ipcomp | ipip | ipv6 | ipv6-frag | ipv6-icmp | ipv6-nonxt |
ipv6-opts | ipv6-route | l2tp | ospf | pim | rsvp | rspd | sctp |
st | tcp | udp | udplite | vrrp
```
## ACTION (only in add/del, NOT in show)
```
ACTION := [ table TABLE_ID ] [ protocol PROTO ] [ nat ADDRESS ]
[ realms [SRCREALM/]DSTREALM ] [ goto NUMBER ] SUPPRESSOR
```
| Keyword | Aliases | Value Type | Description |
|---------|---------|------------|-------------|
| `table` | `lookup` | `TABLE_ID` | Routing table to consult |
| `protocol` | `proto` | `PROTO` | Routing protocol |
| `nat` | `map-to` | `ADDRESS` | Source NAT address |
| `realms` | — | `[SRCREALM/]DSTREALM` | Routing realms |
| `goto` | — | `NUMBER` | Jump to rule by priority |
### TABLE_ID
`local` | `main` | `default` | `all` | `NUMBER`
### protocol Values
`kernel` | `boot` | `static` | `NUMBER`
## SUPPRESSOR (part of ACTION, not a selector)
```
SUPPRESSOR := [ suppress_prefixlength NUMBER ] [ suppress_ifgroup GROUP ]
```
| Keyword | Value Type | Description |
|---------|------------|-------------|
| `suppress_prefixlength` | `NUMBER` | Reject routes with prefix length <= N |
| `suppress_ifgroup` | `GROUP` | Reject routes using device in interface group |
## type (rule type, part of ACTION)
| Value | Description |
|-------|-------------|
| `unicast` | Normal rule (default) |
| `blackhole` | Silently drop |
| `unreachable` | Drop with ICMP unreachable |
| `prohibit` | Drop with ICMP prohibited |
| `nat` | Network address translation |
## Selector vs Action Summary
| Category | Keywords |
|----------|----------|
| **Selectors** (show/add/del) | `not`, `from`, `to`, `tos`, `dsfield`, `dscp`, `fwmark`, `iif`, `oif`, `priority`, `preference`, `order`, `l3mdev`, `uidrange`, `ipproto`, `sport`, `dport`, `tun_id`, `flowlabel` |
| **Actions** (add/del only) | `table`, `lookup`, `protocol`, `proto`, `nat`, `map-to`, `realms`, `goto`, `type`, `suppress_prefixlength`, `suppress_ifgroup` |
| **Boolean** (no value) | `not` (prefix modifier), `l3mdev` (flag) |
## References
- [ip-rule(8)](https://man7.org/linux/man-pages/man8/ip-rule.8.html)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |