From owner-freebsd-questions@freebsd.org Sun Aug 27 09:59:08 2017 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8323EDEC0A9 for ; Sun, 27 Aug 2017 09:59:08 +0000 (UTC) (envelope-from carlopmart@gmail.com) Received: from mail-lf0-x232.google.com (mail-lf0-x232.google.com [IPv6:2a00:1450:4010:c07::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F28BF6C94F for ; Sun, 27 Aug 2017 09:59:07 +0000 (UTC) (envelope-from carlopmart@gmail.com) Received: by mail-lf0-x232.google.com with SMTP id d17so12633638lfe.1 for ; Sun, 27 Aug 2017 02:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=8OscvDoZ/CSZ8TI9arEmp/8l6DMx13/MR6GEidbbtd0=; b=OzsDN3YAIUPMRV8D9rjDrHJDbhd6v1z3h8Dw4mP+eCViGMvFV8DAHlat0CJ/b2VOu+ yRrxY1P++CYHoC88R0LaJCCmTlwWuIwRCaUauSIqzGx6XEwSAyB5xbX0GYOKBVJaIg8P yb7Ik7N+8OlgkwEJxLEcrV7l0KN6l5uYkUNLIaQFv1st2yBFP/u6czE1d/FnF9adf9VE bGDowUo0C1QlG1QP9hmtC2e53UeNt+a2actIyqJzshaGpPIxRMOx4ItNbJc5pCcIKub7 eXyJHXMllXRFxj/N+ou/UWYoSQJvUaAO6CFXsbcksXepzu0KwihIA388nGd1YaXjdUYw cYzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=8OscvDoZ/CSZ8TI9arEmp/8l6DMx13/MR6GEidbbtd0=; b=GqG2OAaEeL4sExWb8vEm0kQO8oA+jLKW/6AwN05ER5qlNFG17WfMQw8Y1ht/lrMENQ JlYF64Mh4lEPFz4WWeA8G175LoFllpT4nZHQho7AK/9PpmbBzlqnlDKWwaLiJilhXA2W RPznHpj92Bp6/NHeo7vbpmY5a18h2YDuzJKIjIC1H8iebusVqhPWGmJJmpACmDNoa2IE D6HYNtDP2FP6Q2SOSpiEbsS2mon6PZCKWiJBRNBze/lsamrplZ6DAcLSP9F0rH/PvtLp IjC74y/r6N0DDG41DDa9H2KAsR0o31ryjHVlBjX8vmeSAOEiqL2zy19OoX8Sm+UCGoty +cHg== X-Gm-Message-State: AHYfb5gC6DJ3XDW6a14l7UTQtRxR9PEl4FVmfYTLuDP611h3+aO444qT rtGI0vp4mUOX7DNwz9Y= X-Received: by 10.25.205.84 with SMTP id d81mr1856452lfg.255.1503827944964; Sun, 27 Aug 2017 02:59:04 -0700 (PDT) Received: from localhost ([185.86.10.202]) by smtp.gmail.com with ESMTPSA id q28sm1897274lfq.42.2017.08.27.02.59.03 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 27 Aug 2017 02:59:04 -0700 (PDT) Date: Sun, 27 Aug 2017 09:59:02 +0000 From: "C. L. Martinez" To: freebsd-questions@freebsd.org Subject: Re: Scripting wifi connections Message-ID: <20170827095902.uhd22xcm65j3l6wt@tesla.lab.uxdom.org> References: <20170826132404.mpvknkgxl26t5c43@tesla.lab.uxdom.org> <44a0b50e-3c4b-86ce-9bda-9e6fc634af35@ShaneWare.Biz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <44a0b50e-3c4b-86ce-9bda-9e6fc634af35@ShaneWare.Biz> User-Agent: NeoMutt/20170609 (1.8.3) X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Aug 2017 09:59:08 -0000 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