Date: Sun, 27 Aug 2017 09:59:02 +0000 From: "C. L. Martinez" <carlopmart@gmail.com> To: freebsd-questions@freebsd.org Subject: Re: Scripting wifi connections Message-ID: <20170827095902.uhd22xcm65j3l6wt@tesla.lab.uxdom.org> In-Reply-To: <44a0b50e-3c4b-86ce-9bda-9e6fc634af35@ShaneWare.Biz> References: <20170826132404.mpvknkgxl26t5c43@tesla.lab.uxdom.org> <44a0b50e-3c4b-86ce-9bda-9e6fc634af35@ShaneWare.Biz>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Aug 27, 2017 at 01:19:15PM +0930, Shane Ambler wrote: > 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. > Thanks Shane. I will read man pages about wpa_cli ... -- Greetings, C. L. Martinez
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170827095902.uhd22xcm65j3l6wt>