How to delete a routing policy rule with ip rule

Deleting a routing policy rule with ip rule del removes one selector from the routing policy database so matching traffic stops consulting that alternate table. This matters when a temporary source-based rule is no longer needed or when a misapplied rule is overriding the expected path.

Policy-routing rules are evaluated by preference, with lower numeric priorities checked first. The delete command must match the installed rule closely enough for the kernel to remove the intended selector, so the current rule list should be inspected before building the delete command.

Deleting the wrong rule can restore traffic to the main table, bypass a custom path, or remove one of the built-in RPDB lookups if a default rule is targeted by mistake. Remove the same rule from persistent network configuration too if it was created by network scripts, a VPN client, or a network manager profile.

Steps to delete a routing policy rule with ip rule:

  1. Show the current policy-routing rules and identify the exact selector, table, and priority that should be removed.
    $ ip rule show
    0:	from all lookup local
    1000:	from 192.0.2.10 lookup 100
    32766:	from all lookup main
    32767:	from all lookup default

    Lower numeric priorities are evaluated first, so deleting the wrong low-numbered rule can change routing before the main table is reached.

  2. Delete the target rule by matching the installed selector and priority.
    $ sudo ip rule delete from 192.0.2.10/32 table 100 priority 1000

    Do not delete the built-in local, main, or default rules unless that behavior is explicitly intended.

  3. Verify that the rule no longer appears.
    $ ip rule show
    0:	from all lookup local
    32766:	from all lookup main
    32767:	from all lookup default
  4. Remove the same rule from the system's persistent network configuration if it would otherwise be recreated later.

    Runtime `ip rule del` changes the live RPDB only; a distro network profile, boot script, VPN hook, or automation job can add the rule back after interface restart or reboot.