Wifi connect automatic on time, thanks for help

hi people,

a question;
how it is possible do turn off/on the wifi client,
every hour?
maybe it is possible only the client not the master wifi, which is on the same wifichip.

So you read right, i will disconnect and connect the wifi client every hour, to became a new ip.

Is this possible over openwrt,
i this therse is an package,
but sorry i am a newber in this positon.

thanks for your help,
best regards.

Hello,

you could create a shell script like:
/etc/config/restart_wifi_client.sh

#/bin/sh
uci set wireless.wifinet0.disabled='1'
uci commit wireless
sleep 5
uci set wireless.wifinet0.disabled='0'
uci commit wireless

To get the right path for your specific client interface name, run the command:
uci show wireless

And then you could create a crontab like:
/etc/crontabs/root

0 * * * * /bin/sh /etc/config/restart_wifi_client.sh

This will restart your client interface with the internal name wifinet0 every hour.
Adapt the script and the crontab to your needs.

Greets

No need to complicate things:

wifi down; sleep 5; wifi

1 Like

hey guys thanks,

but is it possible to install a "package" to set this in the gui?

I know you are super-user, but for me it is easier to set this in a "grafic-screen"^^

now i use the 19.07rc so the newest version,
it is super! really cool gui,
also for not linux profs^^

So i hope there is something i can config it.
ps. what is up with the "sleep 5" are these 5 secounds or...?

This will bring down all wifi interfaces!

As the OP mentioned, he want´s to only restart the client interface.

There is no simple package with gui that provides this functionality.
I´ve discribed it with a full working example so that you can simply implement it yourself...
Lets have fun and learn somthing :slight_smile:

This will be a 5 second sleep to give the system time to bring the client interface down before it get´s enabled again.

You method is only changing the "disabled" option from 0 to 1 and back. You have not restarted the interface to apply the changes.

ok, at first @juppin thank you,

ok now i know i must to this fia script,
from which data knows the router do to this every hour? or maybe all 5400 secounds? or so not exact, but can i type the disconnect\connect time in secounds or minutes?

And is this a problem, when i start the router when i will use it? So it is not always on, starts the wifi automatic at boot?

i know it is specially,^^
but i am a little afraid of the srcipt,
i do not worked with something,
but i must tried it.

Oh, you are right... You really need a /etc/init.d/network reload, wifi down && wifi up or wifi reconf...
Is it then possible to restart only one virtual interface without restarting the other on the same wifi chip?

I don't know if ifdown name; sleep 5; ifup name will work for virtual interfaces, as I don't have any, but the OP can try it.

@trendy yea exact;
i can put the enabled wifi client to disconnect and connet manually.

but i need something,
who do this automatic all 5400 secounds.
only simple disconn&connect the client,
all 5400 secounds.

so i think it is really simple,
maybe someone has an alternative method.
@juppi i don't forgot your option,
and maybe i must do this via script,
but i will not :-)) i am 68 learing is good for brain^^.

Add it in /etc/crontabs/root:

0 0,3,6,9,12,15,18,21 * * *  [cmd]
30 1,4,7,10,13,16,19,22 * * * [cmd]

where [cmd] is the command that works for you.

@trendy

this numbers are too much for me;
for what are these?

please a little detail,
thanks

First column is the minutes and the second, comma separated, is the hours.
For more information please read the wiki.

hi guys, thanks for the fast response;

So for summary,

  • do i need a software?
    or can i doe this in my router (maybe shedule tasks)

No, the software included in the router can handle this.

Something like this from a startup script could do the trick:

(while [ sleep 5400 ]; do wifi down; sleep 5; wifi; done 2>&1 | logger -t wifi_restart) &

thanks a lot,

so for summary;

I only must copy the skript below from fantom
in the router in the shedule tasks??

but i only will restart the client not the master,
which works on the same mac-chip.

I do not think it is possible.