|
OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below. |
|
Thread Tools | Display Modes |
|
|||
how to prioritize "join" entries in /etc/hostname.if
I'm rocking OpenBSD 6.4-stable on my Thinkpad T400 laptop. I use the internet exclusively over wifi. I'd like to somehow configure things so that if my phone's hotspot is on, laptop always connects to it instead of home, work, or other hotspot.
My /etc/hostname.athn0 looks like this: Code:
join home_sweet_home wpakey PassWorD join AndroidAP wpakey paSSwOrd join work_bitter_work wpakey pasSwORd dhcp Does anyone know how to prioritize the join entries, so that one SSID (AndroidAP in my case) is always given priority over the others? P.S. In his second post here, developer phessler mentions an Apple-like algorithm for choosing the network, but no mention of how to manually specify priority. Last edited by brudan; 12th February 2019 at 07:54 PM. Reason: P.S. with link to undeadly.org |
|
|||
Never mind. I just rolled my own. I deleted /etc/hostname.athn0 and now I just run the script below as root at boot. No fancy algorithm here: The SSIDs are searched in order, first one found connects.
Code:
#!/bin/sh main() { get_available_networks # these will be tried in order, so put favored networks on top: ssid="AndroidAP"; key="paSSworD"; search && connect && exit 0 ssid="Work-Visitor"; key=""; search && connect && exit 0 ssid="home_sweet_home"; key="PassWoRd"; search && connect && exit 0 exit 1 } get_available_networks() { available_networks=/tmp/available_networks ifconfig athn0 down && ifconfig athn0 up && sleep 5 ifconfig athn0 scan | grep -v ieee80211 > $available_networks # the line with ieee80211 lists prior connection, which may not be currently available } search() { grep -q "$ssid" "$available_networks" } connect() { if [ -n "$key" ]; then ifconfig athn0 nwid "$ssid" wpakey "$key" && dhclient athn0 else ifconfig athn0 nwid "$ssid" -wpakey && dhclient athn0 fi } main Last edited by brudan; 13th February 2019 at 06:03 PM. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
OpenBSD gains Wi-Fi "auto-join" | e1-531g | News | 1 | 12th July 2018 06:33 PM |
Difference between"arp info overwritten" and " duplicate IP address " | varag | OpenBSD Security | 1 | 6th April 2015 02:57 PM |
How to replace "ectags" with "ctags"? | fender0107401 | OpenBSD Packages and Ports | 5 | 16th April 2013 10:01 AM |
Fixed "xinit" after _7 _8, "how" here in case anyones' "X" breaks... using "nvidia" | jb_daefo | Guides | 0 | 5th October 2009 09:31 PM |
"Thanks" and "Edit Tags". | diw | Feedback and Suggestions | 2 | 29th March 2009 12:06 AM |