LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 07-02-2017, 05:12 PM   #1
TheEzekielProject
Member
 
Registered: Dec 2016
Distribution: arch
Posts: 668

Rep: Reputation: 190Reputation: 190
Proper way to disconnect from internet via command line and wpa_supplicant


Hello all,

I am hoping someone has a little insight and can tell me what I'm doing wrong or just not doing at all.

I normally connect to the internet via wpa_supplicant and manually setting my ip which works great. However, whenever I disconnect and try to connect again my wireless connection either takes forever to load pages (+- 2min) or just doesn't work (Temporary failure in name resolution is the usual error). I figure I am missing a step somewhere in disconnecting properly

These are the commands I use to connect
Code:
wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
ip addr add 192.168.1.xxx/24 dev wlan0 #Yes, I replace the x's with an actual ip
ip route add default via 192.168.1.1
And to disconnect I just use
Code:
ip addr flush dev wlan0
ip route flush dev wlan0
ip link set wlan0 down
wpa_cli disconnect
Which does indeed disconnect me, but upon attempting to connect again I get the issues mentioned above.
What am I missing? Any insight appreciated
 
Old 07-02-2017, 09:15 PM   #2
TheEzekielProject
Member
 
Registered: Dec 2016
Distribution: arch
Posts: 668

Original Poster
Rep: Reputation: 190Reputation: 190
After screwing around with different options, I've found I can simply disconnect and reconnect via
Code:
wpa_cli disconnect
wpa_cli reconnect
Previously I was just running wpa_cli disconnect and then running the wpa_supplicant command again, which failed.

As a note the disconnect/reconnect commands did not work for me if I also ran the
Code:
ip addr flush dev wlan0
ip route flush dev wlan0
ip link set wlan0 down
commands.

Though my issue is solved, if anyone can point me in the right direction to determining why my initial method of disconnect/reconnect did not work, I'd like to understand what was going wrong and how it differs from the solution.


Hope this helps someone else as there is no mention of these options in the wpa_cli man pages but they do appear if you look at wpa_cli help
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I Disconnect an Established connection via command line? hack3rcon Linux - Networking 8 12-03-2015 06:55 PM
Info on proper command line use chipado LinuxQuestions.org Member Intro 2 09-22-2012 12:36 PM
wpa_supplicant Disconnect Problem roddefig Linux - Software 2 09-27-2010 08:37 AM
[SOLVED] F11: proper format for fstab line duplicating desired mount command mejohnsn Fedora 7 10-10-2009 07:41 AM
wpa_supplicant cannot connect after disconnect embed Linux - Networking 1 03-03-2009 03:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:39 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration