Date: Sun, 27 Aug 2017 13:19:15 +0930 From: Shane Ambler <FreeBSD@ShaneWare.Biz> To: "C. L. Martinez" <carlopmart@gmail.com>, freebsd-questions@freebsd.org Subject: Re: Scripting wifi connections Message-ID: <44a0b50e-3c4b-86ce-9bda-9e6fc634af35@ShaneWare.Biz> In-Reply-To: <20170826132404.mpvknkgxl26t5c43@tesla.lab.uxdom.org> References: <20170826132404.mpvknkgxl26t5c43@tesla.lab.uxdom.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On 26/08/2017 22:54, C. L. Martinez wrote: > Hi all, > > Sometimes I need to use two wifi connections at the same time. > Actually, my FreeBSD laptop is configured to use source routing (via > setfib+pf rules) to accomplish this. But I need more flexibility: choose > how many connections to use, setup a wpa_spplicant.conf's file "on the > fly", etc. > > My current config in rc.conf is: > > dhclient_fib="1" > wlans_ath0="wlan0" > wlans_urtwn0="wlan1" > ifconfig_wlan0="country ES WPA SYNCDHCP fib 1 group egress" > > As you can see, I can only have one wlan interface properly > configured. And my idea is to build a script to setup configurations "on > the fly". > > Any tip or idea? I only have one wlan so haven't tested this - For two wlans you should be able to add ifconfig_wlan0="country ES WPA SYNCDHCP fib 1 group egress ssid home" ifconfig_wlan1="country ES WPA SYNCDHCP fib 1 group egress ssid work" If needed you can adjust wpa_supplicant flags in rc.conf wpa_supplicant_flags="-s" wpa_supplicant_conf_file="/etc/wpa_supplicant.conf" While wpa_supplicant has the -i ifname and -c config_file options allowing you to restart it with different configs if you wanted, you should be able to configure multiple wlans in the one config_file, you could adjust the one config and SIGHUP wpa_supplicant to re-read it or have multiple configs setup and tell it to use a different one to suit. network={ ssid="home" scan_ssid=1 key_mgmt=WPA-PSK ... } network={ ssid="work" scan_ssid=1 key_mgmt=WPA-EAP ... } If using ifconfig wlan1 down to turn off one wlan doesn't work have a look at wpa_cli to interact with the running wpa_supplicant, it can take commands so should work from a script. Be sure to set ctrl_interface and ctrl_interface_group in your wpa_supplicant.conf to use wpa_cli. -- FreeBSD - the place to B...Software Developing Shane Ambler
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44a0b50e-3c4b-86ce-9bda-9e6fc634af35>