Author Topic: Some useful scripts  (Read 11080 times)

Offline WorldSpot

  • Administrator
  • Hero Member
  • *****
  • Posts: 2472
Some useful scripts
« on: August 22, 2012, 10:51:26 pm »
These scripts can be launched through the dashboard.

Permuting LAN and WAN ports.
This can be useful if you need the 4 port switch on your private (internet) network.
The public network is still available on the internet port.
Don't forget to change the internet connection from internet port to one of the lan ports.
Note that your mac address can change. So check your "node setup" page and set the mac address accordingly.

Use the dashboard "send multiple command" and copy paster the script below.
Code: [Select]
lanIfName=$(uci get network.lan.ifname)
wanIfName=$(uci get network.wan.ifname)

echo old config : lan: $lanIfName wan: $wanIfName
echo ---------------
uci show network
if [ "$lanIfName" != "" ] && [ "$wanIfName" != "" ]
then
  echo
  echo switching interfaces
  uci set network.lan.ifname="$wanIfName"
  uci set network.wan.ifname="$lanIfName"
  echo new config:
  echo ---------------
  uci show network
  echo
  echo 'if ok, please send these commands "uci commit network;reboot"'
fi

Then read the output. If everything looks ok, you have to send these
Code: [Select]
uci commit network
reboot
Reflash your router.

You could first reboot your router to free some memory, then connect to the dashboard. (Note: after reboot, it can take some minutes before you can reconnect the dashboard)
- free some more memory with
Code: [Select]
pkill chilliFor low memory routers like WRT54GL, you should kill much more processes (these routers can be tricky to reflash):
Code: [Select]
pkill logger ; pkill hotplug2; pkill -9  chilli; pkill dropbear;pkill syslogd; pkill ntpd;pkill klogd;pkill hostapd- download the firmware from an http server with the wget command. (Change the url with the appropriate firmware you want to download)
Code: [Select]
wget -O firmware.bin http://worldspot.net/wsfirm/backfire-r30950/ar71xx/openwrt-ar71xx-tl-wr1043nd-v1-squashfs-sysupgrade.binNote that on low memory routers, your router might freeze. You must then reboot and retry...
Check that the downloaded file md5 is ok with
Code: [Select]
md5sum firmware.bin
Then you flash with
Code: [Select]
sysupgrade -n firmware.bin
Important note:
The sysupgrade command could give a message like "error contacting the router" immediately.
It is probable that the flashing process is still running.
Please be patient and wait several minutes. Don't unplug the router during these minutes.

More scripts to come...
« Last Edit: December 26, 2015, 08:39:14 pm by WorldSpot »

 

anything