Purging a wifi connection

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Purging a wifi connection

Raymond, David
I have a problem when I have two wifi services available, say, a hotel
wifi and my cellphone hotspot.  Suppose I put the hotel wifi in my
hostname.xxx file and run sh /etc/netstart and I don't like the
results.  Removing the hotel wifi from the hostname file, replacing it
with my hotspot wifi, and rerunning sh /etc/netstart results in the
computer trying to connect with the hotel wifi again, even though this
connection is no longer in the hostname file.  If I then reboot the
computer and rerun sh /etc/netstart, it connects with the hotspot wifi
as desired.

My question is whether there is a way to purge the non-desired wifi
connection without rebooting the computer.

--
David J. Raymond
[hidden email]
http://physics.nmt.edu/~raymond

Reply | Threaded
Open this post in threaded view
|

Re: Purging a wifi connection

Stuart Henderson
On 2020-02-21, Raymond, David <[hidden email]> wrote:

> I have a problem when I have two wifi services available, say, a hotel
> wifi and my cellphone hotspot.  Suppose I put the hotel wifi in my
> hostname.xxx file and run sh /etc/netstart and I don't like the
> results.  Removing the hotel wifi from the hostname file, replacing it
> with my hotspot wifi, and rerunning sh /etc/netstart results in the
> computer trying to connect with the hotel wifi again, even though this
> connection is no longer in the hostname file.  If I then reboot the
> computer and rerun sh /etc/netstart, it connects with the hotspot wifi
> as desired.
>
> My question is whether there is a way to purge the non-desired wifi
> connection without rebooting the computer.
>

netstart doesn't wipe existing config, it only runs through line by
line and adds to it.

Guessing you use "join" for the wifi network config?

You can either run "ifconfig xxx -join network" at the command line
to remove just that network, or you can add "-joinlist" to the top of
hostname.xxx if you just want it to clear and recreate the whole list.


Reply | Threaded
Open this post in threaded view
|

Re: Purging a wifi connection

Timothy Brown
In reply to this post by Raymond, David
On Fri, Feb 21, 2020 at 02:10:49PM -0700, Raymond, David wrote:

> I have a problem when I have two wifi services available, say, a hotel
> wifi and my cellphone hotspot.  Suppose I put the hotel wifi in my
> hostname.xxx file and run sh /etc/netstart and I don't like the
> results.  Removing the hotel wifi from the hostname file, replacing it
> with my hotspot wifi, and rerunning sh /etc/netstart results in the
> computer trying to connect with the hotel wifi again, even though this
> connection is no longer in the hostname file.  If I then reboot the
> computer and rerun sh /etc/netstart, it connects with the hotspot wifi
> as desired.
>
> My question is whether there is a way to purge the non-desired wifi
> connection without rebooting the computer.
>

Hi David,

In cases like this, I typically don't update my hostname.xxx file and
instead run `ifconfig` by hand.

For example to remove ESSID foo:
  ifconfig -join foo

Or to remove all known networks:
  ifconfig -joinlist

The `ifconfig` manpage explains this.

Regards
Tim

Reply | Threaded
Open this post in threaded view
|

Re: Purging a wifi connection

Raymond, David
In reply to this post by Stuart Henderson
Thanks, I will give that a try.

On 2/21/20, Stuart Henderson <[hidden email]> wrote:

> On 2020-02-21, Raymond, David <[hidden email]> wrote:
>> I have a problem when I have two wifi services available, say, a hotel
>> wifi and my cellphone hotspot.  Suppose I put the hotel wifi in my
>> hostname.xxx file and run sh /etc/netstart and I don't like the
>> results.  Removing the hotel wifi from the hostname file, replacing it
>> with my hotspot wifi, and rerunning sh /etc/netstart results in the
>> computer trying to connect with the hotel wifi again, even though this
>> connection is no longer in the hostname file.  If I then reboot the
>> computer and rerun sh /etc/netstart, it connects with the hotspot wifi
>> as desired.
>>
>> My question is whether there is a way to purge the non-desired wifi
>> connection without rebooting the computer.
>>
>
> netstart doesn't wipe existing config, it only runs through line by
> line and adds to it.
>
> Guessing you use "join" for the wifi network config?
>
> You can either run "ifconfig xxx -join network" at the command line
> to remove just that network, or you can add "-joinlist" to the top of
> hostname.xxx if you just want it to clear and recreate the whole list.
>
>
>


--
David J. Raymond
[hidden email]
http://physics.nmt.edu/~raymond

Reply | Threaded
Open this post in threaded view
|

Re: Purging a wifi connection

Stefan Sperling-5
On Fri, Feb 21, 2020 at 07:40:23PM -0700, Raymond, David wrote:
> Thanks, I will give that a try.

Also 'ifconfig nwid' still works and will override any join commands.

Details are in the ifconfig man page. This page has received improvements
in -current recently. If you don't run a -current system please check the
online -current man page and compare it with the man page you see on a
6.6 system: https://man.openbsd.org/ifconfig
Most of what this -current page is saying applies to 6.6 as well.
A major behavioral difference between 6.6 and -current is that an interface
will no longer connect to random open wifi networks by default.

Reply | Threaded
Open this post in threaded view
|

Re: Purging a wifi connection

Raymond, David
Thanks for the heads up on current vs 6.6.



On 2/22/20, Stefan Sperling <[hidden email]> wrote:

> On Fri, Feb 21, 2020 at 07:40:23PM -0700, Raymond, David wrote:
>> Thanks, I will give that a try.
>
> Also 'ifconfig nwid' still works and will override any join commands.
>
> Details are in the ifconfig man page. This page has received improvements
> in -current recently. If you don't run a -current system please check the
> online -current man page and compare it with the man page you see on a
> 6.6 system: https://man.openbsd.org/ifconfig
> Most of what this -current page is saying applies to 6.6 as well.
> A major behavioral difference between 6.6 and -current is that an interface
> will no longer connect to random open wifi networks by default.
>


--
David J. Raymond
[hidden email]
http://physics.nmt.edu/~raymond