Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i need to execute the following command on every startup

route add -net netmask dev eth0

so i add it to rc.local

touch /var/lock/subsys/local

route add -net netmask dev eth0

but i realise it is not being executed. Anyone knows what should it be.

share|improve this question

migrated from Apr 3 '12 at 2:20

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

Maybe this would be better in /etc/network/interfaces? – Kerrek SB Apr 2 '12 at 9:03

What happens when you run same command from command line?

There are three reasons I can guess why it may not be working. 1) route is not in the sys path on bootup....try specifying full path to route command on your system. 2) eth0 is not available at the point in time rc.local is running .... Trying adding a print ifconfig in cr.local to test. 3) the route statement is invalid, and the route program is ignoring it...running from command line should tell you

share|improve this answer
There's also 4) The route add ... line is added after the line exit 0 in /etc/rc.local – Didier Trosset Apr 2 '12 at 9:27

Your Answer


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