1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

ToastMan + WDS + WPA2 = Almost Perfect

Discussion in 'Tomato Firmware' started by ujf, Jul 27, 2011.

  1. ujf

    ujf Networkin' Nut Member

    Using Firmware
    Tomato Firmware v1.28.7475 MIPSR2-Toastman-RT K26 Std
    Using Devices
    Asus RT-N12

    When I connect 2 of these devices with WDS + WPA2, they always connect and work great. When I add a third device, they all connect ONLY if I turn them all on at the same time. Otherwise, 2 of them connect together and the 3rd doesn't. Or, if I do strategic power cycling in a certain order, I can usually get them all connected. Then, they are super fast until I reboot one of them. Then I have to go through the whole thing of trying to get them to all connect again.

    Summary: With NO encryption, they seem to always connect properly. With WPA2, they all connect if powered on at the exact same time.

    In the Device List of each of them, it does in fact show all the proper connections, BUT the TX/RX column is empty for the links that aren't working. So, it's like they are connecting, but not using the connections.

    I'm doing nothing fancy. I'm using the "Link To" WDS option on all of them:
    Router A contains Router B MAC
    Router B contains Router A MAC and Router C MAC
    Router C contains Router B MAC

    All routers are manually set to Channel 11.

    For example, Router B will show, in the connected Device List wds0.1 for Router A and 115/80 for TX/RX rate. Router B will show wds0.2 for Router C and NOTHING for the TX/RX rate. This link doesn't work. If I start them all together at the same time, this column shows information for both routers, and both links work.

    If this one issue could be fixed, this would be absolutely perfect.

    Any ideas?
     
  2. jsmiddleton4

    jsmiddleton4 Network Guru Member

    WPA work?
     
  3. popcornmix

    popcornmix Addicted to LI Member

    I had exactly your setup of 3 routers in WDS+AP running for a few years. Always had the same issue. Needed a "reboot dash" whenever I needed to reboot one.
    During that time I went through several firmware updates (including non-Toastman), and the issue was always present.

    I also found no problem when there was no encryption. For me, I was using WPA, and that does cause the issue.

    Once connected they were rock solid, so it wasn't a huge issue. Mostly caused an issue when the power tripped, or a there was a firmware upgrade to do.

    Just recently I've got an ethernet cable wired between two of the routers, so only two are in WDS+AP mode, so I think the issue has gone.
     
  4. quinezhu

    quinezhu Addicted to LI Member

    Same problem when I connect two routers with WDS + WPA2. WDS works fine if the master router turned on prior to the slave one, but it will fail when they turned on in reverse order.

    master router: e2000 , tomatoUSB build 54
    ___ Wireless Mode = Access Point + WDS
    ___ Wireless Network Mode = Auto
    ___ SSID = samessid
    ___ Channel = same channel
    ___ Security = WPA2 Personal
    ___ Encryption = AES
    ___ Shared Key = samesharedkey
    ___ WDS = Link With
    ___ MAC Address = wireless MAC of the slave router

    slave router: WRT54GS v1, tomatoUSB build 54
    ___ Wireless Mode = Access Point + WDS
    ___ Wireless Network Mode = Auto
    ___ SSID = samessid
    ___ Channel = same channel
    ___ Security = WPA2 Personal
    ___ Encryption = AES
    ___ Shared Key = samesharedkey
    ___ WDS = Link With
    ___ MAC Address = wireless MAC of the master router

    Is there any other Tomato mods which can solve it? Otherwise maybe I have to write a script to reboot the slave router automatically when the master one restores from the power lost. THX in adv.
     
  5. brugar

    brugar Network Guru Member

    Advanced>Miscellaneous has a "Boot Wait Time" setting. Use that setting to delay the start of the slave router. Using Toastman 7634 you can delay the start of the slave router by as much as 17 seconds (Slave wait time 20 Seconds minus Master wait time 3 seconds).
     
  6. mvsgeek

    mvsgeek Addicted to LI Member

    With WPA2 I could never get more than 2 of my 7 slaves to connect automatically. I now use WPA in conjunction with a nas4not script on the main router, and a keepalive script on each slave. Each script runs every 5 minutes, the nas4not at 0, 5, 10...the keepalives at 1, 6, 11...etc. The 1-minute delay allows enough time for nas4not to prepare for the impending keepalive (in baseball terms, the catcher needs to be in place before the pitcher throws the ball). Timing seems to be critical, I've played around with various sleep intervals, current setup is the most reliable yet.

    Script names are :
    oz_nas4_all.sh - runs oz_nas4_ap.sh for all secondary routers
    oz_nas4_ap.sh - start nas4not for a secondary
    oz_ping_ap.sh - ping main router, reboot if necessary

    Please restrict criticism to functionality, not my coding (in)abilities:D

    oz_nas4_all.sh
    Code:
    #!/bin/sh
    # Script to monitor secondary routers, and attempt to force reconnect with nas4not.
    # Runs on main router.
    # This script runs oz_nas4_ap.sh for each secondary router
     
    # Current WDS numbers are :
    # 1 = 192.168.1.2 
    # 2 = *unused*
    # 3 = 192.168.1.8 
    # 4 = 192.168.1.3 
    # 5 = 192.168.1.6 
    # 6 = 192.168.1.5 
    # 7 = 192.168.1.7 
    # 8 = 192.168.1 4 
     
    . /jffs/bin/oz_nas4_ap.sh 192.168.1.2 20 1 & > /dev/null 2>&1
    # . /jffs/bin/oz_nas4_ap.sh 192.168.1.3 20 2 & > /dev/null 2>&1
    . /jffs/bin/oz_nas4_ap.sh 192.168.1.8 20 3 & > /dev/null 2>&1
    . /jffs/bin/oz_nas4_ap.sh 192.168.1.3 20 4 & > /dev/null 2>&1 
    . /jffs/bin/oz_nas4_ap.sh 192.168.1.6 20 5 & > /dev/null 2>&1
    . /jffs/bin/oz_nas4_ap.sh 192.168.1.5 20 6 & > /dev/null 2>&1
    . /jffs/bin/oz_nas4_ap.sh 192.168.1.7 20 7 & > /dev/null 2>&1
    . /jffs/bin/oz_nas4_ap.sh 192.168.1.4 20 8 & > /dev/null 2>&1
     
    exit 0 
    oz_nas4_ap.sh
    Code:
    #!/bin/sh
    # Script to monitor secondary routers, and attempt to force reconnect with nas4not.
    # Runs on main router.
    # Expects 3 arguments : target router IP address, ping time in seconds, WDS number.
     
    maxPloss=99 # Maximum percent packet loss signifying a lost connection
    PINGTIME=20 # Default number of seconds to keep pinging
     
    # Initialize to a value that would force a reboot
    # (just in case ping gives an error and ploss doesn't get set)
     
    ploss=101
     
    if [ "$#" -ne 3 ]; then
        echo ' '
        echo "Usage : "$0" <router IP> <ping time> <WDS number>"
        echo ' '
        return -1
    fi
    echo ' '
     
    # Set some variables
     
    TRSSID=`nvram get wl0_ssid`
    TRPSK=`nvram get wl0_wpa_psk`
    LOGFILE=`nvram get log_file_path`
     
    TRIP="$1"
    PINGTIME="$2"
    TRWDS="wds0.$3"
     
    # Kill any existing nas4not processes for this WDS link
     
    kill -9 `ps|grep nas4not|grep "$TRWDS"|awk '{print $1}'` 
     
    # now ping target router for specified number of seconds and count packet loss
     
    ploss=`ping -q -w$PINGTIME $TRIP | grep -o "[0-9]*%" | tr -d %` > /dev/null 2>&1
     
    # If ping successful, just exit
     
    if [ "$ploss" -le "$maxPloss" ]; then
          return 0
    fi
     
    # Ping failed, so start nas4not for this WDS link
     
    logger Starting nas4not for $TRIP \($TRWDS\)...
    nas4not lan "$TRWDS" up auto aes psk "$TRPSK" "$TRSSID"
     
    return 0 
    oz_ping_ap.sh
    Code:
    #!/bin/sh
    # Script to monitor and reboot secondary routers when needed
     
    maxPloss=99 # Maximum percent packet loss before a reboot
    pingtime=15 # Default number of seconds to keep pinging
     
    # Initialize to a value that would force a reboot
    # (just in case ping gives an error and ploss doesn't get set)
     
    ploss=101
     
    # If no target router specified, default to 192.168.1.1 
     
    trip="192.168.1.1"
     
    if [ "$1" != "" ]; then
        trip="$1"
    fi 
     
    if [ "$2" != "" ]; then
        pingtime="$2"
    fi 
     
    # now ping target router for specified number of seconds and count packet loss
     
    ploss=`ping -q -w$pingtime $trip | grep -o "[0-9]*%" | tr -d %` > /dev/null 2>&1
     
    if [ "$ploss" -gt "$maxPloss" ]; then
          logger No response from $trip - rebooting... 
          reboot 
    fi
     
    exit 0 
    Add the following to init scripts on secondaries :

    Code:
    cru a keepalive "1-59/5 * * * * /jffs/bin/oz_ping_ap.sh 192.168.1.1 20"
    ...and this to init scripts on main :

    Code:
    cru a nas4_all "*/5 * * * * /jffs/bin/oz_nas4_all.sh"
    Main router and 1 secondary are on UPS. A recent power outage drained main's UPS battery, but when power was restored everything came up in under 10 minutes.

    See my sig for hardware/firmware details.
     
  7. Aaron

    Aaron Networkin' Nut Member

    I had this same problem. I eventually just gave up and put router B and C on powerline adapters and ran them with the same SSID and different channels(1,6,11)

    Just something you might want to look into. Can be a bit costly since you would need 3 adapters.
     

Share This Page