kemonine
/
lollipopcloud
Archived
1
0
Fork 0

Update/overhaul NetworkManager docs to be more accessible and include more informaion

This commit is contained in:
KemoNine 2018-08-08 12:08:34 -04:00
parent 7fd4bfbcb9
commit f834a56edf
No known key found for this signature in database
GPG Key ID: 9D79FBF661EC6779
1 changed files with 134 additions and 94 deletions

View File

@ -1,23 +1,87 @@
# Network Manager
```TODO : INCOMPLETE```
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.
Setup overall networking. This is focused on ethernet/WiFi as an internet connection.
## Connection Priority
## Inspiration / Further Reading
We assume LAN/Ethernet > WiFi > 3G/LTE for WAN connection priority. This is the standard priority order that NetworkManager uses internally.
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.
## Configuration Files
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.
## Device Naming
NetworkManager uses the underlying Linux device naming conventions. To put it bluntly: it's a mess.
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.
- ```eth#``` is an on-board, internal ethernet device (the networking jack kind)
- ```wlan#``` is an on-board, internal WiFi device
- ```w######``` is a USB or external WiFi device. It'll usually start with ```w``` and have a lot of other "junk" after it
- ```gsm#``` is a USB cellular modem. These normally only show after ModemManager has been setup and has activated a cellular modem.
## ProTip / Initial Setup
```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.
## Helpful NetworkManager Commands
The below will outline some useful NetworkManager commands that can be used to help with setup and configuration of a Lollipop's network.
### Get Status
Some commands that help getting the status of NetworkManager
- ```nmcli networking connectivity```
- ```nmcli monitor```
- ```nmcli device monitor```
- ```nmcli connection monitor```
### Enable / Disable ALL
Handy if you want to shut down *all* networking for some reason
```nmcli networking on|off```
### Radio Control
Control WiFi / GSM radios
#### Wifi
```nmcli radio wifi [on|off]```
#### 3G/LTE
```nmcli radio wwan [on|off]```
### Connection / Device Related
Some useful commands for adjusting connection/device status
- Reload changes: ```nmcli connection reload```
- 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.
### Inspiration / Further Reading
- [https://developer.gnome.org/NetworkManager/stable/NetworkManager.html](https://developer.gnome.org/NetworkManager/stable/NetworkManager.html)
- [https://developer.gnome.org/NetworkManager/stable/NetworkManager.conf.html](https://developer.gnome.org/NetworkManager/stable/NetworkManager.conf.html)
- [https://developer.gnome.org/NetworkManager/stable/nmcli.html](https://developer.gnome.org/NetworkManager/stable/nmcli.html)
- [https://developer.gnome.org/NetworkManager/stable/nmcli-examples.html](https://developer.gnome.org/NetworkManager/stable/nmcli-examples.html)
## Overview
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.
The author assumes LAN/Ethernet > WiFi > 3G/LTE for connection priority. (*Note: NetworkManager assumes this too*)
## Install / Enable
## Install / Enable Network Manager
``` bash
@ -32,16 +96,14 @@ systemctl start NetworkManager # Start the service
```
## Disable Stock Networking
## Disable Non NetworkManager Networking
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.
Reboot after above cleanup of interfaces file.
## ProTip
```nmtui``` can be used for an ncurses graphical interface for NetworkManager
## Set Hostname
``` bash
@ -51,50 +113,12 @@ systemctl reboot # Reboot to pickup the change
```
## Get Status
Some commands that help getting the status of NetworkManager
- ```nmcli networking connectivity```
- ```nmcli monitor```
- ```nmcli device monitor```
- ```nmcli connection monitor```
## Enable / Disable ALL
Handy if you want to shut down *all* networking for some reason
```nmcli networking on|off```
## Radio Control
Control WiFi / GSM radios
### Wifi
```nmcli radio wifi [on|off]```
### 3G/LTE
```nmcli radio wwan [on|off]```
## Connection / Device Related
Some useful commands for adjusting connection/device status
- ```nmcli connection reload # Reload any changes / updates (this isn't automagic by default)```
- ```nmcli connection show --active```
- ```nmcli connection up [id]```
- ```nmcli connection down [id]```
- ```nmcli device status```
- ```nmcli device show [ifname]```
- ```nmcli device connect [ifname]```
- ```nmcli device disconnect [ifname]```
## Disable Orange Pi Zero Internal WiFi
If you're using an Orange Pi Zero, the internal WiFi adapter is unstable at best. The following will disable the adapter.
*Note: this ONLY applies to the Orange Pi Zero (not the ```Plus``` or ```2``` models)*
``` bash
nmcli device status # Verify the internal WiFi is shwoing as wlan0
@ -103,7 +127,7 @@ nmcli device set wlan0 autoconnect no
```
## Setup Networks
## Setup Networking
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.
@ -115,28 +139,12 @@ Run ```nmcli connection show``` to get a list of active network connections. We
Run ```nmcli connection del [UUID]``` for each UUID listed in the previous commands output.
### Management Ethernet
*Note: It's assumed the on-board ethernet adapter will be used for management and an EXTERNAL USB Ethernet adapter used for WAN (if needed)*
``` bash
# Management via usb ethernet adapter
# includes network sharing
nmcli connection add save yes \
type ethernet \
con-name mgmt \
ifname eth0 \
-- \
ipv4.method shared \
ipv4.addr 172.16.16.16/24 \
ipv6.method ignore
nmcli device set eth0 autoconnect yes
```
### WiFi 2.4ghz Access Point
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, skip this step.
2.4ghz is a good choice and a default for most commerical access points for compatibility with WiFi clients. This is recommended if you're not sure.
*Note: You can use ```802-11-wireless.channel #``` in the below command to force a channel to be used*
``` bash
@ -165,6 +173,10 @@ nmcli connection add save yes \
### WiFi 5ghz Access Point
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.
*Note: You can use ```802-11-wireless.channel #``` in the below command to force a channel to be used*
``` bash
@ -191,26 +203,10 @@ nmcli connection add save yes \
```
### WAN - Ethernet (External USB Adapter)
*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*
``` bash
# WAN via ethernet cable
nmcli connection add save yes \
type ethernet \
con-name wan-eth \
ifname eth1 \
-- \
ipv4.method auto \
ipv6.method auto
nmcli device set eth1 autoconnect yes
```
### WAN - WiFi Bridge
This will configure a WiFi adapter in client mode to provide internet to a Lollipop.
``` bash
# Get list of access points in the area
@ -232,6 +228,50 @@ nmcli device set [wifi iface] autoconnect yes
```
### WAN - Ethernet (External USB Adapter)
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*
``` bash
# WAN via ethernet cable
nmcli connection add save yes \
type ethernet \
con-name wan-eth \
ifname eth1 \
-- \
ipv4.method auto \
ipv6.method auto
nmcli device set eth1 autoconnect yes
```
### Management Ethernet
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 do not have a USB ethernet device, do *NOT* run this configuration step. Instead, configure your on-board adapter (see above) for internet.
*Note: It's assumed the on-board ethernet adapter will be used for management and an EXTERNAL USB Ethernet adapter used for WAN (if needed)*
``` bash
# Management via usb ethernet adapter
# includes network sharing
nmcli connection add save yes \
type ethernet \
con-name mgmt \
ifname eth0 \
-- \
ipv4.method shared \
ipv4.addr 172.16.16.16/24 \
ipv6.method ignore
nmcli device set eth0 autoconnect yes
```
### WAN - GSM (3G/LTE)
See [Modem Manager](modem_manager.md) for details on integrating a 3G/LTE modem into the networking setup.