Setup the base NetworkManager config/networking. This will help with making the Internet side of networking more dynamic and responsive to devices being added/removed.
If you plug the internet into the LAN/Ethernet port of your Lollipop it will take priority over a WiFi adapter configured for internet which will take priority over a 3G/LTE USB modem configured for internet.
The main configuration files for NetworkManager exist in ```/etc/NetworkManager```. It is *NOT* recommended to edit these files directly. Usually editing the files directly will result in broken networking.
You'll see a number of devices when running ```nmcli dev show``` and it may not be obvious which devices are which. Some tricks for helping identify network devices are below.
```nmtui``` can be used for an ncurses graphical interface for NetworkManager. This is particularly handy if you want to setup a quick WiFi access point for initial configuration.
- Show active connections: ```nmcli connection show --active```
- Show all connections: ```nmcli connection show```
- This will have an ```id``` column that can be used in the below commands
- Enable a connection: ```nmcli connection up [id]```
- Disable a connection: ```nmcli connection down [id]```
- See the status of a networking device (WiFi adapter for example): ```nmcli device status```
- See the information about a networking device: ```nmcli device show [ifname]```
- Add a new connection: ```nmcli connection add ...```. See below for some examples on how to use this command.
- Modify a connection: ```nmcli connection modify ...```. The name and setings you'd like to apply will come afer the ```modify``` portion of the command.
- See [this website (link)](https://www.tecmint.com/configure-network-connections-using-nmcli-tool-in-linux/) for some examples and more information.
By default Armbian sets up at least one network device "behind the scenes" and keeps it "outside" NetworkManager. Given we want to manage our Lollipop through NetworkManager, we need to make a small tweak.
Edit ```/etc/network/interfaces``` and make sure eth0 directives aren't present. Also make sure the ```/etc/network/interfaces.d``` directory is empty.
Some configuration via ```nmcli``` for various networks/interfaces/devices that may or may not be in use at any given moment. These commands just make NetworkManager aware of the overall topology and connections. Routing, firewall and more is setup later.
*Note: Add autoconnect false if you don't want the connection auto started if a device is present*
### Clear Existing
Run ```nmcli connection show``` to get a list of active network connections. We will want to remove all of these.
Run ```nmcli connection del [UUID]``` for each UUID listed in the previous commands output.
This setup will configure the Lollipop's internal WiFi adapter as an access point. NetworkManager assumes you'll have only *one* Access Point active per device at a time. If you'd prefer your wireless access point use 5ghz AND your hardware is capable of 5ghz, skip this step. *Example: the OrangePi PC Plus must be configured as a 2.4ghz access point, unless you are configuring an upgraded or external adapter capable of 5ghz.*
This setup will configure the Lollipop's internal WiFi adapter as an access point. NetworkManager assumes you'll have only *one* Access Point active per device at a time. This section assumes you'd prefer to use 5ghz for WiFi.
5ghz is a good choice if you want more reliable and faster WiFi *IF* your clients support 5ghz. This is *not* recommended if you're not sure.
We recommend using a USB Ethernet adapter for the internet connection of a Lollipop. That said: if you do *not* have access to a USB ethernet adapter, you can substitute ```eth0``` (or equivalent for your board) in the below to configure the internal / on-board ethernet as an internet connection.
*Note: It's assumed you'll be using a USB Ethernet adapter for WAN if needed. This matches the overall use of USB devices that are plugged/unplugged as necessary for WAN needs*
This is a wholly optional step. This sets up the internal ethernet adapter to be an *INTERNAL, NON-INETERNET* device. The setup will allow you to use a switch to share internet with other devices on a local network.
If you're using your Lollipop as a router and have a collection of preferred networks, at the command line (and/or using Cockpit), to switch access points on the fly:
```nmcli con down wan-wifi-connection-name
nmcli con up wan-wifi-connection-name```
If you receive an error message like ```Warning: password for '802-11-wireless-security.psk' not given in 'passwd-file' and nmcli cannot ask without '--ask' option. Error: Connection activation failed.``` the workaround is to include --ask in your nmcli con up command: