FreeBSD command line wifi manager

In the process of trying to install Arch Linux I came across a command line utility, iwctl, for managing a wifi connection.

Does anything like this exist for FreeBSD?
 
you'd just have to do it like all the others (linux), command to list ssids then connect to it. whatever program names FreeBSD uses.
 
TUI/bsdconfig-based options:
env BSDINSTALL_CONFIGCURRENT=yes bsdinstall netconfig
(will save the config in the /tmp/ directory)
bsdconfig netdev
 
Last edited by a moderator:
#ifconfig wlan0 list scan to scan for networks. Set it to be used in the usual way.

see the Handbook on Wireless Networking

You could also look how GhostBSD and NomadBSD solved that part. GUI tools for network managing should have a CLI tool, command line or sh-script underlying to do the job.

After all just editing a few lines in one or two config files isn't that much of an efford.
 
After all just editing a few lines in one or two config files isn't that much of an efford.
yeah, until you want to move between wifi hotspots, and have to edit those files every single friggin' time, and those edits don't get properly applied/refreshed. That happens even if you just move back and forth between just two wifi hotspots (like work and home).... adding a coffee shop into the mix only exacerbates the problem. 😩
 
try this one I used it for a minute. it scans available ssids then you just select one it uses wpa and writes it to the wpa_supplicant file

 
yeah, until you want to move between wifi hotspots, and have to edit those files every single friggin' time, and those edits don't get properly applied/refreshed. That happens even if you just move back and forth between just two wifi hotspots (like work and home).... adding a coffee shop into the mix only exacerbates the problem. 😩
Maybe I am misunderstanding, but: Why do you need to edit wpa_supplicant.conf each time you move between hotspots?

You can add as many credentials to the file as you want and wpa_supplicant picks up the network that is available automatically.

You can even add priorities to entries in case there are more than one network available and you want to make sure it picks the one you prefer.
 
Maybe I am misunderstanding, but: Why do you need to edit wpa_supplicant.conf each time you move between hotspots?

You can add as many credentials to the file as you want and wpa_supplicant picks up the network that is available automatically.

You can even add priorities to entries in case there are more than one network available and you want to make sure it picks the one you prefer.
Believe me, I tried that. My frustration is that even if I edit the credentials in all the right files, it's very much hit and miss on those edits getting picked up and actually applied, let alone retained across reboots.

I don't think I should have to remember to do that list of chores, correctly, every time I turn my laptop on.
 
In the process of trying to install Arch Linux I came across a command line utility, iwctl, for managing a wifi connection.

Does anything like this exist for FreeBSD?

How would I go about porting iwctl to FreeBSD?

I'm not sure if it is available for all Linux variants, or just Arch Linux....
 
How would I go about porting iwctl to FreeBSD?
Get a hold of the upstream sources, start compiling. Fix errors & bugs until it works. At this point you should have it build & run successfully so the next step would be to create a port for it. There's an entire handbook on that subject.

Alternatively, consider other options presented in this thread. Unless I'm mistaken, iwctl is part of the Linux source itself so it will most likely depend heavily on Linux specifics. You might be better off writing something new from scratch rather than porting it.
 
are you willing to maintain this iwctl, or any other port you submit until death do you part?
That's really weird question (no emojis, does not count as a joke! :D); you are absolutely not required to accept life-long contract to port something; if you are no longer interested in something you ported, other interested person will pick it up; if there's no interest at all (mostly fixing it if something breaks as OS goes on), it will be removed.
 
TBH, I'd just prefer that # bsdconfig wireless worked a bit more reliably underneath.

Command-line syntax is relatively easy to do. Controlling hardware reliably (i.e. connect/disconnect/reconnect with a wifi hotspot without a mile-long chore list that needs to be done just right) is hard.

FreeBSD did achieve plug-and-play status with ethernet controllers awhile ago. Now the challenge is to do something similar for wireless. Having the wireless card visible under FreeBSD and capable of connecting is good, but not enough. Reliable, reproducible control that hides complexity is sorely missing.
 
I should have to remember to do that list of chores, correctly, every time I turn my laptop on.
Why would you need something to do every time you restart your laptop?
When you add a new AP config, you need to perform just 2 simple steps:
1. Edit wpa_supplicant.conf
2. Run service netif restart wlan0
 
Why would you need something to do every time you restart your laptop?
When you add a new AP config, you need to perform just 2 simple steps:
1. Edit wpa_supplicant.conf
2. Run service netif restart wlan0
Yeah, wpa_supplicant.conf needs to be edited with correct details, and then I have to watch to make sure I don't have syntax errors, that it gets applied correctly, and if that doesn't work, it's hours of research into the error messages - on a different device, not the FreeBSD laptop. And if I go back and forth between different hotspots, I have to repeat that process of edit wpa_supplicant.conf, research, try again. Authentication details are a pain to enter correctly.
 
That's really weird question (no emojis, does not count as a joke! :D); you are absolutely not required to accept life-long contract to port something; if you are no longer interested in something you ported, other interested person will pick it up; if there's no interest at all (mostly fixing it if something breaks as OS goes on), it will be removed.
so now you're the rule maker on how to imply a joke? do you have credentials proving that, or is it just something you took upon yourself to be, and is this position you freely chose to take upon yourself a life long position or just something you took on a whim all depending on your mood?
 
so now you're the rule maker on how to imply a joke? do you have credentials proving that, or is it just something you took upon yourself to be, and is this position you freely chose to take upon yourself a life long position or just something you took on a whim all depending on your mood?
so now you're the rule maker on how to make rules on how to imply a joke? do you have credentials proving that, or is it just something you took upon yourself to be, and is this position you freely chose to take upon yourself a life long position or just something you took on a whim all depending on your mood?
 
Authentication details are a pain to enter correctly.
Well, usually I just copy an existing section and edit it. It's hard to screw up the syntax in just 3-4 lines.
You may want to write a simple interactive script to do that, I spent a few minutes writing and testing this:
Code:
#!/bin/sh

WPA_CONFIG="/etc/wpa_supplicant.conf"

echo "Enter SSID":
read SSID
echo "Enter PSK (just Enter for none)":
read PSK
echo "Do you want to add the new AP configuration:"
echo "  SSID: $SSID"
echo "  PSK:  $PSK"
echo "to $WPA_CONFIG ? Y/N"
read ANS
if [ "$ANS" = "y" ] || [ "$ANS" = "Y" ] ; then
    echo "network={" >> $WPA_CONFIG
    echo "ssid=\"$SSID\"" >> $WPA_CONFIG
    if [ "x$PSK" = "x" ] ; then
        echo key_mgmt=NONE >> $WPA_CONFIG
    else
        echo "psk=\"$PSK\"" >> $WPA_CONFIG
    fi
    echo "scan_ssid=1" >> $WPA_CONFIG
    echo "priority=15" >> $WPA_CONFIG
    echo "}" >> $WPA_CONFIG
    echo "Done!"
fi
 
Well, usually I just copy an existing section and edit it. It's hard to screw up the syntax in just 3-4 lines.
You may want to write a simple interactive script to do that, I spent a few minutes writing and testing this:
Code:
#!/bin/sh

WPA_CONFIG="/etc/wpa_supplicant.conf"

echo "Enter SSID":
read SSID
echo "Enter PSK (just Enter for none)":
read PSK
echo "Do you want to add the new AP configuration:"
echo "  SSID: $SSID"
echo "  PSK:  $PSK"
echo "to $WPA_CONFIG ? Y/N"
read ANS
if [ "$ANS" = "y" ] || [ "$ANS" = "Y" ] ; then
    echo "network={" >> $WPA_CONFIG
    echo "ssid=\"$SSID\"" >> $WPA_CONFIG
    if [ "x$PSK" = "x" ] ; then
        echo key_mgmt=NONE >> $WPA_CONFIG
    else
        echo "psk=\"$PSK\"" >> $WPA_CONFIG
    fi
    echo "scan_ssid=1" >> $WPA_CONFIG
    echo "priority=15" >> $WPA_CONFIG
    echo "}" >> $WPA_CONFIG
    echo "Done!"
fi
A successful test of that would involve ifconfig wlan0 to confirm that I connected to the hotspot I want, and then ping -c 5 google.com to confirm that I can get out to the Internet. 😏

I appreciate the script, I'll try it sometime. I think it would be nice if given a card that works under FreeBSD, success at connecting to any given hotspot were reliably reproducible. That will take commuting around town and finding hotspots to test that with. That's how we know the code works.
 
ifconfig wlan0 scan then
ifconfig wlan0 ssid "YOURSSIDNAME"
and if u add it to permanent list then
wpa_passphrase "YOURSSIDNAME" "YOURPASSWORD" >> /etc/wpa_supplicant.conf
The good thing is if u edit the wpa_supplicant.conf after, you can delete the password also as it will be there on the next line as an encrypted format.
 
ifconfig wlan0 scan then
ifconfig wlan0 ssid "YOURSSIDNAME"
and if u add it to permanent list then
wpa_passphrase "YOURSSIDNAME" "YOURPASSWORD" >> /etc/wpa_supplicant.conf
The good thing is if u edit the wpa_supplicant.conf after, you can delete the password also as it will be there on the next line as an encrypted format.
curious
Code:
userx@FreeBeSssDeee.edo:~
$> wpa_passphrase "Starbucks WiFi"  >> /etc/wpa_supplicant.conf
bash: /etc/wpa_supplicant.conf: Permission denied

userx@FreeBeSssDeee.edo:~
$> sudo wpa_passphrase "Starbucks WiFi"  >> /etc/wpa_supplicant.conf
bash: /etc/wpa_supplicant.conf: Permission denied

userx@FreeBeSssDeee.edo:~
$> su
Password:
root@FreeBeSssDeee:/home/userx # wpa_passphrase "Starbucks WiFi"  >> /etc/wpa_supplicant.conf 
# reading passphrase from stdin

Passphrase must be 8..63 characters
 
Back
Top