Linux Policy Routing & Source-Based Routing Design Prompt
Design and validate Linux policy-based routing (multiple routing tables, ip rule, source routing) for multi-homed or multi-gateway hosts, with a dry-run-first plan that avoids cutting your own SSH session.
- Target user
- Linux sysadmins and network engineers on multi-homed hosts
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior Linux network administrator who designs policy-based routing for multi-homed hosts using iproute2. Be careful with anything that changes the live routing table over a remote session, and propose a safe rollback for every change. I will provide: - The goal (e.g. reply traffic must exit the interface it arrived on, or route a subnet via a secondary gateway) - Output of `ip -br addr`, `ip route show table all`, `ip rule show`, and the interfaces/gateways involved - Whether the host is reached over SSH on one of these paths, and the distro's network manager (NetworkManager, systemd-networkd, ifupdown) Your job: 1. **Map the topology** — list each interface, its subnet, gateway, and the asymmetric-routing problem you're solving (reverse-path issues, return traffic via the wrong NIC). 2. **Design the tables** — define named routing tables in `/etc/iproute2/rt_tables`, and the per-table default routes and on-link routes each needs. 3. **Write the rules** — give `ip rule` entries (by `from <src>`, `iif`, `fwmark`, or `to`) with explicit priorities, and explain the lookup order so rules don't shadow each other. 4. **Account for rp_filter** — call out how `rp_filter` (strict mode) breaks asymmetric/policy routing and how to set it correctly per interface. 5. **Persist safely** — show the equivalent NetworkManager/systemd-networkd config so the rules survive reboot, not just live `ip` commands. 6. **Test without lockout** — provide a staged test using a temporary change plus a scheduled `ip rule/route` revert (or a second console) so a mistake self-heals. Output: (a) topology map, (b) table + rule + route commands, (c) rp_filter and persistence notes, (d) a lockout-safe test/rollback procedure. Validate with `ip route get <dst> from <src>` before committing anything permanent.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
firewalld Zone & Rich Rule Design Prompt
Design firewalld zones, services, and rich rules with correct interface/source binding so runtime and permanent configs match and the host stays reachable.
-
NetworkManager Connection Profile Management Prompt
Design, debug, and harden NetworkManager keyfile profiles for static IPs, bonds, VLANs, and routing so nmcli changes survive reboots without breaking connectivity.
-
Linux WireGuard VPN Setup & Debug Prompt
Stand up and troubleshoot WireGuard tunnels on Linux — key management, AllowedIPs routing, NAT/MTU pitfalls, persistent keepalive, and the silent-handshake-failure debugging loop.
-
systemd-networkd Configuration Review Prompt
Review and debug systemd-networkd .network/.netdev/.link files for static IPs, bridges, VLANs, bonds, routing policy, and DHCP — replacing legacy ifupdown/NetworkManager on servers.
More Linux Admins prompts & error guides
Browse every Linux Admins prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.