Advertisement
Androxilogin

DD-WRT Commands

Apr 23rd, 2016
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. # AUTO RANDOM MAC ADDRESS
  2.  
  3. #!/bin/ash
  4. MAC=`(date; cat /proc/interrupts) | md5sum | sed -r 's/^(.{10}).*$/\1/; s/([0-9a-f]{2})/\1:/g; s/:$//;'`
  5. echo "00:${MAC}"
  6. ifconfig eth1 hw ether 00:${MAC}
  7. nvram set def_hwaddr="00:${MAC}"
  8. nvram set wan_hwaddr="00:${MAC}"
  9. stopservice wan
  10. startservice wan
  11.  
  12. # AUTO CLEAR NVRAM
  13.  
  14. for i in `nvram show | grep traff- | cut -f1 -d=""`; do nvram unset $i; done
  15.  
  16. # SPEAK SIGNAL STRENGTH
  17.  
  18. #! /bin/bash
  19. # Use "festival" to say out loud how much signal strength we have
  20.  
  21. # The IP address of the WRT
  22. ip_addr="10.0.0.1"
  23.  
  24. # The username and password for the WRT
  25. user="Admin"
  26. pass="password"
  27.  
  28. # Tempory file used to hold the data from the WRT
  29. tmp_file=/tmp/wrt.status
  30.  
  31. echo
  32. echo "The signal level is:-"
  33. echo
  34. echo "The signal level is" | festival --tts
  35.  
  36. while true ; do
  37. wget --http-user=$user --http-password=$pass http://$ip_addr/Status_Wireless.live.asp -O $tmp_file -o /dev/null
  38. signal=`awk -F "'" '/active_wireless/ { print }' $tmp_file`
  39. echo $signal | awk '{printf"Signal : ""\t";for(;j<;j++)printf"=";printf"\n"}'
  40.  
  41. if [[ -n $signal ]] ; then
  42. echo $signal | festival --tts
  43. else
  44. echo "Not associated" | festival --tts
  45. fi
  46. done
  47.  
  48. #!/bin/sh
  49.  
  50. # This script solves an intermitent problem on my
  51. # NetGear WNDR3300 wireless N radio. Every few
  52. # hours, the wireless N radio stops broadcasting
  53. # and cannot be seen by wireless clients. Bringing
  54. # the wireless interface down and then back up
  55. # resolves the issue. This script pings a
  56. # wireless client, in my case, a WET610N wireless
  57. # bridge that should always remain up and only
  58. # connects to the wireless N radio. If the
  59. # ping fails twice within a given time, it
  60. # brings the interface down and then back up.
  61.  
  62. # A wireless client that should always be up
  63. CLIENT_IP=192.168.1.1
  64.  
  65. # Wireless interface that disappears
  66. INTERFACE=`nvram get wl0_ifname`
  67.  
  68. # seconds to wait after failed ping to try again
  69. FAIL_AGAIN=10
  70.  
  71. # seconds between checks
  72. CHECK_EVERY=60
  73.  
  74. # after cycling, wait this many seconds
  75. AFTER_CYCLE=360
  76.  
  77. # Client must be up before starting main loop
  78. while true
  79. do
  80. if ping -c 1 ${CLIENT_IP} >/dev/null
  81. then
  82. echo "${CLIENT_UP} ok - begining main loop"
  83. break
  84. fi
  85. done
  86.  
  87. # main script
  88. while sleep ${CHECK_EVERY}
  89. do
  90. if ping -c 1 ${CLIENT_IP} >/dev/null
  91. then
  92. echo "${CLIENT_IP} ok"
  93. else
  94. echo "${CLIENT_IP} dropped one"
  95. sleep ${FAIL_AGAIN}
  96. if ! ping -c 1 ${CLIENT_IP} >/dev/null
  97. then
  98. echo "${CLIENT_IP} dropped two, sending restarting ${INTERFACE}"
  99. # on Atheros hardware instead use: ifconfig ${INTERFACE} down
  100. wl -i ${INTERFACE} down
  101. sleep 3
  102. # on Atheros hardware instead use: ifconfig ${INTERFACE} up
  103. wl -i ${INTERFACE} up
  104. sleep ${AFTER_CYCLE}
  105. fi
  106. fi
  107. done 2>&1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement