howto make additional routes permanent

If you need some help, this should be the first place to look.

Postby dingetje » Fri Apr 02, 2004 4:27 am

Problem
If I use the command "route add -net x.y.z.t netmask a.b.c.d ... ethx",
the route is added only until next reboot. :-(

Is there a way ( via setup or other ) to add PERMANENTLY a route ?


Solution
Add the 'route' command to the /rc/rc_user script.

For FREESCO 027 this script has a start and a stop section, see comments:

Code: Select all
echo -n "Starting rc_user...                    "
# Add commands here you want to execute when booting. Use the fork
# command to launch programs which normally stay in the foreground.
route add -net x.y.z.t netmask a.b.c.d ... ethx


Code: Select all
echo -n "Stopping rc_user...                    "
# Add commands here you want to execute when shutting down or rebooting.
# Be careful not to use any commands which wait for user input.
route del x.y.z.t


For FREESCO 03x, the script has a switch statement, with clearly indicated start) and stop) sections:

Code: Select all
        start)  echo -n "Starting rc_user...                    "
                # Add commands here you want to execute when starting
                # the router.
                # Use the fork command to launch programs which normally stay
                # in the foreground.
                # This part is called after all rc_* files.
                route add -net x.y.z.t netmask a.b.c.d ... ethx
                =
               ;;

        stop)   echo -n "Stopping rc_user...                    "
                # Add commands here you want to execute when restarting,
                # shutting down or rebooting.
                # Be careful not to use any commands which wait for user input.
                # This part is called before all rc_* files.
                route del x.y.z.t
                =
               ;;


Add you command(s) before the equal sign (=) and make sure to leave the double semi colons (;;) in place!

Always use a linux compatible editor (like edit, joe, vi, teddy, mc, etc.) to make changes, never a DOS/Windoze editor, since a DOS/Windoze editor will add ^M characters (CARRIAGE RETURN) at the end of each line, making the script unusable!
GreetZ
http://dingetje.homeip.net

"Software is like sex: it's better when it's free." - LINUS TORVALDS
User avatar
dingetje
FREESCO Crazed !!
 
Posts: 1001
Joined: Wed Nov 14, 2001 12:13 pm
Location: The Netherlands

Return to FAQ - Frequently Asked Questions

Who is online

Users browsing this forum: No registered users and 0 guests