# Limiting available networks



## pwdr (Aug 23, 2017)

I was wondering why my connection kept dropping, then I realised my IP address kept changing. During one of the `ifconfig` checks I saw that the SSID was a free wifi network. This isn't specified in my wpa_supplicant.

Is there a way to limit the network traffic so that wlan0 only connects to the SSID I specify?


----------



## Maxnix (Aug 23, 2017)

Can you post your /etc/wpa_supplicant.conf?

EDIT: I found on the gentoo wiki this entry to let wpa_supplicant auto connect to unsecure networks; do you have it in your config file?

```
network={
        key_mgmt=NONE
        priority=-999
}
```


----------



## pwdr (Aug 23, 2017)

Sure:


```
ctrl_interface=/var/run/wpa_supplicant
eapol_version=2
ap_scan=1
fast_reauth=1

network={
    ssid="MYNETWORK"
    psk="NETWORKPASS"
    priority=5
}
network={
    priority=0
    key_mgmt=NONE
}
```

Now, I've just remembered something I did. 

The first 4 lines went in when I was trying to get the internal wifi card working on iwi0. It's possible that the last network (without SSID) went in then as well, though I don't remember it.

I've commented all those lines out now and will post back.

Edit: The problem persists. My wpa_supplicant is effectively just the following, but it keeps jumping onto the insecure free network:


```
network={
    ssid="MYNETWORK"
    psk="NETWORKPASS"
    priority=5
}
```


----------



## tingo (Aug 24, 2017)

Are you using something else than wpa_supplicant and DHCP client to configure your network connection?


----------



## pwdr (Aug 25, 2017)

tingo said:


> Are you using something else than wpa_supplicant and DHCP client to configure your network connection?



Not on FreeBSD. DHCP is controlled by the router but I don't _believe _I've set anything else around networking. If there's anywhere else I should look/check I'll gladly relay it.


----------



## tingo (Aug 26, 2017)

Well, then the only way wpa_supplicant can connect to an unsecured network is if you have

```
network={
   priority=0
    key_mgmt=NONE
}
```
in your wpa_supplicant.conf file. Perhaps you didn't use the correct way to comment them out? Or perhaps you didn't restart wpa_supplicant afterwards?


----------

