GithubHelp home page GithubHelp logo

wifi disconnect? about wifi HOT 7 CLOSED

rockymeza avatar rockymeza commented on July 29, 2024
wifi disconnect?

from wifi.

Comments (7)

rockymeza avatar rockymeza commented on July 29, 2024

A disconnect command would be great. I'm willing to accept a pull request for one, but I'm not sure what the best solution is. A naïve disconnect method would just run /sbin/ifdown wlan0 (where wlan0 is the interface), but unfortunately, this turns the interface off and breaks scanning. So we would need something that could disassociate from an Access Point while still keeping the interface up.

This definitely is possible, but I don't know how to do it. If you can write a disconnect command that can disconnect without taking down the interface, I would merge it.

At some point, I think it would be cool to be able do this from the Connection object too.

scheme = Scheme.find('wlan0', 'home')
connection = scheme.activate()
# ...
connection.deactivate()

from wifi.

ramnes avatar ramnes commented on July 29, 2024

dhclient -r wlan0 could do the trick.

from wifi.

rockymeza avatar rockymeza commented on July 29, 2024

Hey @ramnes,

Thanks! I will try to get to this after I come back from PyCon. I'm going to have a very busy month though, so I can't promise very much.

from wifi.

rockymeza avatar rockymeza commented on July 29, 2024

Hi @ramnes,

I tried running dhclient -r wlan0, but it didn't seem to do anything, I'm still connected.

from wifi.

ramnes avatar ramnes commented on July 29, 2024

According to man dhclient:

-r     Release  the  current lease and stop the running DHCP client as
       previously recorded in the PID file.  When shutdown via this method
       dhclient-script(8) will be executed with the specific reason for calling
       the script set.  The client normally doesn't release the current lease
       as this is not required by the DHCP protocol but some cable ISPs
       require their clients to notify  the  server if they wish to release an
       assigned IP address.

I tried here and I could not send nor receive any packet after it.

from wifi.

Jonnycake avatar Jonnycake commented on July 29, 2024

I think the reason that the dhclient -r wlan0 command isn't working for you @rockymeza is because you have NetworkManager (or some other network management daemon) running. Run ps -Af | grep NetworkManager and you should see it. Depending on how new your install is you will either have to run /etc/init.d/network-manager stop or initctl stop network-manager (both require root). You can then use wifi connect and then the dhclient command should work. If I get a chance I'll fork and submit a pull request to implement the deactivate() function and disconnect comand.

from wifi.

rockymeza avatar rockymeza commented on July 29, 2024

Moving conversation to #58.

from wifi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.