LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-17-2019, 02:39 AM   #1
skubik
Member
 
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware64 15.0/current
Posts: 152

Rep: Reputation: 21
Question wpa_supplicant keeps auto-changing my wireless network


I'm running Slack64 14.2 and am encountering a situation where wpa_supplicant keeps auto-connecting to my top/default network even when I explicitly connect to a different network.

That is, I have 'Network 1', 'Network 2' and 'Network 3' defined in my wpa_supplicant.conf. it automatically connects to 'Network 1', but whenever I select 'Network 3' (for example), it automatically kicks back to 'Network 1'.

I have some scripts written that I use to connect to wireless networks invoking wpa_supplicant directly, but I've also tried using NetworkManager and have the same result.
I've used my scripts on other machines with slightly older installs of Slack64 14.2 and haven't had a problem until I installed them on this machine (ThinkPad X1 Carbon circa 2012).

Any suggestions on why this might be happening?
Thanks in advance.


I've included my wpa_supplicant.conf, below:
Code:
# This line enables the use of wpa_cli which is used by rc.wireless
# if possible (to check for successful association)
ctrl_interface=/var/run/wpa_supplicant

# By default, only root (group 0) may use wpa_cli
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1

#update_config=1
#country=US



network={
        ssid="Network 1"
        psk=dls93932lasklkdasld932932012e23jr375t457djd83838ol2838ekdudjksk5
}

network={
        ssid="Network 2"
        psk=kdi3833lkqlqkdjjvhskdj38383kqkskddjkjsdncskaw88384u5ogflgjudkse4
}
network={
        ssid="Network 3"
        psk=irilslsls9d4k49fdlifdkgdfigjserngf45utse8p48e4rkr949494leldrf98d
}
 
Old 08-17-2019, 12:59 PM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,144

Rep: Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308Reputation: 2308
According to the man page wpa_supplicant might be doing what it's supposed to. The thing that will tell you is a wifi scan
Code:
iwlist wlan0 scan |grep -e 'SSID' -e 'Quality'
That ought to do it. If the network you're on has the best Quality, it might be doing it's job.

If you want to nobble that, the first thing I would try changing this line in your config
#update_config=1
to something like this:
update_config=0

If the sky falls in you reverse that, but it might help. You could also try changing the order in your config file.

Last edited by business_kid; 08-17-2019 at 01:00 PM.
 
Old 08-17-2019, 01:16 PM   #3
permaroot
Member
 
Registered: Aug 2019
Location: Arden, NC
Distribution: Arch Linux
Posts: 129

Rep: Reputation: 48
Quote:
Originally Posted by business_kid View Post
According to the man page wpa_supplicant might be doing what it's supposed to. The thing that will tell you is a wifi scan
Code:
iwlist wlan0 scan |grep -e 'SSID' -e 'Quality'
That ought to do it. If the network you're on has the best Quality, it might be doing it's job.

If you want to nobble that, the first thing I would try changing this line in your config
#update_config=1
to something like this:
update_config=0

If the sky falls in you reverse that, but it might help. You could also try changing the order in your config file.
http://www.qnx.com/developers/docs/q...upplicant.html

According to that site the update_config=1 allows wpa_cli to update the config. I don't think it has anything to do with switching APs based on quality of signal.

But I think you are right. wpa_supplicant seems to be designed to do that.

Last edited by permaroot; 08-17-2019 at 01:39 PM.
 
Old 08-17-2019, 01:38 PM   #4
permaroot
Member
 
Registered: Aug 2019
Location: Arden, NC
Distribution: Arch Linux
Posts: 129

Rep: Reputation: 48
What do your scripts to connect to your networks via wpa_supplicant look like?

What I'm getting at is that when you call wpa_supplicant you are pointing to your config at wpa_supplicant.conf right?

If so you can make a config file for each network and point to that in whatever script you are running?

Last edited by permaroot; 08-17-2019 at 01:42 PM.
 
Old 08-18-2019, 02:29 AM   #5
skubik
Member
 
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware64 15.0/current
Posts: 152

Original Poster
Rep: Reputation: 21
Quote:
Originally Posted by permaroot View Post
What do your scripts to connect to your networks via wpa_supplicant look like?

What I'm getting at is that when you call wpa_supplicant you are pointing to your config at wpa_supplicant.conf right?

If so you can make a config file for each network and point to that in whatever script you are running?
Yes, this is definitely possible in my scripts. It's late now so I'll have to try this tomorrow, but I imagine it will work.

However, after spending part of the day today playing with it and looking at debug output and output in wpa_cli, I'm still unsure as to why this is happening at all.
I looked at versions and I am currently using wpa_supplicant v2.6, whereas the previous system I ran these scripts and my wpa_supplicant.conf on was using v1.0. I skimmed over the changelogs for wpa_supplicant and it looks like there's a lot that changed between 1.0 and 2.0, but I wonder if there's something specific that was added after 1.0 that makes it behave like it is for me now versus how it used to behave on my old system.

Also, changing which config file my scripts point do doesn't resolve the problems I'm having with NetworkManager that keeps changing what network I'm connected to anyway. (My scripts do not invoke NetworkManager itself, but I have an option that starts the NetworkManager service if I choose to use it for times when I need to connect to, say, public wifi)

I've browsed sample wpa_supplicant.conf files and there's a lot of stuff in there. Anything I should specifically be looking at?

Thanks
 
Old 08-18-2019, 04:06 AM   #6
permaroot
Member
 
Registered: Aug 2019
Location: Arden, NC
Distribution: Arch Linux
Posts: 129

Rep: Reputation: 48
Quote:
Originally Posted by skubik View Post
Yes, this is definitely possible in my scripts. It's late now so I'll have to try this tomorrow, but I imagine it will work.

However, after spending part of the day today playing with it and looking at debug output and output in wpa_cli, I'm still unsure as to why this is happening at all.
I looked at versions and I am currently using wpa_supplicant v2.6, whereas the previous system I ran these scripts and my wpa_supplicant.conf on was using v1.0. I skimmed over the changelogs for wpa_supplicant and it looks like there's a lot that changed between 1.0 and 2.0, but I wonder if there's something specific that was added after 1.0 that makes it behave like it is for me now versus how it used to behave on my old system.

Also, changing which config file my scripts point do doesn't resolve the problems I'm having with NetworkManager that keeps changing what network I'm connected to anyway. (My scripts do not invoke NetworkManager itself, but I have an option that starts the NetworkManager service if I choose to use it for times when I need to connect to, say, public wifi)

I've browsed sample wpa_supplicant.conf files and there's a lot of stuff in there. Anything I should specifically be looking at?

Thanks
I haven't found any option that would disable this behavior.

I would follow business_kid's advice and check the quality/signal strength of each AP and see if it is indeed switching to the one with the best strength/quality.

If this is the case, take a look at the man page for iwconfig.

Specifically the sens parameter. Apparently modern WiFi cards will choose another AP under poor conditions.

The sensitivity can be changed with iwconfig wlan0 sens -80 to set the threshold, for example. If you set it low enough this could fix your issue.

Something to look at and play around with if AP signal strength is determining the AP change.

Last edited by permaroot; 08-18-2019 at 04:07 AM.
 
Old 08-18-2019, 09:38 PM   #7
skubik
Member
 
Registered: May 2003
Location: A dark corner in Canada
Distribution: Slackware64 15.0/current
Posts: 152

Original Poster
Rep: Reputation: 21
Well, if there's no way to disable that behavior, then I guess I'm stuck with modifying my scripts, which I've done, and it seems to work perfectly.

There's still a part of me that is very unsatisfied with this approach, but it is what it is.

Thanks for your help.
 
Old 08-18-2019, 09:54 PM   #8
permaroot
Member
 
Registered: Aug 2019
Location: Arden, NC
Distribution: Arch Linux
Posts: 129

Rep: Reputation: 48
Quote:
Originally Posted by skubik View Post
Well, if there's no way to disable that behavior, then I guess I'm stuck with modifying my scripts, which I've done, and it seems to work perfectly.

There's still a part of me that is very unsatisfied with this approach, but it is what it is.

Thanks for your help.
Glad you sort of resolved it. I guess I’ve never been in range of more than one AP I want to connect to so I’ve never had to deal with this.

I can connect/save info to another close AP at school and see if I can replicate the behavior. Without replicating it and tinkering having a different config for each one is all I can think of.

If I find anything out I’ll let ya know.
 
  


Reply

Tags
wirelessnetworking, wpasupplicant, wpa_supplicant


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
Can't connect to wireless network using wpa_supplicant - OSWA-Assistant mdce4 Linux - Wireless Networking 5 10-03-2016 05:28 PM
[SOLVED] [Fedora]Can't connect to wireless network: Network manager keeps asking for password. nicolassatragno Linux - Wireless Networking 3 08-03-2011 12:54 PM
problems connecting to wireless network using wpa_supplicant locash Linux - Wireless Networking 1 10-15-2008 11:15 PM
SuSE wpa_supplicant auto start blackcat_73 Linux - Wireless Networking 0 11-10-2006 09:11 AM
Wireless network keeps disconnecting on Intel(R) Pro/wireless 2200bg network card gregh Linux - Wireless Networking 1 09-16-2006 06:57 PM

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

All times are GMT -5. The time now is 08:21 PM.

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