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

script that changes wireless channel when a particular machine is connected

Discussion in 'Tomato Firmware' started by touser, May 26, 2014.

  1. touser

    touser Network Newbie Member

    I am running the latest version of Shibby's firmware. What I am trying to achieve is the following:

    Upon boot or restart the router should be set to a particular channel. After that a script should regularly check if a particular machine (identified either by name or MAC address) is connected to the router. If it is connected, the router (after some delay) should switch to another wireless channel. If the machine becomes disconnected, the router should revert back to the original channel.

    Is this achievable using some kind of script and if so, how?
     
  2. rs232

    rs232 Network Guru Member

    Yes you can... but... what is the use for such script?
    I can't think of any reason to overcomplicate your set up to this level.

    Regardless of my questions:

    To the top of my head, totally untested script:
    Change YOURMACADDRESS

    myclient=`wl assoc list | grep YOURMACADDRESS | wc -l`
    if [ $myclient -eq "0" ]; then
    nvram set wl0_channel=1
    nvram commit
    /sbin/radio off
    sleep 2
    /sbin/radio on
    else
    myclient=`wl assoc list | grep YOURMACADDRESS | wc -l`
    set nvram wl0_channel=11
    nvram commit
    /sbin/radio off
    sleep 2
    /sbin/radio on
    fi
     
  3. Grimson

    Grimson Networkin' Nut Member

    Note: If you change the channel your client will be disconnected for a moment, so don't run this script in very short intervals or you'll get a ping-pong effect.
     
  4. Guido

    Guido Network Newbie Member

    Have you considered putting the device on 5Ghz? That's what I do for better connections, including a 6 year old Fujitsu laptop. MAC restrictions to only home devices catch anything that might get past a password.
     
  5. touser

    touser Network Newbie Member

    @rs232: Thanks a lot, it seems that you have provided all the commands that I need. I will try something based on your script.

    @Grimson: Thanks, I will keep this in mind.

    @Guido: Unfortunately the router is 2.4 GHz only.
     

Share This Page