A how-to manual: get nmtui working on Ubuntu Server, move around its screens, set a static address, activate a profile, build a bridge and a VLAN, set the hostname, and see what it saves, all run for real on a virtual machine with four network ports.
▶Prefer to watch? This short video runs this page's main commands in a real lab, with on-screen captions and no voiceover. Click to play, or watch it on YouTube.
nmtui: set up the network from a text menu, over SSH or on the console
sudo nmtui
sudo nmcli device status
ip -4 -br addr
nmtui is the text-mode menu of NetworkManager. Instead of long nmcli commands or a YAML file, you move through screens with the arrow keys and Tab: pick a connection, change its settings, switch it on. It is part of the network-manager package on Ubuntu and Debian (NetworkManager-tui on Fedora and Red Hat). It changes exactly the same profiles as nmcli does.
On Ubuntu Server the network is normally run by netplan and systemd-networkd, and nmtui is not installed. The first sections show how to turn NetworkManager on, which has one catch, and the rest use nmtui for the jobs people actually do: a static address, a bridge, a VLAN and the hostname. This page is the written version of the Sysadmin video.
Every step below ran for real on Ubuntu Server 24.04.5 (a virtual machine with four virtual network ports, network-manager 1.46.0). The screens are copied from the program as it ran. The lab has no Wi-Fi radio, so Wi-Fi is not tested.
What nmtui is for
Use it when you want to change the network of a machine by hand and a menu is easier than a file:
give a server a fixed address Edit a connection, IPv4 Manual
switch a profile on or off Activate a connection
build a bridge for virtual machines Edit a connection, Add, Bridge
tag traffic with a VLAN Edit a connection, Add, VLAN
set the hostname Set system hostname
see what is configured the Edit a connection list
What it is not: a script tool. It needs a terminal and a person, so for many servers use nmcli, netplan files or configuration management. The last sections show the nmcli equivalents.
nmtui is a front end. The settings you save are stored by NetworkManager, and on Ubuntu with netplan they end up as files in /etc/netplan (see "Where nmtui saves its profiles"). Nothing runs in the background and nothing is added to the system besides the package.
The lab
One Ubuntu Server 24.04.5 virtual machine with four virtual Ethernet ports. The first (enp0s2) carries the SSH connection used to run everything; the other three each sit on their own small network with a DHCP server.
enp0s2 10.0.2.15/24 management (SSH). Do not switch it off while logged in over it
enp0s3 10.20.1.15/24 DHCP, network 10.20.1.0/24, gateway 10.20.1.2, DNS server 10.20.1.3
enp0s4 10.20.2.15/24 DHCP, network 10.20.2.0/24
enp0s5 10.20.3.15/24 DHCP, network 10.20.3.0/24
The prompt in the examples is ubuntu@ubuntu-lab:~$. Addresses in the 10.20.x.x networks and 192.168.20.0/24 are private lab addresses: use your own.
Get nmtui on Ubuntu Server
A fresh Ubuntu Server has netplan but neither nmtui nor nmcli:
$ which nmtui nmcli netplan
/usr/sbin/netplan
$ ls /etc/netplan
50-cloud-init.yaml
Install NetworkManager:
$ sudo apt install network-manager
$ which nmtui nmcli
/usr/bin/nmtui
/usr/bin/nmcli
$ dpkg -l network-manager | tail -n 1
ii network-manager 1.46.0-1ubuntu2.8 amd64 network management framework (daemon and userspace tools)
$ systemctl is-active NetworkManager
active
NetworkManager is running, but it manages nothing yet:
$ nmcli device
DEVICE TYPE STATE CONNECTION
enp0s2 ethernet unmanaged --
enp0s3 ethernet unmanaged --
enp0s4 ethernet unmanaged --
enp0s5 ethernet unmanaged --
lo loopback unmanaged --
The reason is a file the package ships:
$ cat /usr/lib/NetworkManager/conf.d/10-globally-managed-devices.conf
[keyfile]
unmanaged-devices=*,except:type:wifi,except:type:gsm,except:type:cdma
Everything except Wi-Fi and mobile broadband is left to netplan. nmtui would show an empty list. To hand the ports to NetworkManager, tell netplan to use it as the renderer.
Hand the ports to NetworkManager (netplan)
The stock netplan file, written by cloud-init:
$ cat /etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
enp0s2:
match:
macaddress: "52:54:00:aa:00:01"
dhcp4: true
dhcp6: true
set-name: "enp0s2"
Add one line, renderer: NetworkManager, under version:
$ sudo sed -i 's/^ version: 2/ version: 2\n renderer: NetworkManager/' /etc/netplan/50-cloud-init.yaml
$ cat /etc/netplan/50-cloud-init.yaml
network:
version: 2
renderer: NetworkManager
ethernets:
enp0s2:
match:
macaddress: "52:54:00:aa:00:01"
dhcp4: true
dhcp6: true
set-name: "enp0s2"
On a cloud image, cloud-init rewrites that file at boot and would undo the change. Tell it to leave the network alone:
$ echo 'network: {config: disabled}' | sudo tee /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
network: {config: disabled}
Apply it. The lab ran this over SSH, on the management port itself, and the connection stayed up with the same address:
$ sudo netplan generate
$ sudo netplan apply
$ nmcli device
DEVICE TYPE STATE CONNECTION
enp0s2 ethernet connected netplan-enp0s2
enp0s3 ethernet connected Wired connection 1
enp0s4 ethernet connected Wired connection 2
enp0s5 ethernet connected Wired connection 3
lo loopback connected (externally) lo
$ ip -4 -br addr
lo UNKNOWN 127.0.0.1/8
enp0s2 UP 10.0.2.15/24
enp0s3 UP 10.20.1.15/24
enp0s4 UP 10.20.2.15/24
enp0s5 UP 10.20.3.15/24
NetworkManager made a DHCP profile for each of the three ports that had none (Wired connection 1 to 3) and took over the management port as netplan-enp0s2. The change survived a reboot of the lab VM. A real machine with a static netplan file needs that file converted first: nmtui would show only what netplan hands it. Do this on a console or with a way back before you do it on a machine that is only reachable over the network.
Start nmtui and find your way around
$ sudo nmtui
┌─┤ NetworkManager TUI ├──┐
│ │
│ Please select an option │
│ │
│ Edit a connection │
│ Activate a connection │
│ Set system hostname │
│ Radio │
│ │
│ Quit │
│ │
│ <OK> │
│ │
└─────────────────────────┘
Over SSH, nmtui needs sudo. Without it you can browse every screen, but <OK> on a form answers "Unable to save connection: Insufficient privileges" (SSH is not a local desktop session). nmcli says the same.
The main menu has five entries:
Edit a connection the saved profiles: change, add, delete
Activate a connection switch a profile on or off
Set system hostname the machine's name
Radio Wi-Fi and mobile broadband switches
Quit
Keys that worked in every screen of the lab:
Up, Down move in a list or a menu
Tab next field or button (the red highlight shows where you are)
Shift+Tab previous field or button
Enter press the button, open the list, accept
Esc go back one screen
Ctrl+U clear the text field you are in, then type the new value
A text field shows underscores. Typing an address and pressing Tab does not jump to the next row: it goes to that row's <Remove> button first, then <Add...>, then the next field.
The Radio entry shows the Wi-Fi and WWAN switches. In the lab both say "Hardware: Missing", as expected without a radio; it was not changed.
Edit a connection: the list and a profile
Edit a connection opens the list of profiles. A profile is a saved set of settings that NetworkManager can apply to a port:
┌───────────────────────────────────────┐
│ │
│ ┌─────────────────────────┐ │
│ │ Ethernet ↑ │ <Add> │
│ │ Wired connection 3 ▒ │ │
│ │ Wired connection 2 ▒ │ <Edit...> │
│ │ Wired connection 1 ▒ │ │
│ │ netplan-enp0s2 ▒ │ <Delete> │
│ │ ↓ │ <Back> │
│ └─────────────────────────┘ │
│ │
└───────────────────────────────────────┘
The first row of the list is selected. The buttons on the right are reached with Tab: Add, Edit..., Delete and Back. Enter on a row opens it. The order of the rows changes with use (the lab showed lab-static first once it had been used).
Open Wired connection 1 (the profile of enp0s3):
┌───────────────────────────┤ Edit Connection ├───────────────────────────┐
│ │
│ Profile name Wired connection 1______________________ │
│ Device enp0s3 (52:54:00:AA:01:01)______________ │
│ │
│ ═ ETHERNET <Show> │
│ ═ 802.1X SECURITY <Show> │
│ │
│ ═ IPv4 CONFIGURATION <Automatic> <Show> │
│ ═ IPv6 CONFIGURATION <Automatic> <Show> │
│ │
│ [X] Automatically connect │
│ [X] Available to all users │
│ │
│ <Cancel> <OK> │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└─────────────────────────────────────────────────────────────────────────┘
The top of the form holds the profile name and the device. ETHERNET, 802.1X SECURITY, IPv4 and IPv6 are sections: <Show> opens one, <Hide> closes it. At the bottom: Automatically connect (the profile starts by itself) and Available to all users, then <Cancel> and <OK>.
Rename the profile: Ctrl+U clears the field, then type the new name (the video uses lab-static):
┌───────────────────────────┤ Edit Connection ├───────────────────────────┐
│ Profile name lab-static______________________________ │
│ Device enp0s3 (52:54:00:AA:01:01)______________ │
└─────────────────────────────────────────────────────────────────────────┘
A clear name matters later: it is what the Activate list and nmcli show.
A static IPv4 address
IPv4 CONFIGURATION says <Automatic>, which means DHCP. Tab four times from the profile name to it, press Enter and pick Manual:
┌───────────────────────────┤ Edit Connection ├───────────────────────────┐
│ Profile name lab-static______________________________ │
│ ═ IPv4 CONFIGURATION <Manual> <Show> │
│ ═ IPv6 CONFIGURATION <Automatic> <Show> │
└─────────────────────────────────────────────────────────────────────────┘
Tab to <Show> and press Enter. The address fields appear, and focus moves to <Hide>:
┌───────────────────────────┤ Edit Connection ├───────────────────────────┐
│ ╤ IPv4 CONFIGURATION <Manual> <Hide> ▒│
│ │ Addresses <Add...> ▒│
│ │ Gateway _________________________ ▒│
│ │ DNS servers <Add...> ▒│
│ │ Search domains <Add...> ▒│
│ │ Routing (No custom routes) <Edit...> ▒│
└─────────────────────────────────────────────────────────────────────────┘
Tab to Addresses <Add...>, Enter, and type the address with its prefix length (10.20.1.50/24 is address and netmask together). Tab three times (Remove, Add, then the Gateway field) and type the gateway. Tab to DNS servers <Add...>, Enter and type the DNS server:
┌───────────────────────────┤ Edit Connection ├───────────────────────────┐
│ ╤ IPv4 CONFIGURATION <Manual> <Hide> ▒│
│ │ Addresses 10.20.1.50/24____________ <Remove> ▒│
│ │ <Add...> ▒│
│ │ Gateway 10.20.1.2________________ ▒│
│ │ DNS servers 10.20.1.3________________ <Remove> ▒│
│ │ <Add...> ▒│
│ │ Search domains <Add...> ▒│
└─────────────────────────────────────────────────────────────────────────┘
The filled form of the lab:
Addresses 10.20.1.50/24
Gateway 10.20.1.2
DNS servers 10.20.1.3
Tab to <OK> and press Enter. With the IPv4 section open that is fourteen Tabs from the DNS field (the red highlight passes Remove, Add..., Search domains, Routing, four tick boxes, IPv6, two more tick boxes and Cancel). The profile is saved and the list returns, now showing lab-static:
┌───────────────────────────────────────┐
│ │
│ ┌─────────────────────────┐ │
│ │ Ethernet ↑ │ <Add> │
│ │ Wired connection 3 ▒ │ │
│ │ Wired connection 2 ▒ │ <Edit...> │
│ │ lab-static ▒ │ │
│ │ netplan-enp0s2 ▒ │ <Delete> │
│ │ ↓ │ <Back> │
│ └─────────────────────────┘ │
│ │
└───────────────────────────────────────┘
Saved is not applied. The lab checked right after saving: enp0s3 still had its old DHCP address, 10.20.1.15/24. The profile is stored; the port runs on until you activate it.
Activate a connection
Esc returns to the main menu. Activate a connection lists every port with its profile; a star marks the active ones:
┌──────────────────────────────────────────┐
│ │
│ ┌─────────────────────────┐ │
│ │ Ethernet (enp0s2) ↑ │ <Deactivate> │
│ │ * netplan-enp0s2 ▒ │ │
│ │ Ethernet (enp0s3) ▒ │ │
│ │ * lab-static ▮ │ │
│ │ Ethernet (enp0s4) ▒ │ │
│ │ * Wired connection 2 ▒ │ │
│ │ Ethernet (enp0s5) ▒ │ │
│ │ * Wired connection 3 ▒ │ │
│ │ ↓ │ <Back> │
│ └─────────────────────────┘ │
│ │
└──────────────────────────────────────────┘
Careful: the highlight starts on the first row, which here is netplan-enp0s2, the profile of the port SSH runs on. Pressing Enter there would switch it off and cut the session. Move Down to the row you want first.
Down once to lab-static and Enter. The button on the right says <Deactivate> for an active profile, and Enter on the row switches it off. The star disappears:
┌──────────────────────────────────────────┐
│ │
│ ┌─────────────────────────┐ │
│ │ Ethernet (enp0s2) ↑ │ <Deactivate> │
│ │ * netplan-enp0s2 ▒ │ │
│ │ Ethernet (enp0s3) ▒ │ │
│ │ lab-static ▮ │ │
│ │ Ethernet (enp0s4) ▒ │ │
│ │ * Wired connection 2 ▒ │ │
│ │ Ethernet (enp0s5) ▒ │ │
│ │ * Wired connection 3 ▒ │ │
│ │ ↓ │ <Back> │
│ └─────────────────────────┘ │
│ │
└──────────────────────────────────────────┘
The highlight jumps back to the first row after every change. Down, Enter again switches lab-static on (the star returns):
┌──────────────────────────────────────────┐
│ │
│ ┌─────────────────────────┐ │
│ │ Ethernet (enp0s2) ↑ │ <Deactivate> │
│ │ * netplan-enp0s2 ▒ │ │
│ │ Ethernet (enp0s3) ▒ │ │
│ │ * lab-static ▮ │ │
│ │ Ethernet (enp0s4) ▒ │ │
│ │ * Wired connection 2 ▒ │ │
│ │ Ethernet (enp0s5) ▒ │ │
│ │ * Wired connection 3 ▒ │ │
│ │ ↓ │ <Back> │
│ └─────────────────────────┘ │
│ │
└──────────────────────────────────────────┘
Quit nmtui (Esc, then Down to Quit, Enter) and check the port:
$ ip -4 -br addr show enp0s3
enp0s3 UP 10.20.1.50/24
$ ip route | grep enp0s3
default via 10.20.1.2 dev enp0s3 proto static metric 104
10.20.1.0/24 dev enp0s3 proto kernel scope link src 10.20.1.50 metric 104
$ nmcli -g IP4.DNS device show enp0s3
10.20.1.3
ubuntu@ubuntu-lab:~$
The address, the default route and the DNS server all come from the profile. The lab confirmed the same from the other direction: with the profile saved but not activated, enp0s3 kept the DHCP address.
Where nmtui saves its profiles (netplan)
On Ubuntu with the NetworkManager renderer, each profile you save becomes a file in /etc/netplan. The old directory stays empty:
$ sudo ls /etc/NetworkManager/system-connections
$ sudo ls /etc/netplan
50-cloud-init.yaml 90-NM-f738bbc2-8bac-3eb5-bae5-11f55465df5f.yaml
The name carries the profile's UUID (the lab's lab-static profile kept the UUID of Wired connection 1, because it is the same profile, renamed). Its contents:
$ sudo cat /etc/netplan/90-NM-f738bbc2-8bac-3eb5-bae5-11f55465df5f.yaml
network:
version: 2
ethernets:
NM-f738bbc2-8bac-3eb5-bae5-11f55465df5f:
renderer: NetworkManager
match:
name: "enp0s3"
addresses:
- "10.20.1.50/24"
nameservers:
addresses:
- 10.20.1.3
dhcp6: true
wakeonlan: true
networkmanager:
uuid: "f738bbc2-8bac-3eb5-bae5-11f55465df5f"
name: "lab-static"
passthrough:
connection.autoconnect-priority: "-999"
connection.timestamp: "1793205627"
ethernet._: ""
ipv4.address1: "10.20.1.50/24,10.20.1.2"
ipv4.method: "manual"
ipv6.addr-gen-mode: "default"
ipv6.ip6-privacy: "-1"
proxy._: ""
The address and the DNS server are normal netplan keys. The gateway is kept in the passthrough block, as the second item of ipv4.address1. The timestamp changes whenever the profile is used. The auto-created DHCP profiles (Wired connection 2 and 3) are kept in memory and under /run, not in /etc/netplan, until you edit and save them.
You can edit these files, but let nmtui or nmcli do it: they keep the file and the running profile in step. Back them up with the rest of /etc/netplan.
Delete a profile and free a port
A port can only belong to one profile at a time. Before enp0s5 can join a bridge, its own DHCP profile must go. In the Edit a connection list, select Wired connection 3 (Down), Tab three times to <Delete> and press Enter. nmtui asks first:
┌───────────────────────────────────────┐
│ │
│ ┌─────────────────────────┐ │
│ │ Ethernet ↑ │ <Add> │
│ │ lab-static ▒ │ │
│ │ Wired connection 3 ▒ │ <Edit...> │
│ │ Wired connection 2 ▒ │ │
┌─────────────────────────────────────┐ │
│ │ │
│ Are you sure you want to delete the │ │
│ connection 'Wired connection 3'? │ │
│ │ │
│ ┌────────┐ ┌────────┐ │ │
│ │ Cancel │ │ Delete │ │ │
│ └────────┘ └────────┘ │ │
│ │ │
│ │ │
└─────────────────────────────────────┘ │
│ │
│ │ ↓ │ <Back> │
│ └─────────────────────────┘ │
│ │
└───────────────────────────────────────┘
Tab to <Delete> and press Enter. The row disappears:
┌───────────────────────────────────────┐
│ │
│ ┌─────────────────────────┐ │
│ │ Ethernet ↑ │ <Add> │
│ │ lab-static ▒ │ │
│ │ Wired connection 2 ▒ │ <Edit...> │
│ │ netplan-enp0s2 ▒ │ │
│ │ ▒ │ <Delete> │
│ │ ↓ │ <Back> │
│ └─────────────────────────┘ │
│ │
└───────────────────────────────────────┘
Skipping this was tried in the lab: the bridge profile and its port profile were saved, but enp0s5 stayed on Wired connection 3 and br0 stayed in "connecting (getting IP configuration)". Deleting a profile does not touch hardware or files outside NetworkManager.
A bridge
A bridge joins ports into one network segment, the usual setup for virtual machines. In Edit a connection press Esc, Enter, Tab to <Add> and Enter. The list of connection types:
┌───────────────────────────────────────┐
│ │
│ ┌─────────────────────────┐ │
│ │ Ethernet ↑ │ <Add> │
│ │ lab-static ▒ │ │
│ │ Wired connection 2 ▒ │ <Edit...> │
│ │ netplan-enp0s2 ▒ │ │
┌──────────────────────┤ New Connection ├──────────────────────┐
│ │
│ Select the type of connection you wish to create. │
│ │
│ DSL ↑ │
│ Ethernet ▮ │
│ InfiniBand ▒ │
│ Wi-Fi ▒ │
│ Bond ↓ │
│ │
│ <Cancel> <Create> │
│ │
└──────────────────────────────────────────────────────────────┘
│ │ ▒ │ │
│ │ ↓ │ <Back> │
│ └─────────────────────────┘ │
│ │
└───────────────────────────────────────┘
The full list is DSL, Ethernet, InfiniBand, Wi-Fi, Bond, Bridge, IP tunnel, MACsec, Team and VLAN. Down five times to Bridge and Enter for the form:
┌───────────────────────────┤ Edit Connection ├───────────────────────────┐
│ ↑│
│ Profile name Bridge connection 1_____________________ ▮│
│ Device nm-bridge_______________________________ ▒│
│ ▒│
│ ╤ BRIDGE <Hide> ▒│
│ │ Slaves ▒│
│ │ ┌───────────────────────────────────────────────┐ ▒│
│ │ │ ↑ │ <Add> ▒│
│ │ │ ▮ │ ▒│
│ │ │ ▒ │ <Edit...> ▒│
│ │ │ ▒ │ ▒│
│ │ │ ▒ │ <Delete> ▒│
│ │ │ ↓ │ ▒│
│ │ └───────────────────────────────────────────────┘ ▒│
│ │ Aging time 300_______ seconds ▒│
│ │ [X] Enable IGMP snooping ▒│
│ │ [X] Enable STP (Spanning Tree Protocol) ▒│
│ │ Priority 32768_____ ▒│
│ │ Forward delay 15________ seconds ▒│
│ │ Hello time 2_________ seconds ▒│
│ │ Max age 20________ seconds ▒│
│ │ Group forward mask 0_________ ▒│
│ └ ▒│
│ ↓│
└─────────────────────────────────────────────────────────────────────────┘
Ctrl+U and type the profile name (br-lab). Tab, Ctrl+U, and the device name (br0), which is the interface it will create. Tab three times to the Slaves <Add> button (Hide, the slaves list, Add) and press Enter, then Enter again on Ethernet. The port form asks for the profile name and device: br-port and enp0s5:
┌─┌─────────────────────────┤ Edit Connection ├──────────────────────────┐┐
│ │ Profile name br-port_________________________________ │
│ │ Device enp0s5__________________________________ │
│ │ ═ ETHERNET <Show> │
│ │ ═ 802.1X SECURITY <Show> │
│ │ ╤ BRIDGE PORT <Hide> │
│ │ │ Priority 32________ │
│ │ │ Path cost 100_______ │
│ │ │ [ ] Hairpin mode │
│ │ └ │
│ │ [X] Automatically connect │
│ │ [X] Available to all users │
│ │ <Cancel> <OK> │
└─└──────────────────────────────────────────────────────────────────────┘
Ten Tabs to <OK> and Enter. The bridge form lists the port:
┌───────────────────────────┤ Edit Connection ├───────────────────────────┐
│ ↑│
│ Profile name br-lab__________________________________ ▮│
│ Device br0_____________________________________ ▒│
│ ▒│
│ ╤ BRIDGE <Hide> ▒│
│ │ Slaves ▒│
│ │ ┌───────────────────────────────────────────────┐ ▒│
│ │ │ br-port ↑ │ <Add> ▒│
│ │ │ ▒ │ ▒│
│ │ │ ▒ │ <Edit...> ▒│
│ │ │ ▒ │ ▒│
│ │ │ ▮ │ <Delete> ▒│
│ │ │ ↓ │ ▒│
│ │ └───────────────────────────────────────────────┘ ▒│
│ │ Aging time 300_______ seconds ▒│
│ │ [X] Enable IGMP snooping ▒│
│ │ [X] Enable STP (Spanning Tree Protocol) ▒│
│ │ Priority 32768_____ ▒│
│ │ Forward delay 15________ seconds ▒│
│ │ Hello time 2_________ seconds ▒│
│ │ Max age 20________ seconds ▒│
│ │ Group forward mask 0_________ ▒│
│ └ ▒│
│ ↓│
└─────────────────────────────────────────────────────────────────────────┘
The bridge form keeps the spanning tree (STP) settings below the list, with their defaults (STP on, priority 32768, forward delay 15 seconds, hello time 2, max age 20, aging time 300). Its IPv4 section is at the bottom of the form and was left on Automatic: the bridge asks for an address by DHCP. Tab to <OK> (eighteen Tabs from the slaves <Add> button) and Enter. The list now shows a Bridge group:
┌───────────────────────────────────────┐
│ │
│ ┌─────────────────────────┐ │
│ │ Ethernet ↑ │ <Add> │
│ │ lab-static ▒ │ │
│ │ Wired connection 2 ▒ │ <Edit...> │
│ │ netplan-enp0s2 ▒ │ │
│ │ Bridge ▒ │ <Delete> │
│ │ br-lab ▒ │ │
│ │ ↓ │ <Back> │
│ └─────────────────────────┘ │
│ │
└───────────────────────────────────────┘
Quit nmtui and check. NetworkManager starts the bridge by itself:
$ sleep 20; nmcli device status | grep -E "br0|enp0s5"
br0 bridge connected br-lab
enp0s5 ethernet connected br-port
$ ip -4 -br addr show br0
br0 UP 10.20.3.16/24
$ ip -br link show master br0
enp0s5 UP 52:54:00:aa:03:01 <BROADCAST,MULTICAST,UP,LOWER_UP>
ubuntu@ubuntu-lab:~$
A new bridge takes some time before it passes traffic (spanning tree), so the address arrives late. The lab's first check, eight seconds after quitting, still said "connecting (getting IP configuration)"; after twenty seconds the bridge was connected and had 10.20.3.16/24. The same bridge created with nmcli (see "The same with nmcli") was still connecting at twenty seconds. Wait before you decide it failed. enp0s5 is now a port of br0 and carries no address of its own.
A VLAN
A VLAN tags the traffic of one network inside another. The tag 20 on enp0s3 becomes its own interface. Edit a connection, Tab to <Add>, Enter, Down nine times to VLAN and Enter:
┌───────────────────────────┤ Edit Connection ├───────────────────────────┐
│ │
│ Profile name vlan20__________________________________ │
│ Device enp0s3.20_______________________________ │
│ │
│ ╤ VLAN <Hide> │
│ │ Parent enp0s3__________________________________ │
│ │ VLAN id 20______ │
│ │ Cloned MAC address ________________________________________ │
│ │ MTU __________ (default) │
│ └ │
│ │
│ ═ IPv4 CONFIGURATION <Automatic> <Show> │
│ ═ IPv6 CONFIGURATION <Automatic> <Show> │
│ │
│ [X] Automatically connect │
│ [X] Available to all users │
│ │
│ <Cancel> <OK> │
│ │
│ │
│ │
│ │
│ │
└─────────────────────────────────────────────────────────────────────────┘
Type the profile name (vlan20), Tab, and the device name enp0s3.20. When you Tab out of the device field, nmtui fills in the parent (enp0s3) and the VLAN id (20) itself. Tab five times to IPv4 CONFIGURATION, Enter, Down twice to Manual and Enter, Tab to <Show> and Enter, Tab to <Add...>, Enter, and type 192.168.20.5/24:
┌───────────────────────────┤ Edit Connection ├───────────────────────────┐
│ ↑│
│ Profile name vlan20__________________________________ ▮│
│ Device enp0s3.20_______________________________ ▒│
│ ▒│
│ ╤ VLAN <Hide> ▒│
│ │ Parent enp0s3__________________________________ ▒│
│ │ VLAN id 20______ ▒│
│ │ Cloned MAC address ________________________________________ ▒│
│ │ MTU __________ (default) ▒│
│ └ ▒│
│ ▒│
│ ╤ IPv4 CONFIGURATION <Manual> <Hide> ▒│
│ │ Addresses 192.168.20.5/24__________ <Remove> ▒│
│ │ <Add...> ▒│
│ │ Gateway _________________________ ▒│
│ │ DNS servers <Add...> ▒│
│ │ Search domains <Add...> ▒│
│ │ Routing (No custom routes) <Edit...> ▒│
│ │ [ ] Never use this network for default route ▒│
│ │ [ ] Ignore automatically obtained routes ▒│
│ │ [ ] Ignore automatically obtained DNS parameters ▒│
│ ↓│
└─────────────────────────────────────────────────────────────────────────┘
Sixteen Tabs from the address field reach <OK>. Quit nmtui and check:
$ sleep 3; ip -4 -br addr show enp0s3.20
enp0s3.20@enp0s3 UP 192.168.20.5/24
$ ip -d link show enp0s3.20 | grep -o 'vlan protocol 802.1Q id [0-9]*'
vlan protocol 802.1Q id 20
ubuntu@ubuntu-lab:~$
The interface enp0s3.20 exists with VLAN id 20 and its own address. The lab has no switch that sends tagged frames, so only the interface was checked; no traffic crossed it.
Set the hostname
Set system hostname is the third entry of the main menu:
┌─┤ NetworkManager TUI ├──┐
│ │
│ Please select an option │
┌─────────────────┤ Set Hostname ├──────────────────┐
│ │
│ Hostname web01___________________________________ │
│ │
│ <Cancel> <OK> │
│ │
└───────────────────────────────────────────────────┘
│ <OK> │
│ │
└─────────────────────────┘
Ctrl+U, type the new name (web01), Tab twice to <OK>, Enter. nmtui asks you to confirm; the dialog is small and sits over the menu:
┌────────────────────────────────┐
│ │
│ Set hostname to 'web01' │
│ │
│ ┌────┐ │
│ │ OK │ │
│ └────┘ │
│ │
│ │
└────────────────────────────────┘
Enter again. The change is immediate, and /etc/hostname holds the new name:
$ hostnamectl --static
web01
$ nmcli general hostname
web01
ubuntu@ubuntu-lab:~$
nmtui did not change /etc/hosts, which on this install lists only localhost, and sudo kept working without any warning afterwards (the lab ran sudo right after the change). The shell that was already open keeps the old name in its prompt; a new login shows the new name.
The whole lab at the end of the video:
$ nmcli connection show
NAME UUID TYPE DEVICE
netplan-enp0s2 d0ec664b-1176-38d1-abd4-71d76a4c1087 ethernet enp0s2
Wired connection 2 0722321c-4a0b-31e6-ac52-b3cdb088732f ethernet enp0s4
br-lab e1adf0c4-fd21-4afe-bd89-2334d13d199b bridge br0
lab-static f738bbc2-8bac-3eb5-bae5-11f55465df5f ethernet enp0s3
vlan20 d58ca386-1b99-4164-808e-c25fbddac085 vlan enp0s3.20
br-port 7dc9ae32-0089-43b5-b8a8-83a5c74e7bc4 ethernet enp0s5
lo 65b3ea6e-4573-4139-b59a-98553c9bd6f3 loopback lo
$ ip -4 -br addr | grep -v '^lo'
enp0s2 UP 10.0.2.15/24
enp0s3 UP 10.20.1.50/24
enp0s4 UP 10.20.2.15/24
br0 UP 10.20.3.16/24
enp0s3.20@enp0s3 UP 192.168.20.5/24
ubuntu@ubuntu-lab:~$
The same with nmcli
Every change above has a command. nmcli changes need sudo over SSH (without it: "Error: Failed to modify connection 'lab-static': Insufficient privileges"). The lab ran each of these on a fresh copy of the VM:
$ sudo nmcli connection modify "Wired connection 1" connection.id lab-static ipv4.method manual ipv4.addresses 10.20.1.50/24 ipv4.gateway 10.20.1.2 ipv4.dns 10.20.1.3
$ ip -4 -br addr show enp0s3
enp0s3 UP 10.20.1.15/24
$ sudo nmcli connection up lab-static
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
$ ip -4 -br addr show enp0s3; ip route | grep enp0s3
enp0s3 UP 10.20.1.50/24
default via 10.20.1.2 dev enp0s3 proto static metric 104
10.20.1.0/24 dev enp0s3 proto kernel scope link src 10.20.1.50 metric 104
$ nmcli -g ipv4.method,ipv4.addresses,ipv4.gateway,ipv4.dns connection show lab-static
manual
10.20.1.50/24
10.20.1.2
10.20.1.3
The modify changed nothing live (the first ip line still shows 10.20.1.15/24); connection up applied it. The bridge, its port and the VLAN:
$ sudo nmcli connection delete "Wired connection 3"
Connection 'Wired connection 3' (f6712d12-ba3b-3947-8f02-e97a296b5825) successfully deleted.
$ sudo nmcli connection add type bridge con-name br-lab ifname br0
Connection 'br-lab' (c2a03e08-0241-4013-b1f6-c12d84576766) successfully added.
$ sudo nmcli connection add type bridge-slave con-name br-port ifname enp0s5 master br0
Connection 'br-port' (3c5cdb1a-60a1-44d7-9ba9-f7be7e2f0a63) successfully added.
$ sudo nmcli connection add type vlan con-name vlan20 dev enp0s3 id 20 ip4 192.168.20.5/24
Connection 'vlan20' (ec60fbf0-b649-4c97-852b-569c7b9cc959) successfully added.
$ ip -4 -br addr show enp0s3.20; ip -d link show enp0s3.20 | grep -o "vlan protocol 802.1Q id [0-9]*"
enp0s3.20@enp0s3 UP 192.168.20.5/24
vlan protocol 802.1Q id 20
The hostname:
$ sudo nmcli general hostname web01
$ nmcli general hostname
web01
Each of these profiles also appeared as a 90-NM-<uuid>.yaml file in /etc/netplan, just as when saved from nmtui. The UUIDs are different on every run.
Gotchas and what they mean
nmtui shows no connections, or only Wi-Fi, after installing the package
The package ships unmanaged-devices=* for Ethernet. Set renderer: NetworkManager in netplan (see "Hand the ports to NetworkManager").
Insufficient privileges when saving, or from nmcli
Over SSH you are not a local desktop user. Use sudo nmtui and sudo nmcli.
I saved the profile and nothing changed
Saving is not applying. Activate a connection: deactivate and activate it, or run sudo nmcli connection up NAME.
The session died when I switched a profile off
The highlight in Activate a connection starts on the first row, and it returns there after every change. Press Down before Enter, and never switch off the port you are logged in on.
The bridge stays on "connecting (getting IP configuration)"
Either its port still belongs to another profile (delete it: see "Delete a profile and free a port"), or the bridge is still starting: spanning tree delays it, and in the lab that was more than eight seconds and in one run more than twenty.
I cannot find the profile file in /etc/NetworkManager/system-connections
On Ubuntu with the netplan renderer it is /etc/netplan/90-NM-<uuid>.yaml.
The list order changes between runs
The Edit a connection list orders profiles by use. Read the row before you press Enter, especially before Delete.
What this page did not test
Everything above was run. The following exist in nmtui but were not run in the lab, and the page only mentions them: Wi-Fi connections and the Radio switches (the lab has no radio: both showed "Hardware: Missing"), Bond, Team, InfiniBand, DSL, IP tunnel and MACsec connections, 802.1X security, the IPv6 settings, the Routing editor, search domains, the "Shared" IPv4 mode, changing the spanning tree values, running nmtui at a local console instead of over SSH, and Fedora or Red Hat (there it is the NetworkManager-tui package). Only IPv4 was configured by hand; the profiles kept IPv6 on Automatic.
Tips
1. Install and test nmtui on a machine you can reach by console before you do it on a remote server.
2. Never switch off or delete the profile of the port you are connected through.
3. Give profiles names that say what they are (lab-static, br-lab), not Wired connection 1.
4. After Save, always activate and then check with ip -4 -br addr and ip route.
5. Free a port (delete or edit its old profile) before you put it in a bridge.
6. Wait half a minute before you judge a new bridge.
7. Back up /etc/netplan before and after: the profiles you save live there.
8. For more than one machine, use nmcli, netplan files or your configuration tool, and keep nmtui for the console.