FOR TIPS, gUIDES & TUTORIALS

subscribe to our Youtube

GO TO YOUTUBE

14455 questions

17168 answers

28195 comments

0 members

We are migrating to our new platform at https://community.teltonika.lt. Moving forward, you can continue discussions on this new platform. This current platform will be temporarily maintained for reference purposes.
0 votes
766 views 2 comments
by anonymous
How do I restart the wifi interface from SSH?
I can change static ip addresses by editing /etc/config/dhcp and then running /etc/init.d/dnsmasq restart
But that's not enough - until all concerned devices disconnect and reconnect to the wifi, they keep their old ip addresses.

Thanks!

1 Answer

0 votes
by anonymous

Hello,

When changing anything network-related, please make sure to restart (reload) the network service itself along with any other service which may be impacted. In your case, I'd recommend restarting the dnsmasq and network services by issuing the following commands:

/etc/init.d/dnsmasq reload

/etc/init.d/network reload

You may issue these commands in a single line by using '&&' in between the commands. This will make sure that each service reloads one after another and if any of these commands fail, the others won't be executed. For example:

/etc/init.d/dnsmasq reload && /etc/init.d/network reload

Full list of services can be retrieved by issuing the following command via CLI (SSH/Telnet):

ls /etc/init.d/

Best regards,

Tomas. 

Best answer
by anonymous

Thank you Tomas!
I meanwhile stumbled upon a more complicated solution - 

/etc/init.d/dnsmasq restart
uci set wireless.@wifi-iface[0].user_enable=0 && uci set wireless.@wifi-iface[0].disabled=1 && uci commit && wifi
sleep 2
uci set wireless.@wifi-iface[0].user_enable=1 && uci delete wireless.@wifi-iface[0].disabled && uci commit && wifi

Yours is much cleaner, but one question -
Why do you reload dnsmasq after network? Wouldn't it allow clients to reconnect to the wifi still with the old addresses, and not reconnect again on dnsmasq reload?

by anonymous
Good point, that's a mistake on my end! Indeed, the correct logic is to reload the dnsmasq service and then the network service. I've fixed my initial reply as well, thank you for pointing that out.