IP Route Cheat Sheet Across Vendors
As a network admin you jump between vendors all day long, and every box wants a slightly different incantation for the same four operations: show the routing table, add a static route, set a default route, remove one. This is a quick reference for the boxes I see most often.
All examples route the prefix 10.0.0.0/24 via the gateway 192.168.1.1. Adjust to taste.
Linux (iproute2)
- Show:
ip route(add-6for IPv6,-dfor details,-jfor JSON) - Add:
ip route add 10.0.0.0/24 via 192.168.1.1 - Add via interface:
ip route add 10.0.0.0/24 dev eth0 - Default:
ip route add default via 192.168.1.1 - Delete:
ip route del 10.0.0.0/24
The old route command still works on ancient systems but is deprecated:
route -n
route add -net 10.0.0.0/24 gw 192.168.1.1
route add default gw 192.168.1.1
Linux routes are not persistent. Put them into /etc/network/interfaces, a NetworkManager connection, a systemd-networkd .network file, or a plain /etc/rc.local line, depending on your distribution.
Cisco IOS / IOS XE
Config mode. Uses dotted decimal masks, not CIDR. The one thing everyone else eventually fixed and Cisco didn't.
- Show:
show ip route(show ipv6 route,show ip route static,show ip route 10.0.0.0) - Add:
ip route 10.0.0.0 255.255.255.0 192.168.1.1 - Default:
ip route 0.0.0.0 0.0.0.0 192.168.1.1 - Delete:
no ip route 10.0.0.0 255.255.255.0 192.168.1.1 - Persist:
writeorcopy running-config startup-config
Cisco NX-OS (Nexus)
Looks like IOS but accepts CIDR. For non-default VRFs, enter the VRF context first.
- Show:
show ip route(show ip route vrf <name>) - Add:
ip route 10.0.0.0/24 192.168.1.1 - Default:
ip route 0.0.0.0/0 192.168.1.1 - Delete:
no ip route 10.0.0.0/24 192.168.1.1 - Persist:
copy running-config startup-config
Non-default VRF:
vrf context MGMT
ip route 10.0.0.0/24 192.168.1.1
Arista EOS
Cisco-like CLI, but CIDR works natively. Also has a real Linux shell underneath (bash) if you need one.
- Show:
show ip route - Add:
ip route 10.0.0.0/24 192.168.1.1 - Default:
ip route 0.0.0.0/0 192.168.1.1 - Delete:
no ip route 10.0.0.0/24 - Persist:
writeorcopy running-config startup-config
Dell OS10 (PowerSwitch)
Close to Cisco with CIDR.
- Show:
show ip route - Add:
ip route 10.0.0.0/24 192.168.1.1 - Default:
ip route 0.0.0.0/0 192.168.1.1 - Delete:
no ip route 10.0.0.0/24 - Persist:
copy running-configuration startup-configuration
Older Dell boxes running OS9 (FTOS) use the same command shape but copy running-config startup-config.
HPE FlexFabric (Comware 7)
Comware speaks display and undo instead of show and no. The mask is a prefix length written as its own argument, without a slash.
- Show:
display ip routing-table(display ipv6 routing-table) - Add:
ip route-static 10.0.0.0 24 192.168.1.1 - Default:
ip route-static 0.0.0.0 0 192.168.1.1 - Delete:
undo ip route-static 10.0.0.0 24 192.168.1.1 - Persist:
save
Juniper JunOS
Junos is transactional — you edit a candidate config and commit it. Rollback is one command. Worth switching for that feature alone.
- Show (operational mode):
show route,show route protocol static,show route table inet6.0 - Add (configuration mode):
set routing-options static route 10.0.0.0/24 next-hop 192.168.1.1
commit
- Default:
set routing-options static route 0.0.0.0/0 next-hop 192.168.1.1 - Delete:
delete routing-options static route 10.0.0.0/24thencommit - Discard pending changes:
rollback
MikroTik RouterOS
- Show:
/ip route print - Show active only:
/ip route print where active - Add:
/ip route add dst-address=10.0.0.0/24 gateway=192.168.1.1 - Default:
/ip route add dst-address=0.0.0.0/0 gateway=192.168.1.1 - Delete:
/ip route remove [find dst-address=10.0.0.0/24]
Routes are persistent as soon as you add them. Winbox works too, but the CLI is faster once you know it.
FortiOS (FortiGate)
No surprise, Fortinet does it their own way. Two views: the routing-information-base (FIB) and the static-route config tree.
- Show FIB:
get router info routing-table all(or... static,... connected) - Show static config:
show router static - Add:
config router static
edit 0
set dst 10.0.0.0 255.255.255.0
set gateway 192.168.1.1
set device "port1"
next
end
- Default: same as above but with
set dst 0.0.0.0 0.0.0.0 - Delete:
config router static
delete <id>
end
<id> is the sequence number you see in show router static. There is no no shortcut, and edit 0 auto-assigns a new id.
F5 BIG-IP (TMOS)
TMSH, not Linux — even though you are sitting on a Linux box underneath and ip route would also "work" (but lies, because TMM owns the data plane).
- Show:
tmsh show net route(tmsh list net route) - Add:
tmsh create net route net-10 network 10.0.0.0/24 gw 192.168.1.1 - Default:
tmsh create net route default gw 192.168.1.1 - Delete:
tmsh delete net route net-10 - Persist:
tmsh save sys config
The default route object exists by convention — use modify instead of create if one is already there.
MacOS
BSD route, not iproute2.
- Show:
netstat -rn - Show default:
route -n get default - Add:
sudo route add -net 10.0.0.0/24 192.168.1.1 - Default:
sudo route add default 192.168.1.1 - Delete:
sudo route delete -net 10.0.0.0/24
These are not persistent across reboots. For permanent routes you have to write a LaunchDaemon or hook it to a networksetup/en0 event.
Windows
Two APIs for the same thing. route is the old one, netsh is the newer one. Both still ship.
- Show:
route print(ornetsh interface ipv4 show route) - Add:
route add 10.0.0.0 mask 255.255.255.0 192.168.1.1 - Persistent add:
route -p add 10.0.0.0 mask 255.255.255.0 192.168.1.1 - Default:
route add 0.0.0.0 mask 0.0.0.0 192.168.1.1 - Delete:
route delete 10.0.0.0
netsh variant — takes CIDR and requires the interface name:
netsh interface ipv4 add route prefix=10.0.0.0/24 interface="Ethernet" nexthop=192.168.1.1
Run from an elevated command prompt, obviously, or it fails silently with "The requested operation requires elevation".