Network Configuration
MocaccinoOS uses NetworkManager to manage network connections by default. It handles wired and wireless connections and can be controlled through the desktop environment, the nmcli command-line tool, or the nmtui text interface.
For users who prefer a more minimal network configuration, systemd-networkd is also available as an alternative.
NetworkManager
NetworkManager is the recommended option for most desktop installations. It automatically manages network interfaces and connections, including Wi-Fi and Ethernet.
Checking network status
Check the general NetworkManager status:
|
|
List available network interfaces and their current state:
|
|
List configured network connections:
|
|
To inspect a particular connection:
|
|
The connection name may differ depending on your installation.
Wi-Fi
List available wireless networks:
|
|
Connect to a wireless network:
|
|
Replace SSID and password with the network name and its password.
To disconnect a wireless interface:
|
|
Replace wlan0 with the name of your wireless interface. You can find it using nmcli device status.
Enable or disable Wi-Fi:
|
|
Wired connections
Ethernet connections are normally configured automatically using DHCP when a network cable is connected.
To activate or deactivate an existing connection:
|
|
Use nmcli connection show to find the correct connection name.
Configuring a static IP address
NetworkManager normally obtains an IP address automatically through DHCP. If your network requires a static address, you can configure an existing connection manually.
First, identify the connection:
|
|
Configure the connection with a static IPv4 address:
|
|
Replace the example address, gateway and DNS server with values appropriate for your network.
Activate the connection again to apply the changes:
|
|
To return to automatic DHCP configuration:
|
|
Then reactivate the connection:
|
|
Using nmtui
If you prefer a menu-driven interface, NetworkManager includes nmtui.
Start it from a terminal:
|
|
The interface allows you to:
- Activate and deactivate connections.
- Edit existing network profiles.
- Configure wireless and wired connections.
- Set static IP addresses and DNS servers.
This can be a convenient alternative to using nmcli directly.
systemd-networkd
systemd-networkd is an alternative to NetworkManager. It is primarily intended for systems where network connections are configured through system files rather than a desktop network manager.
Important: Do not run NetworkManager and systemd-networkd to manage the same network interfaces. Switching network managers can interrupt your network connection. If you are connected remotely, make sure you have an alternative way to access the machine before proceeding.
Switching from NetworkManager
Stop and disable NetworkManager:
|
|
Enable systemd-networkd:
|
|
Enable systemd-resolved for DNS resolution:
|
|
If your system does not already use the systemd-resolved stub resolver, configure /etc/resolv.conf to point to it:
|
|
This makes applications use systemd-resolved for DNS queries.
Identifying network interfaces
List the available network interfaces:
|
|
You can also use:
|
|
Example output:
|
|
Note the name of the interface you want to configure, such as enp3s0.
Configuring DHCP
Create a network configuration file:
|
|
Replace enp3s0 with your actual interface name.
For automatic DHCP configuration, use:
|
|
Save the file and restart systemd-networkd:
|
|
Configuring a static IP address
To configure a static IPv4 address, use the following configuration:
|
|
Replace the example addresses with values appropriate for your network.
Restart systemd-networkd to apply the configuration:
|
|
Checking network status
Check the status of network interfaces:
|
|
Inspect a specific interface:
|
|
Check the service status:
|
|
For DNS troubleshooting, inspect systemd-resolved:
|
|
Firewall
MocaccinoOS includes the Linux kernel’s nftables firewall framework and the nft userspace utility.
A firewall is not automatically configured simply because these components are installed. You can create your own ruleset according to the services running on your system.
Checking the firewall
Check whether the nftables service is running:
|
|
Display the currently active firewall rules:
|
|
Configuring nftables
The main configuration file is:
|
|
You can edit it with:
|
|
The following example provides a basic incoming-traffic filtering policy for a typical desktop system using DHCP. It allows loopback traffic, established connections, ICMP traffic and DHCP replies. It also allows SSH connections on port 22.
|
|
Important: This is an example, not a universal firewall configuration. Remove the SSH rule if you do not need remote access, and add rules for any other services you intend to expose. Systems using VPNs, containers, network bridges or other networking configurations may need additional rules.
Before applying a restrictive firewall policy, make sure you understand which services your system needs. Incorrect rules can interrupt network access.
Enabling nftables
After saving the configuration, check it for syntax errors:
|
|
If the configuration is valid, enable the service:
|
|
Display the active ruleset:
|
|
You can add rules to the input chain to allow additional services. Common examples include:
| Service | Port |
|---|---|
| SSH | 22/tcp |
| HTTP | 80/tcp |
| HTTPS | 443/tcp |
| FTP | 21/tcp, plus the configured passive port range |
| Samba | 445/tcp, plus other ports if required |
Remember that allowing a port through the firewall does not automatically enable or configure the corresponding service.
Further reading
- NetworkManager documentation
- systemd-networkd documentation
- systemd-resolved documentation
- nftables documentation