# Managing networks on a laptop



## MasterOne (Dec 3, 2019)

I'm currently on Arch Linux and I'm interested in trying with FreeBSD with KDE Plasma (and likely bspwm as an alternative session) on my laptop again after quite some time, and I'm wondering what the way to go there is for managing networks, so easily connecting to and switching between

public WLAN
private WLAN
WWAN (4G)
USB Tethering
Bluetooth Tethering
LAN
VPN (like via OpenVPN)
I have seen that there are now network managers from TrueOS and GhostBSD and I know about the script-based approach by vermaden but I'm not sure if these are any good in practice.

Anybody here care to share how you do it on your laptop?


----------



## Phishfry (Dec 4, 2019)

net-mgmt/networkmgr will work with WLAN, both public with no WPA and private WLAN networks.
networkmgr can switch between WLAN and LAN networks.

As I noted earlier WWAN on FreeBSD uses PPP for Cellular Internet  and its daemon net/mpd5.
It is a PITA to setup.
USB tethering works fine but Bluetooth tethering will be problematic.
For VPN we have security/strongswan as well as security/openvpn and security/openvpn-admin.


----------



## MasterOne (Dec 4, 2019)

Well, considering that net-mgmt/networkmgr is a Python GTK3 app, I'm not sure how well (of it atl all) it integrates with KDE Plasma. I'll have to take a look what to do about cellular. For VPN I only need OpenVPN for now, but security/openvpn-admin looks abandoned since 2006 (not the port, but development, and it's programmed in Mono).

I already assumed that there will be no one-in-all solution like it's done with Network Manager in Linux distribution, so I guess a script-based approach may be the most useful way to go, but I have a lot more catching up to do as it seem.


----------



## MasterOne (Jan 17, 2021)

More than a year later and I'm still on Arch Linux (currently with Gnome) considering my options where to go for the future use of my new laptop. Even though I'm lacking the time to play around, my thoughts have always only turned around Arch Linux, OpenBSD and FreeBSD.

Following their development on and off over time, I'm currently drawn to FreeBSD again, simply because there are some things I need that are not available on OpenBSD.

For a full featured desktop setup on a laptop, the latest KDE Plasma would be my preferred solution, but there is still that problem with managing networks, especially when being used to systemd with NetworkManger and the following usage case in particular:

In my current setup when either choosing to connect to wired ethernet or any WLAN, my OpenVPN connection is automatically established once the network link is up, with the intention that the Internet is always only accessed through the VPN.

Is there any easy way to replicate that behavior when using latest stable FreeBSD with latest KDE Plasma?


----------



## Mjölnir (Jan 21, 2021)

For WLAN, there's a Qt configuation tool: wpa_supplicant_gui, it works well under KDE.  It lets you switch between private and public WLAN easily.  Any user in the _network_ group can comfortably edit the wpa_supplicant.conf(5) via that GUI (instead of editing the text file manually).  It expects the port version, but you can set `sysrc wpa_supplicant_conf_file="/etc/wpa_supplicant.conf"` to let it use the version from base.

For WWAN, I'm using the standard ppp(8) from base.  Obviously, you have to set the provider's EAN and other parameters in the chat script, but that's not hard.  I recommend to use a PIN for the SIM card if you occasionally switch the card between mobile phone and laptop, and to use the same PIN for all cards in case you have more than one.  When I know I don't need WWAN because I have WLAN or (plug-in) LAN, I simply shut the service down: `sudo service ppp stop`, and when I don't want it to dial automagically for some period of time, I use these shell scripts
/root/bin/dial

```
#! /bin/sh
exec pppctl /var/run/pppctl.tun0 set mode auto\; dial
```
/root/bin/hangup

```
#! /bin/sh
exec pppctl /var/run/pppctl.tun0 set mode interactive\; close
```
My user is in the _network_ & _dialer_ groups & minicom(1) helped testing the modem.  As seen in the ppp.linkup/down scripts (remove the .conf), I make use of resolvconf(8) to handle DNS.  PM me if you experience any problems (in case I don't see any thread you might start).


----------



## MasterOne (Jan 21, 2021)

mjollnir, thanks a lot for your feedback.

The WPA Supplicant GUI seems to be promising and will likely solve the issue completely.

WWAN is out of the picture, so it's only about WLAN and LAN (with the help of lagg), and possibly USB tethering (which I have not looked into yet).

The OpenVPN matter may be solvable by using some post-dhcpd magic, but I also haven't found the time to investigate.

As said, I'm still not using FreeBSD, but I'll give it a new try as soon as possible.


----------

