Slackware HowTo

Configure policy routing with ip rule on Slackware

Route different traffic through different gateways based on source or a dedicated table.

1. When to use it

Useful on multihomed hosts, separated management networks, or appliances where traffic must leave through specific links.

ip rule | rt_tables | source routing | multi-homing | gateway

2. Base setup

echo '100 mgmt' >> /etc/iproute2/rt_tables
ip rule add from 192.168.10.20 table mgmt
ip route add default via 192.168.10.1 dev eth1 table mgmt

Adjust host names, IPs, interfaces, paths, and versions to the real system before making the change persistent.

3. Quick verification

ip rule show
ip route show table mgmt
ip route get 8.8.8.8 from 192.168.10.20

Confirm that the output matches the expected state before considering the intervention complete.

4. Operational notes

Always document each rule: without notes, policy routing becomes opaque very quickly even to the person who created it.

Quick checklist

[ ] Steps completed\n[ ] Config updated\n[ ] Tests executed\n[ ] Rollback ready\n[ ] Logs checked

Back to Linux HowTo