Skip to content

Commit

Permalink
Split Networking section into separate document (#433)
Browse files Browse the repository at this point in the history
  • Loading branch information
igorpecovnik authored Jun 20, 2024
1 parent bca9659 commit 83f8259
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 37 deletions.
37 changes: 0 additions & 37 deletions docs/User-Guide_Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,40 +233,3 @@ On Allwinner devices after switching to boot from NAND or eMMC clearing the boot
## How to install to NAND?

While in theory writing to NAND should still be possible using `armbian-installer`, this requires running a very old 3.4.y kernel which Armbian as dropped support for several years ago. Therefore this feature is to be considered as deprecated and no support for either 3.4.y systems or NAND installations will be provided.

## How to connect to wireless?

Required condition: a board with onboard or supported 3rd party wireless adapter on USB

If you know what is your wireless SSID:

nmtui-connect SSID

![](https://www.armbian.com/wp-content/uploads/2016/12/wifi-1.png)

If you do not know, you can browse and then connect

nmtui-connect

![](https://www.armbian.com/wp-content/uploads/2016/12/wifi-2.png)

## How to set fixed IP?

By default your main network adapter's IP is assigned by your router DHCP server and all network interfaces are managed by **NetworkManager**:

user@boardname:~$ nmcli con show
NAME UUID TYPE DEVICE
Wired connection 1 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx 802-3-ethernet eth0

The connection can now be edited with the following:

nmcli con mod "Wired connection 1"
ipv4.addresses "HOST_IP_ADDRESS"
ipv4.gateway "IP_GATEWAY"
ipv4.dns "DNS_SERVER(S)"
ipv4.dns-search "DOMAIN_NAME"
ipv4.method "manual"

The same changes can also be done with NetworkManagers text user interface:

sudo nmtui
149 changes: 149 additions & 0 deletions docs/User-Guide_Networking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Networking

Armbian uses **Netplan.io** to describe networking configurations. This is the same on minimal IOT, server CLI and desktop images, Debian or Ubuntu based. However, backends are different.

# Minimal images with networkd

Minimal images are using `systemd-networkd`, which has **smaller footprint**. `systemd-networkd` is a system daemon that manages network configurations. It detects and configures network devices as they appear; it can also create virtual network devices. This service can be especially useful to set up complex network configurations. It also works fine on simple connections.

## Default Armbian configuration

Preinstalled configuration will run DHCP on all ethernet devices in order to help you connecting to the device and configure it appropriate.

`/etc/netplan/armbian-default.yaml`

network:
version: 2
renderer: networkd
ethernets:
alleths:
match:
name: e*
dhcp4: true
dhcp6: true

## Configuration examples

### Set fixed IP address

`/etc/netplan/armbian-default.yaml`

network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 10.0.40.199/24

### Connect to wireless hotspot

It is recommended to make a separate config file for wireless network.

Generate a file:

sudo nano /etc/netplan/armbian-default.yaml

with content:

version: 2
renderer: networkd
network:
wifis:
wlan0:
dhcp4: true
dhcp6: true
access-points:
"SSID":
password: "password"

Replace `SSID` with the name of your hot-spot and `wlan0` with a device used on your system.

## Applying configuration

Once you are done with configuring your network its time to test syntax and apply it.

### 1. Fix configurations permissions

sudo chmod 600 /etc/netplan/*.yaml

### 2. Test if syntax is correct

sudo netplan try

### 3. Apply configuration

sudo netplan apply

# CLI and desktop images with NetworkManager

Cerver CLI and desktop images are using Network Manager. You can use the same methods as for minimal images.

### Set fixed IP address

`/etc/netplan/armbian-default.yaml`

network:
version: 2
renderer: NetworkManager
ethernets:
eth0:
addresses:
- 10.0.40.199/24

But you can also use CLI / GUI tools

nmtui-connect SSID

![](images/wifi-connect.png)

Replace `SSID` with the name of your hot-spot

nmtui-edit eth0

![](images/edit-connection.png)

Replace `eth0` with the name of your network device.

# Automatic configuration at first run

It is possible to store first run preset network settings to the file `/root/.not_logged_in_yet` which is read and executed at first login.

Mount live image before first run and use this example:

# Set PRESET_NET_CHANGE_DEFAULTS to 1 to apply any network related settings below

PRESET_NET_CHANGE_DEFAULTS="1"

# Enable WiFi or Ethernet.
# NB: If both are enabled, WiFi will take priority and Ethernet will be disabled.

PRESET_NET_ETHERNET_ENABLED=1
PRESET_NET_WIFI_ENABLED=1

# Enter your WiFi creds
# SECURITY WARN: Your wifi keys will be stored in plaintext, no encryption.

PRESET_NET_WIFI_SSID='MySSID'
PRESET_NET_WIFI_KEY='MyWiFiKEY'

# Country code to enable power ratings and channels for your country.

# eg: GB US DE | https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
PRESET_NET_WIFI_COUNTRYCODE='GB'

# If you want to use a static ip, set it here

PRESET_NET_USE_STATIC=1
PRESET_NET_STATIC_IP='192.168.0.100'
PRESET_NET_STATIC_MASK='255.255.255.0'
PRESET_NET_STATIC_GATEWAY='192.168.0.1'
PRESET_NET_STATIC_DNS='9.9.9.9 1.1.1.1'

If you want to use first run automatic configuration at build time, [check this](https://github.com/armbian/build/pull/6194).

1. Copy `cp extensions/preset-firstrun.sh userpatches/extensions/`
2. Edit `userpatches/extensions/preset-firstrun.sh` according to your situation
3. Build with additional parameter `ENABLE_EXTENSIONS=preset-firstrun`

Note: this method also adds new user, sets passwords, ...
Binary file added docs/images/edit-connection.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/wifi-connect.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ nav:
- "Frequently asked questions": "User-Guide_FAQ.md"
- "Advanced Features": "User-Guide_Advanced-Features.md"
- "Fine Tuning": "User-Guide_Fine-Tuning.md"
- "Networking": "User-Guide_Networking.md"
- "Armbian config": "User-Guide_Armbian-Config.md"
- "Armbian DT overlays": "User-Guide_Armbian_overlays.md"
- "Board Support Rules": "User-Guide_Board-Support-Rules.md"
Expand Down

0 comments on commit 83f8259

Please sign in to comment.