Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

CentOS 5, i manually added a static route to an ip to use the second network interface like so:

ip route add 123.456.7.89/32 via dev eth1

is there a way to make this change be persistent upon reboot without adding it to startup script /etc/rc.d/rc.local ?


share|improve this question

migrated from Feb 1 '10 at 13:13

This question came from our site for professional and enthusiast programmers.

2 Answers 2

Yes. Add the line

123.456.7.89/32 via dev eth1

to /etc/sysconfig/netowrk-scripts/route-eth1 as shown here:

BTW, this was the very first hit from googling “CentOS route”

share|improve this answer
thanks, much appreciated. I did a lot of googling but it seems I skip this one, way too many tabs opened :) –  Dragos Feb 1 '10 at 13:09

White the above answer works, the current preffered format for /etc/sysconfig/network-scripts/route-ethX is:


Be sure to increment the value of the numeral when you add a route. Unfortunately, the new preferred format of GATEWAYX:/ADDRESSx:/NETMASKx:/ makes harder to programmatically add static routes via the older format of " via", yes it can be worked around, but adds unnecessary complications to scripting routes.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.