Autoexec functionality in the RT 2.2 firmware

All about firmwares for routers. Support for RouterTech firmwares is here too.
User avatar
biro
RouterTech Team
RouterTech Team
Posts: 1274
Joined: Wed Jan 25, 2006 10:03 pm
Location: Letchworth Garden City, ENGLAND
Contact:

Post by biro » Tue Jun 12, 2007 1:06 pm

Not really following whats going on ( in Holiday mode !) but from experience have found that Cron my scripts wont run until pass through 0 mins and or runs for 1+ hours
ImageImageImage
All my posts on RouterTech.org are Copyright RouterTech.org
G'Day Laura
User avatar
studioeng
Experienced
Experienced
Posts: 454
Joined: Mon Oct 23, 2006 11:59 pm
Location: Dorset, England
Contact:

Post by studioeng » Tue Jun 12, 2007 1:15 pm

@biro - Are you saying that if you just leave it alone, it shall just 'work' ?? I can well beleive that would be the case, cron refreshing/updating itself after so long.

I upgraded to 2.3 last night, not really played with it much, didn't have time. At the moment, I can't get into my server from work, but I would assume that's either poor config on my behalf or my I'nets dropped again oO( D*mn ENTANET :x )

I may have imagined it, but I added the command to run uploaduptime.sh at the end of the install.sh script, just before it removed itself. I think from then on the file was updated every 15 minutes. I shall have to double check when I get chance.
lupus
Newbie
Newbie
Posts: 4
Joined: Sat Mar 31, 2007 3:19 pm

Truncated commands....

Post by lupus » Sun Jun 17, 2007 11:48 pm

mstombs wrote:doh...

The full commands are in the environment are they? Check with getenv.

Some bootloaders have a limit of 64 chars.
I'm running on a Solwise SAR600EW which seems to have this 64 character limit. This isn't enough to let me download and run the script. Any ideas on how to get around this? I'm running on 2.3.

Cheers,

Joel
User avatar
thechief
RouterTech Team
RouterTech Team
Posts: 12067
Joined: Wed Feb 01, 2006 10:22 pm
Location: England, the Centre of Africa
Contact:

Post by thechief » Sun Jun 17, 2007 11:54 pm

You can use the new "RT_cmd_x" commands to split up the commands - e.g., one to download the script, and another to run it - e.g.

Code: Select all

setenv RT_cmd_1 "cd /var && w get http://foo.com/foo.sh"
setenv RT_cmd_2 "chmod +x /var/foo.sh && /var/foo.sh"
The Chief: :afro: Be sure to read the Firmware FAQ and do a Forum Search before posting!
No support via PM. Ask all questions on the open forum.
User avatar
studioeng
Experienced
Experienced
Posts: 454
Joined: Mon Oct 23, 2006 11:59 pm
Location: Dorset, England
Contact:

Post by studioeng » Mon Jun 18, 2007 12:23 am

Just another idea for you to try out; further to what thechief has suggested, I have got a file called 'script.sh' on my webserver which is called via the autoexec.sh function. From here I can add as many scripts as I like, and do not need to edit the setenv of the router each time that I need to add another script or edit it.

Hope that is helpful :)
User avatar
studioeng
Experienced
Experienced
Posts: 454
Joined: Mon Oct 23, 2006 11:59 pm
Location: Dorset, England
Contact:

Post by studioeng » Fri Aug 10, 2007 9:26 pm

Moving on from the masquerade rule for the wireless interface, is it possible to have a masquerade rule which only respects a single public static IP address, and allows all other static IPs to act as normal?

The best way I can explain my question is; having multiple computers running through one public static IP, but without having another router between the modem and computers; while still having the other public static IPs working as normal; thus eliminating the routing between two different IP ranges and also removing another box.

Here is a very crude diagram; I hope that makes sence.

Code: Select all

Before:

[modem] --- [router] --- [computers]
  |  \
  |  [wireless] --- [laptops]
  |
 [server*] --- [switch] --- [computers]

After:

[modem] --- [switch] --- [computers]
  |  \
  |  [wireless] --- [laptops]
  |
 [server*] --- [switch] --- [computers]

(*= server also acting as a router)
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Post by mstombs » Sat Aug 11, 2007 5:03 pm

Not sure I', still up to speed with your growing network SE!. From what I recall

The modem is the Routertech firmware router running No-Nat, and this device has one of your usable range of 6 static IP addresses? The Masquerade rule turns on NAT for just your wireless PC address range.

The router is new to me, but if it is just a way to enable a number of devices to share another one of your static IPs I reckon a SNAT command as suggested by legume in the other thread could be used

viewtopic.php?p=20422&highlight=masquerade+snat#20422

I think you need to be careful though, running no-nat simplifies the job the router has to do, now you are thinking of running 2 types of NAT on the little device will that give bring the router nat tables/firewall/optimization problems back in?
User avatar
studioeng
Experienced
Experienced
Posts: 454
Joined: Mon Oct 23, 2006 11:59 pm
Location: Dorset, England
Contact:

Post by studioeng » Mon Aug 13, 2007 11:00 am

mstombs wrote:Not sure I', still up to speed with your growing network SE!. From what I recall

The modem is the Routertech firmware router running No-Nat, and this device has one of your usable range of 6 static IP addresses? The Masquerade rule turns on NAT for just your wireless PC address range.
Thats correct :D

I wouldn't say it was a growing network, just keep thinking of weird and wonderful things that can be done with my network :lol:
mstombs wrote:The router is new to me, but if it is just a way to enable a number of devices to share another one of your static IPs I reckon a SNAT command as suggested by legume in the other thread could be used

viewtopic.php?p=20422&highlight=masquerade+snat#20422
I checked the link; didn't realise at first it was my 'Changing my ISP' thread :lol: Would that enable me to isolate the static IP, apply a kind of 'psudo' NAT to it, and not affect any other public IP on the network!?

Am I right in thinking; iptables -t nat -A POSTROUTING -o ppp0 --src 192.168.1.0/24 -j SNAT --to-source 1.2.3.4 <- the public IP I wish this to run on??

The other problem I can think of now, is the DHCP of this NAT 'feature'; I asume I would need to run a DHCP somewhere on that 'sub-network' to issue the addresses etc!?
mstombs wrote:I think you need to be careful though, running no-nat simplifies the job the router has to do, now you are thinking of running 2 types of NAT on the little device will that give bring the router nat tables/firewall/optimization problems back in?
Well, you know me, I like the obscure, and pushing things further than they should go. If it breaks... 'oops, won't do that again!' and start from scratch :D

I'm guessing that would all depend on the number of machines which are using the 'features' we are discussing? For example; with the wireless side I am currently only using 2-3 devices maximum at any one time. Seeing as I only have 1 wireless laptop, a PS3 and a Wii (which aren't used at the same time), so I wouldn't think that was under too much stress, unless it would use resources regardless of how many devices are using it!?
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Post by mstombs » Mon Aug 13, 2007 9:32 pm

I think you'll just have to experiment, storing your scripts off the modem does mean you just reboot to return to known defaults. It is possible that the modem iptables doesn't have the required "to source" command. I don't know if you can use the web screen to configure the modem dhcp to do what you want - give out local IP addresses when it itself has an ISP address, but the half-bridge script does the opposite = gives out an ISP address when the modem has a local IP address so I'm sure it can be done!
User avatar
studioeng
Experienced
Experienced
Posts: 454
Joined: Mon Oct 23, 2006 11:59 pm
Location: Dorset, England
Contact:

Post by studioeng » Fri Apr 11, 2008 7:15 pm

I've tried to find the old script/command for detecting a dropped connection and automaticaly rebooting the router... I can't find it Where is it ?? : /

I've tried these searches: autoexec, reboot, dropped connection, google ...
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Post by mstombs » Fri Apr 11, 2008 7:27 pm

Welcome back big banner!

Have a look in the docs for "chksync" in RT2.5 or "chksync.sh" in older versions
User avatar
studioeng
Experienced
Experienced
Posts: 454
Joined: Mon Oct 23, 2006 11:59 pm
Location: Dorset, England
Contact:

Post by studioeng » Fri Apr 11, 2008 7:41 pm

[idiot]
Thanks fella; I looked in the FAQ.html which is included with the firmware...
[/idiot]

Yeah I got my banners back :D after a small repair to my Apache install :D Isn't it funny how they manage to get a comment somewhere on almost every thread I post in. : /
mstombs
RouterTech Team
RouterTech Team
Posts: 3753
Joined: Wed Jan 10, 2007 11:54 pm

Post by mstombs » Fri Apr 11, 2008 9:05 pm

You're welcome!

Personally I don't like to use the checksync function as you loose the log and don't know what caused the problem, and my connection used to be very fragile and frequently triggering. But I do know that its a useful feature if you are away and you know that it can fix all manner of problems!
Post Reply