Static Route Startup Script

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Goto page 1, 2  Next
Author Message
wizard1089
DD-WRT Novice


Joined: 02 Aug 2007
Posts: 17

PostPosted: Thu Sep 06, 2007 6:19    Post subject: Static Route Startup Script Reply with quote
Hello,

I have setup an EOIP tunnel between two locations with DD-WRT v23 SP3 7/21/07 build... I can ping both routers via their tunnel ip's via the command line on each router but to get the PC's behind each router to pass traffic I have to manualy add a static route like below.

Main site - route add -net 192.168.1.0/24 gw 10.10.10.2

Remote site - route add -net 192.168.0.0/24 gw 10.10.10.1

I've tried adding the following in the the startup script area :

route add -net 192.168.1.0/24 gw 10.10.10.2

When i click run command it works but when i save it and reboot after the reboot the route isn't there... Anyone know how to do this... Its driving me crazy... I've also tried to add the " sleep 120 " before the route command and that didn't help either.
Sponsor
wizard1089
DD-WRT Novice


Joined: 02 Aug 2007
Posts: 17

PostPosted: Thu Sep 06, 2007 18:45    Post subject: Reply with quote
bump ... PLEASE HELP!!! THANKS !!
wizard1089
DD-WRT Novice


Joined: 02 Aug 2007
Posts: 17

PostPosted: Sun Sep 09, 2007 1:21    Post subject: Reply with quote
bump
sufrano63
DD-WRT User


Joined: 06 Jun 2006
Posts: 488

PostPosted: Sun Sep 09, 2007 1:37    Post subject: Reply with quote
Run Commands/Save Startup/Reboot

Did you do in that order?

_________________
блог путешественника
wizard1089
DD-WRT Novice


Joined: 02 Aug 2007
Posts: 17

PostPosted: Sun Sep 09, 2007 16:04    Post subject: Reply with quote
Hello,

Thanks for you reply ... Yes I have perform my steps in exactly that order and the route still isn't there after the reboot... When I click Run commands the route is created and working so I know its not a problem with my commands... I think it might be an issue with the EOIP tunnel not being fully active when the start up script executes.

Has anyone ever use an EoIP tunnel in routed mode and not bridged mode?
cyberde
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 1488
Location: the Netherlands

PostPosted: Sun Sep 09, 2007 16:56    Post subject: Reply with quote
You should save it as firewall script, when wanup happens, the routes are reset to defaults by the firmware. The firewall script is called directly after that event.
So that should work...

_________________
Firmware: DD-WRT v24-sp2 (latest available) mega
WRT320N

Donater
wizard1089
DD-WRT Novice


Joined: 02 Aug 2007
Posts: 17

PostPosted: Sun Sep 09, 2007 20:05    Post subject: Reply with quote
Well I tried it as a Firewall Script and it still did not work... All I have in for the firewall script is this

route add -net 192.168.1.0/24 gw 10.10.10.2


Should there be anything else in the script??? When I click run commands it works and i can see the route get added when i type "route" from the cli... Thanks for your help and suggestions!
wizard1089
DD-WRT Novice


Joined: 02 Aug 2007
Posts: 17

PostPosted: Mon Sep 10, 2007 17:24    Post subject: Reply with quote
BUMP ... Sorry guys... Got a client that needs a fix for this really bad....
wizard1089
DD-WRT Novice


Joined: 02 Aug 2007
Posts: 17

PostPosted: Tue Sep 11, 2007 11:07    Post subject: Reply with quote
Ok well I've tried everything under the sun to make a startup script add an IP route for my Eoip tunnel... I think the problem is that the tunnel is not up when the script is ran...

So i've come to the point on where I have to come up with some kind of solution... I've made a custom script from the web gui that has the following in it..

#!/bin/sh
route add -net 192.168.1.0/24 gw 10.10.10.2

Its located in /tmp/custom.sh and this file seems to be there after every reboot.

I tried to make a cron job that would run every 5 min to keep trying to add the static route.

I put this in the cron section in the web gui but i don't see it writing anything to /tmp/crontab

from the command line if I run " /tmp/custom.sh " the route gets added so I know the script works... Does anyone know if the cron area of the gui doesn't work or do you know of a way I can manually add the cron job and have it stay put after reboot?

Thanks... I know this is a cruel way of doing this but I'm getting desperate for a solution.
wizard1089
DD-WRT Novice


Joined: 02 Aug 2007
Posts: 17

PostPosted: Thu Sep 13, 2007 1:41    Post subject: Reply with quote
bump
redhawk0
DD-WRT Guru


Joined: 04 Jan 2007
Posts: 11564
Location: Wherever the wind blows- North America

PostPosted: Thu Sep 13, 2007 1:48    Post subject: Reply with quote
You could try putting the script on the router using Winscp and running it as an "additional cron job" on the Administrative>>Management page.

Something to try anyway....but I'm not positive it will work.

redhawk

_________________
The only stupid question....is the unasked one.
wizard1089
DD-WRT Novice


Joined: 02 Aug 2007
Posts: 17

PostPosted: Thu Sep 13, 2007 3:18    Post subject: Reply with quote
Hi Redhawk,

Thanks for you reply ... I all ready have a script in /tmp/custom.sh that I made in the web gui under commands and custom-script. If i run the script from the command line

/tmp/custom.sh

This is the script:

#!/bin/sh
route add -net 192.168.1.0/24 gw 10.10.10.2

It will add the route and all is well but i can't get it to run as a cron job... Now i'm trying to add a cron job under Admin / Management.. I don't think the webadmin is adding the cron job. Here is what i put in for a cron job

*/5 * * * * root /tmp/custom.sh

Is that right... Am i missing something? Thanks!
drinkingbird
DD-WRT User


Joined: 16 Jun 2006
Posts: 157

PostPosted: Thu Sep 13, 2007 4:13    Post subject: Reply with quote
Why not run it as a startup script with a sleep command first, for like 60 seconds, so it doesn't run until after wanup has run?

wizard1089 wrote:
Hi Redhawk,

Thanks for you reply ... I all ready have a script in /tmp/custom.sh that I made in the web gui under commands and custom-script. If i run the script from the command line

/tmp/custom.sh

This is the script:

#!/bin/sh
route add -net 192.168.1.0/24 gw 10.10.10.2

It will add the route and all is well but i can't get it to run as a cron job... Now i'm trying to add a cron job under Admin / Management.. I don't think the webadmin is adding the cron job. Here is what i put in for a cron job

*/5 * * * * root /tmp/custom.sh

Is that right... Am i missing something? Thanks!
wizard1089
DD-WRT Novice


Joined: 02 Aug 2007
Posts: 17

PostPosted: Thu Sep 13, 2007 19:03    Post subject: Reply with quote
Hello,

I have tried making it a startup script with the sleep command before the route command but it never works... I have also tried making it a firewall startup script with no luck either
... I don't believe that its this difficult just to add a route to the system...

Does anyone know how to manually add a cron job? I can't seem to get ANY startup script or CRON job to run...

We are running V23 SP3 7/21/07 vpn
wizard1089
DD-WRT Novice


Joined: 02 Aug 2007
Posts: 17

PostPosted: Fri Sep 14, 2007 18:07    Post subject: Reply with quote
bump
Goto page 1, 2  Next Display posts from previous:    Page 1 of 2
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum