Permanently add static network route

John Schmerold

Well-Known Member
Apr 21, 2004
81
6
158
st. louis
cPanel Access Level
Root Administrator
I want to add a static route on my Centos7.5/cPanel v76.0.0 server, this works:
ip route add 192.168.101.0/24 via 192.168.35.1 dev ens224

How do I turn this into a permanent route?

I have tried creating /etc/sysconfig/network-scripts/route-ens224, no joy
 

dalem

Well-Known Member
PartnerNOC
Oct 24, 2003
2,984
159
368
SLC
cPanel Access Level
DataCenter Provider
your method is correct
But I tested on one of our own boxes and no joy as well
Must be something to do with the private network being on a dumb switch and no real gateway set up (guessing) or that the network manager is messing it up


workaround
add
ip route add 192.168.101.0/24 via 192.168.35.1 dev ens224

to /etc/rc.d/rc.local

chmod +x /etc/rc.d/rc.local

reboot