Recommended Services
Supported Scripts

Persistent static routes survive server reboots. On RHEL-based systems they can be configured via NetworkManager (nmcli — recommended on RHEL 8+) or legacy per-interface route files. This guide covers both approaches.

Method 1: nmcli (NetworkManager — Recommended for RHEL 8+/AlmaLinux/Rocky)

# Add a persistent route via nmcli
# Replace ens3 with your interface name (check with: ip link show)
nmcli connection modify ens3 +ipv4.routes "10.10.20.0/24 192.168.20.1"

# Apply without restarting the interface
nmcli connection up ens3

# Verify
nmcli connection show ens3 | grep ipv4.routes

Method 2: Route File (RHEL 7 / CentOS 7 Legacy)

Create a route file for your interface. If your interface is ens3, the file is /etc/sysconfig/network-scripts/route-ens3:

# Create the route file
vi /etc/sysconfig/network-scripts/route-ens3

# Add routes in the format: NETWORK/PREFIX via GATEWAY [dev INTERFACE]
10.10.20.0/24 via 192.168.20.1
10.10.30.0/24 via 192.168.20.2 dev ens3

Restart networking to apply:

# Apply without full network restart (preferred)
nmcli connection up ens3

# Or restart network service (CentOS 7 only)
systemctl restart network

Verify Persistent Routes Survive Reboot

# After reboot, check the route table
ip route show | grep 10.10.20

# Or verify via NetworkManager
nmcli connection show ens3 | grep route

Remove a Persistent Route

# nmcli method
nmcli connection modify ens3 -ipv4.routes "10.10.20.0/24 192.168.20.1"
nmcli connection up ens3

# Legacy file method: edit route-ens3 and remove the line, then restart network