diff --git a/DC-SLES-networkmanager-nmcli b/DC-SLES-networkmanager-nmcli new file mode 100644 index 000000000..f83a97df3 --- /dev/null +++ b/DC-SLES-networkmanager-nmcli @@ -0,0 +1,17 @@ +## ---------------------------- +## Doc Config File for the DB Assembly +## ---------------------------- +## +## Basics +MAIN="SLES-networkmanager-nmcli.asm.xml" +SRC_DIR="articles" +IMG_SRC_DIR="images" + +## Profiling +PROFOS="sles" +#PROFARCH="x86_64;zseries;power;aarch64" + +## stylesheet location +STYLEROOT="/usr/share/xml/docbook/stylesheet/suse2022-ns" +FALLBACK_STYLEROOT="/usr/share/xml/docbook/stylesheet/suse2021-ns" +DOCBOOK5_RNG_URI="urn:x-suse:rng:v2:geekodoc-flat" diff --git a/articles/SLES-networkmanager-nmcli.asm.xml b/articles/SLES-networkmanager-nmcli.asm.xml new file mode 100644 index 000000000..e4ba67eb5 --- /dev/null +++ b/articles/SLES-networkmanager-nmcli.asm.xml @@ -0,0 +1,229 @@ + + + + + %entities; +]> + + + + + + + + + + + + The &nm; tool is used to manage network connections and devices. + + + + + + You can use nmcli command to configure network connections. + + + You can use nmcli command to configure the behavior of &nm;. + + + You can install &nm; to manage network connections and devices. + + + You can start &nm; to manage network connections and devices. + + + You can configure &nm; logging and view the &nm; logs. + + + Troubleshoot common &nm; configuration issues. + + + + + + You can use the nmcli command to modify network connections. + + + You can monitor network details using nmcli command. + + + You can enable and disable &nm; using nmcli command. + + + The nmcli command description. + + + + + + Legal Notice + + + GNU Free Documentation License + + + + + + Setting Up and Managing Network Connections Using &nm; + + + + 2024-12-12 + + + Initial version + + + + + + + + + + + + + + &x86-64; + &power; + + + &productname; + + Setting Up and Managing &nm; + Configure, manage and monitor network connections with &nm; + Setting Up and Managing &nm; + + + Network + + + Administration + Configuration + + Products & Solutions + + + + https://bugzilla.suse.com/enter_bug.cgi + Documentation + SUSE Linux Enterprise Server 16.0 + shalaka.harne@suse.com + + yes + + + + + WHAT? + + + &nm; is a dynamic network control and configuration tool that enables you to keep network devices up and running. + + + + WHY? + + + This article provides a complete overview of &nm; and how to configure, manage, monitor and edit network connections using &nm;. + + + + EFFORT + + + It takes 15 minutes to install and configure &nm;. You need up to an hour to fully understand the &nm; concept and functionalities. + + + + + GOAL + + + Basic understanding of managing network connections. + + + + + REQUIREMENTS + Root access to install and manage &nm;. A Package manager to install &nm;. + + + + + + + + + + + + + + + Installing and Configuring &nm; + + + On &productname;, &nm; is installed and enabled by default and thus runs out of the box. + Usually, you do not have to reinstall it or change the configuration, but if such an action is + needed, these sections provide guidance. + + + + + + + + + + + + + + + + + + + diff --git a/concepts/networkmanager-nmcli-concept.xml b/concepts/networkmanager-nmcli-concept.xml new file mode 100644 index 000000000..5d0812427 --- /dev/null +++ b/concepts/networkmanager-nmcli-concept.xml @@ -0,0 +1,52 @@ + + +%entities; +]> + + + + The &nm; concept + + + + &nm; is a tool that enables managing network connections and devices. &nm; allows you to create, configure and manage network connections and devices. + + + On + &productnameshort;, &nm; has been designed to be fully automatic by default. It is enabled by + default and is shipped with all necessary service unit files that enables you to manage primary network connection and other network interfaces. &nm; supports state-of-the-art + encryption types and standards for network connections, + including connections to 802.1X protected networks. 802.1X is the IEEE Standard for Local and + Metropolitan Area Networks—Port-Based Network Access Control. + + You can switch between wired or wireless networks seamlessly, as &nm; automatically connects to known wireless networks and manages several network connections in parallel. You can also manually switch between available networks. + +&nm; is typically comprised of the following parts: + + &nm; daemon—you can interact with the daemon using standard + &systemd; commands + the nmcli command-line interface + + + the ncurses interface nmtui + + + + &nm; libraries + + + + +configuration files. + + + + diff --git a/references/networking-nmcli.xml b/references/networking-nmcli.xml index 897033333..09044c74d 100644 --- a/references/networking-nmcli.xml +++ b/references/networking-nmcli.xml @@ -16,27 +16,21 @@ xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:trans="http://docbook.org/ns/transclusion"> - Managing the network using &nm; + The <command>nmcli</command> command reference - To manage the network using &nm;, use the nmcli command. - This command provides subcommands and options that enable you to add, edit or - delete connections, devices and so on. + This section provides a summary of options and + subcommands of the nmcli command, you can use to interact with &nm; + daemon to manage the network. - - -
- The <command>nmcli</command> command + - &nm; provides a CLI interface to manage your connections. By using the - nmcli interface, you can connect to a particular - network, edit a connection, edit a device, etc. The generic syntax of the - nmcli is as follows: + The nmcli command has the following generic syntax: &prompt.root;nmcli OPTIONS SUBCOMMAND SUBCOMMAND_ARGUMENTS @@ -58,7 +52,7 @@ device - For details, refer to . + used for network device management. For details, refer to . @@ -166,12 +160,12 @@ to list connections: -&prompt.root;nmcli connection show +&prompt.user;nmcli connection show You can also use this command to show details about a specified connection: -&prompt.root;nmcli connection show CONNECTION_ID +&prompt.user;nmcli connection show CONNECTION_ID where CONNECTION_ID is any of the identifiers: a connection name, UUID or a @@ -187,7 +181,7 @@ connection. Also run this command after you perform any change to the connection. -&prompt.root;nmcli connection up [--active] [CONNECTION_ID] +&prompt.sudo;nmcli connection up [--active] [CONNECTION_ID] When is specified, only the active profiles are displayed. The default is to display both active @@ -201,7 +195,7 @@ to deactivate a connection. -&prompt.root;nmcli connection down CONNECTION_ID +&prompt.sudo;nmcli connection down CONNECTION_ID where: CONNECTION_ID is any of the identifiers: a connection name, UUID or a @@ -219,7 +213,7 @@ to change or delete a property of a connection. -&prompt.root;nmcli connection modify CONNECTION_ID SETTING.PROPERTY PROPERTY_VALUE +&prompt.sudo;nmcli connection modify CONNECTION_ID SETTING.PROPERTY PROPERTY_VALUE where: @@ -249,7 +243,7 @@ option on the ethernet1 connection: -&prompt.root;nmcli connection modify ethernet1 connection.autoconnect no +&prompt.sudo;nmcli connection modify ethernet1 connection.autoconnect no @@ -259,7 +253,7 @@ to add a connection with the provided details. The command syntax is similar to the modify command: -&prompt.root;nmcli connection add CONNECTION_ID save YES|NO SETTING.PROPERTY PROPERTY_VALUE +&prompt.sudo;nmcli connection add CONNECTION_ID save YES|NO SETTING.PROPERTY PROPERTY_VALUE You should at least specify a connection.type or use type. The following example adds an @@ -267,7 +261,7 @@ with DHCP, and disables the connection's flag: -&prompt.root;nmcli connection add type ethernet autoconnect no ifname eth0 +&prompt.sudo;nmcli connection add type ethernet autoconnect no ifname eth0 @@ -276,7 +270,7 @@ to edit an existing connection using an interactive editor. -&prompt.root;nmcli connection edit CONNECTION_ID +&prompt.sudo;nmcli connection edit CONNECTION_ID @@ -286,7 +280,7 @@ to clone an existing connection. The minimal syntax follows: -&prompt.root;nmcli connection clone CONNECTION_ID NEW_NAME +&prompt.sudo;nmcli connection clone CONNECTION_ID NEW_NAME where CONNECTION_ID is the connection to be cloned. @@ -299,7 +293,7 @@ to delete an existing connection: -&prompt.root;nmcli connection delete CONNECTION_ID +&prompt.sudo;nmcli connection delete CONNECTION_ID @@ -309,7 +303,7 @@ to monitor the provided connection. Each time the connection changes, &nm; prints a line. -&prompt.root;nmcli connection monitor CONNECTION_ID +&prompt.sudo;nmcli connection monitor CONNECTION_ID @@ -329,7 +323,7 @@ to load/reload a particular connection file, run: -&prompt.root;nmcli connection load CONNECTION_FILE +&prompt.sudo;nmcli connection load CONNECTION_FILE @@ -353,7 +347,7 @@ to print the status of all devices. -&prompt.root;nmcli device status +&prompt.user;nmcli device status @@ -363,7 +357,7 @@ shows detailed information about a device. If no device is specified, all devices are displayed. -&prompt.root;mcli device show [DEVICE_NAME] +&prompt.user;mcli device show [DEVICE_NAME] @@ -371,10 +365,10 @@ to connect a device. &nm; tries to find a suitable connection - that will be activated. If there is no compatible connection, a + to activate. If there is no compatible connection, a new profile is created. -&prompt.root;nmcli device connect DEVICE_NAME +&prompt.sudo;nmcli device connect DEVICE_NAME @@ -385,7 +379,7 @@ the particular device. The changes are not stored in the connection profile. -&prompt.root;nmcli device modify DEVICE_NAME [+|-] SETTING.PROPERTY VALUE +&prompt.sudo;nmcli device modify DEVICE_NAME [+|-] SETTING.PROPERTY VALUE For possible SETTING.PROPERTY values, refer to nm-settings-nmcli(5). @@ -394,7 +388,7 @@ The example below starts the IPv4 shared connection sharing on the device con1. -&prompt.root;nmcli dev modify con1 ipv4.method shared +&prompt.sudo;nmcli dev modify con1 ipv4.method shared @@ -404,7 +398,7 @@ disconnects a device and prevents the device from automatically activating further connections without manual intervention. -&prompt.root;nmcli device disconnect DEVICE_NAME +&prompt.sudo;nmcli device disconnect DEVICE_NAME @@ -415,7 +409,7 @@ to delete only software devices like bonds and bridges. You cannot delete hardware devices with this command. -&prompt.root;nmcli device DEVICE_NAME +&prompt.sudo;nmcli device delete DEVICE_NAME @@ -424,7 +418,7 @@ lists all available access points. -&prompt.root;nmcli device wifi +&prompt.user;nmcli device wifi @@ -452,12 +446,12 @@ -&prompt.root;nmcli device wifi connect SSID [password PASSWORD_VALUE] [ifname INTERFACE_NAME] +&prompt.sudo;nmcli device wifi connect SSID [password PASSWORD_VALUE] [ifname INTERFACE_NAME] To connect to a Wi-Fi GUESTWiFi with a password pass$word2#@@, run: -&prompt.root;nmcli device wifi connect GUESTWiFi password pass$word2#@@ +&prompt.sudo;nmcli device wifi connect GUESTWiFi password pass$word2#@@ @@ -478,7 +472,7 @@ a command to the nmcli general command, status is used by default. -&prompt.root;nmcli general status +&prompt.user;nmcli general status @@ -489,11 +483,11 @@ host name is displayed. If you specify a new host name, the value is used to set a new host name. -&prompt.root;nmcli general hostname [HOSTNAME] +&prompt.sudo;nmcli general hostname [HOSTNAME] For example, to set MyHostname, run: -&prompt.root;nmcli general hostname MyHostname +&prompt.sudo;nmcli general hostname MyHostname @@ -503,7 +497,7 @@ shows your permission for &nm; operations like enabling or disabling networking, modifying connections, etc. -&prompt.root;nmcli general permissions +&prompt.user;nmcli general permissions @@ -514,7 +508,7 @@ arguments, the command displays current logging levels and domains. -&prompt.root;nmcli general logging [level LEVEL domains DOMAIN] +&prompt.sudo;nmcli general logging [level LEVEL domains DOMAIN] LEVEL is any of the values: OFF, ERR, @@ -550,7 +544,7 @@ enables or disables networking. The off command deactivates all interfaces managed by &nm;. -&prompt.root;nmcli networking on +&prompt.sudo;nmcli networking on @@ -561,7 +555,7 @@ is used, &nm; performs a new check of the state. Otherwise, the last detected state is displayed. -&prompt.root;nmcli networking connectivity +&prompt.user;nmcli networking connectivity Possible states are the following: @@ -599,7 +593,6 @@ - -
+ diff --git a/references/networkmanager-nm-enabledisable.xml b/references/networkmanager-nm-enabledisable.xml new file mode 100644 index 000000000..52d812cdf --- /dev/null +++ b/references/networkmanager-nm-enabledisable.xml @@ -0,0 +1,109 @@ + + + %entities; +]> + + + + + + + Establishing and terminating network connections + + + + + + Enable network connection to access and connect devices and resources. + + +
+ Enabling network connections + + Particular connections may be disabled, or all of the connections may be disabled. To activate + all connections, run the command: + + &prompt.sudo;nmcli networking on + + Bear in mind that the command does not active manually disabled connections. To activate such a + connection, proceed as described in the following procedure: + + + + Activating an existing connection + + + View the list of existing connections: + + &prompt.sudo;nmcli connection show + + + + Enable a connection using the name or UUID: + + &prompt.sudo;nmcli connection up uuid CONNECTION-UUID + + + + Check the connection status: + + &prompt.sudo;nmcli connection show --active + + +
+
+ Disabling network connections + You can temporarily disconnect your system from external + networks using the nmcli command to + disable your network connection. + + To disable a particular connection, proceed as described in the following procedure: + + + + + View the list of active connections: + + &prompt.sudo;nmcli connection show --active + +NAME UUID TYPE DEVICE +Wired connection 2 7b0c32ee-851e-3015-a658-f4372b426273 ethernet enp6s0f3u1u4 +lo 8041ed2a-e4ae-4bf7-a0db-d4b513b9d745 loopback lo +virbr0 1bec1271-4bb6-46a7-a50a-4b329fa318d3 bridge virbr0 +vnet0 ac196c81-0505-49f0-9328-b78e1746b4a9 tun vnet0 + + + + + Terminate a specific connection: + + &prompt.sudo;nmcli connection down CONNECTION-NAME/CONNECTION-UUID + + For example: + + &prompt.sudo;nmcli connection down virbr0 + + + + + To disable all connection temporarily, run: + + &prompt.sudo;nmcli networking off + + + Temporal changes only + + In both cases the changes persist only till the system reboots. After reboot, &nm; and + connections are active again. + + +
+
diff --git a/references/networkmanager-nm-modify.xml b/references/networkmanager-nm-modify.xml new file mode 100644 index 000000000..f090b844f --- /dev/null +++ b/references/networkmanager-nm-modify.xml @@ -0,0 +1,208 @@ + + + %entities; +]> + + + + + + + Modifying network connections + + + + + + You can use the nmcli connection modify command to modify network + connections. The generic syntax of the command follows: + + &prompt.sudo;nmcli connection modify + CONNECTION-NAME PROPERTY VALUE + + To obtain the value of CONNECTION-NAME, list connections using the + command: nmcli connection show. Available properties and their possible + values are described in the following section. + + + +
+ Connections attributes + + This section lists and describes attributes you can modify on connections: + + + + Connections details + + + + + + + Property + Description + Values + + + + + + ipv4.method + It defines how the interface obtains and handles its IPv4 address configuration + + + + auto—the default value used to allocate IP addresses dynamically using DHCP + + + + + manual—to configure a static IP address + + + + + link-local—to use IPv4 link-local addressing only (169.254.0.0/16) + + + + + shared—to share the connection with other computers + + + + + disabled—to disable IPv4. + + + + + + ipv4.dns + A space separated list of DNS IP addresses + For example, "8.8.8.8 8.8.4.4" + + + ipv4.gateway + The property is the router address that your system use to reach networks beyond your local network + An IP address of the gateway + + + connection.id + It renames the connection + a string representing the new connection name + + + 802-11-wireless.ssid + The property renames a wi-fi network + A string representing the new wi-fi SSID + + + connection.autoconnect + Toggles on/off automatic connection when the device is online + on or off + + + +
+ + + +
+
diff --git a/references/networkmanager-nm-monitor.xml b/references/networkmanager-nm-monitor.xml new file mode 100644 index 000000000..81307fbaa --- /dev/null +++ b/references/networkmanager-nm-monitor.xml @@ -0,0 +1,67 @@ + + + %entities; +]> + + + + + + + Monitoring network connections + + + + + + Use the nmcli command to view the status, activity and details of network connections managed by &nm;. + + + The following list provides commands for basic monitoring of network connections. + + + View the list of active connections + + &prompt.user;nmcli connection show --active + + + View the status of &nm; + + &prompt.user;nmcli monitor + The real-time updates about the network states and connections appear. + + + + View details of a specific network connection + + &prompt.user;nmcli connection monitor CONNECTION-NAME + + Each time the connection changes, &nm; prints a line. + + + + + Monitor the status of network devices + + &prompt.user;nmcli device monitor + + The list of all network devices with device name, type, state and connection name appears. + + + + View the signal strength of Wi-Fi connections + + &prompt.user;nmcli device wifi list + The list of available Wi-Fi networks with SSID, signal strength (in %) and security type appears. + + + + diff --git a/tasks/networkmanager-nmcli-conf-nwbehavior.xml b/tasks/networkmanager-nmcli-conf-nwbehavior.xml new file mode 100644 index 000000000..bc4f09fd4 --- /dev/null +++ b/tasks/networkmanager-nmcli-conf-nwbehavior.xml @@ -0,0 +1,87 @@ + + + %entities; +]> + + + + + + + Configuring &nm; behavior + + + + The behavior of &nm; is defined in its central configuration file /etc/NetworkManager/NetworkManager.conf. + + + It is the primary location for configuring behavior and settings of &nm;, including logging, connection management, and network device handling. + The file consists of sections of key-value pairs. Each key-value pair must belong to a section. A section starts with a name enclosed in []. Lines beginning with a # are considered comments. A common configuration includes the [main] section with the plugins value, [logging], and [connectivity]: +[main] +plugins=keyfile +dhcp=dhclient + +[connectivity] +uri=http://name.org + +[logging] +level=INFO +domains=ALL + + + + + Controls the general settings for &nm;. + + + + + Manages how the connection profiles are stored. The [keyfile] plug-in supports all the connection types and capabilities of &nm;. + + + + + Defines connection defaults and options and specifies the URI to check the network connection. + + + + + Manages the &nm; logging levels and domains. + + + + + + Configuring NetworkManager.conf + Ensure that you take a backup of the existing configuration file before modifying the file. + Open the configuration file: +&prompt.sudo;vi /etc/NetworkManager/NetworkManager.conf + + + +Stop the &nm; service: + +&prompt.sudo;systemctl stop network + +Modify the sections. +Save the changes + + + + Start &nm;: +&prompt.sudo;systemctl start network + +View the existing configuration and settings: +&prompt.sudo;nmcli general show + + + \ No newline at end of file diff --git a/tasks/networkmanager-nmcli-configure.xml b/tasks/networkmanager-nmcli-configure.xml new file mode 100644 index 000000000..b6e07634e --- /dev/null +++ b/tasks/networkmanager-nmcli-configure.xml @@ -0,0 +1,482 @@ + + + %entities; +]> + + + + + + + Creating network connections + + + + You can create a network connection profile using the nmcli command. + +&nm; stores all network configurations as a connection profile, which is a collection of data +that describes how to create or connect to a network. These connection profiles are stored as files in the +/etc/NetworkManager/system-connections/ directory by default. Each network +connection profile (Wi-Fi, Ethernet, VPN) is represented by a separate file in this directory. +A connection is an instance of a particular connection profile that is active when a +particular device uses the connection. The device may have more than one connection profile +configured. The other connections can be used to fast +switch from one connection to another. For example, if the active connection is not available, &nm; +tries to connect the device to another configured connection. +The &nm; daemon manages network connections. You can interact with it +using a command-line interfaces: nmcli or ncurses interface: +nmtui. +
Creating an Ethernet connection + Configure the Ethernet connection using the nmcli + command and proceed as follows: + + + + List available devices to get the exact device name: + + &prompt.user;nmcli device + + + View the list of connections to check if the profile name, you want to use, does not exist: + nmcli connection show + The &nm; creates a profile for each Network Interface Controller (NIC). To connect the NIC to networks with different settings, you must create separate profiles for each network. + + + Create a new connection profile: + &prompt.sudo;nmcli connection add con-name CONNECTION_NAME ifname DEVICE_NAME type ethernet + + + View the existing network settings of the new connection profile: + &prompt.user;nmcli connection show CONNECTION_NAME + + + Configure the connection profile. The generic command syntax is the following: + &prompt.sudo;nmcli connection modify CONNECTION_NAME + SETTING VALUE + + For example, automatic IP addresses assingment (DHCP or SLAAC) is enabled by default, you may want + to configure a static IP address: + + + + for IPv4 + &prompt.sudo;nmcli connection modify CONNECTION_NAME ipv4.method manual ipv4.addresses 192.0.2.1/24 ipv4.gateway 192.0.2.254 ipv4.dns 192.0.2.200 ipv4.dns-search example.com + + + + for IPv6 + + &prompt.sudo;nmcli connection modify INTERNAL-LAN ipv6.method manual ipv6.addresses 2001:db8:1::fffe/64 ipv6.gateway 2001:db8:1::fffe ipv6.dns 2001:db8:1::ffbb ipv6.dns-search example.com + + + + + Activate the profile: + &prompt.sudo;nmcli connection up CONNECTION_NAME + + Verify the configurations: + + Verify the IP settings of the NIC: + &prompt.user;ip address show HOSTNAME + + Verify the default IPv4 gateway: + &prompt.user;ip route show default + + Verify the default IPv6 gateway: + &prompt.user;ip -6 route show default + + View the DNS settings: + &prompt.user;cat /etc/resolv.conf + + + + +
+
Creating a Wi-Fi connection profile +You can connect to a Wi-Fi using the nmcli command. The &nm; creates a new +connection profile when you connect to a Wi-Fi for the first time. You can configure the profile after connecting to +the Wi-Fi. + + + Enable the Wi-Fi radio: + &prompt.sudo;nmcli radio wifi on + + + View the list of available devices: + &prompt.sudo;nmcli device + + Connect to Wi-Fi: + + &prompt.sudo;nmcli device wifi connect WI-FI_CONNECTION_NAME + PASSWORD + + View the existing network settings of the new connection profile: + &prompt.sudo;nmcli connection show CONNECTION_NAME + + + + Configure the connection profile as needed, using the command: + + &prompt.sudo;nmcli connection modify CONNECTION_NAME + SETTING VALUE + + For example, to configure a static IPv4: + + &prompt.sudo;nmcli connection modify WI-FI_CONNECTION_NAME ipv4.method manual ipv4.addresses IP_ADDRESS/SUBNET_MASK + + To configure a static IPv6 address + + &prompt.sudo;nmcli connection modify WI-FI_CONNECTION_NAME ipv6.method manual ipv6.addresses IP_ADDRESS/SUBNET_MASK + + +Restart the connection: +&prompt.sudo;nmcli connection up WI-FI_CONNECTION_NAME + +Verify the connection using the command: . +&prompt.user;nmcli connection show --active +The list of available active connections appears. + + +
+
+ Creating a network bond +A network bond combines physical and virtual network interfaces and provides a logical interface. You can create network bonds on Ethernet devices, Virtual LANs, and so on. +You must have two or more physical or virtual networks installed on the server. + +To use Ethernet devices for network +bonding, you must install the physical or virtual Ethernet devices +on the server. +When using network teams, bridges or VLAN devices +as ports for a bond, you can create them either during the bond +creation process or beforehand. + + + Creating a network bond + Create a bond interface: + &prompt.sudo;nmcli connection add type bond con-name NWBOND ifname NWBOND bond.options "mode=active-backup" + + + A network bond, NETWORK_BOND that uses active-backup mode is created. + + + View the list of network interfaces: + &prompt.user;nmcli device status + + DEVICE TYPE STATE CONNECTION + wlan0 wifi connected Vision + virbr0 bridge connected (externally) virbr0 + p2p-dev-wlan0 wifi-p2p disconnected -- + eth0 ethernet unavailable -- + lo loopback unmanaged -- +The list of available network interfaces appears. You can add to the bond also the devices that are not configured. + In the given list, p2p-dev-wlan0 is not configured, + while virbr0 is configured and has a connection profile. + +To configure p2p-dev-wlan0 as a port, +create a connection profile: +&prompt.sudo;nmcli connection add type wifi-p2p slave-type bond con-name bond0-port1 ifname p2p-dev-wlan0 master bond0 +A new profile is created for p2p-dev-wlan0 and added to the bond0 connection. The name of the bond is bond0. +To assign virbr0 to a bond: +&prompt.sudo;nmcli connection modify virbr0 master bond0 +The connection profile for virbr0 is added to the bond0 connection. + +Activate the connection: +&prompt.sudo;nmcli connection up virbr0 +Configure the IPv4 settings: + + +To use bond0 as a port for other devices: + &prompt.sudo;nmcli connection modify bond0 ipv4.method disabled + + + To use DHCP, no configuration is required. + + +To configure a static IPv4 address, network mask, default gateway and DNS server to the bond0 connection: +&prompt.sudo;nmcli connection modify bond0 ipv4.addresses '192.0.2.1/24' ipv4.gateway '192.0.2.254' ipv4.dns '192.0.2.253' ipv4.dns-search 'example.com' ipv4.method manual + + + +Configure the IPv6 settings: + + +To use this bond device as a port of other devices: + &prompt.sudo;nmcli connection modify bond0 ipv6.method disabled + + +To use stateless address autoconfiguration (SLAAC), no action is required. + + +To set a static IPv6 address, network mask, default gateway and DNS server to the bond0 connection: + &prompt.sudo;nmcli connection modify bond0 ipv6.addresses '2001:db8:1::1/64' ipv6.gateway '2001:db8:1::fffe' ipv6.dns '2001:db8:1::fffd' ipv6.dns-search 'example.com' ipv6.method manual + + + + + Activate the connection: + &prompt.sudo;nmcli connection up bond0 + + + View and verify the connections: + &prompt.user;nmcli device + The list of connections appears. + + +
+
+ Configuring a network team +Network teaming combines physical and virtual networks and provides a logical interface with higher efficiency. Configure network teams using nmcli. + +Requirements + + Install the teamd and NetworkManager-team packages: +&prompt.sudo; zypper install teamd +&prompt.sudo; zypper install NetworkManager-team + + + Install two or more physical or virtual devices on the server: + + + + To use Ethernet devices as ports of the team, the physical or virtual Ethernet devices must be installed on the server and connected to a switch. + + + + To use bond, bridge or VLAN devices as ports of the team, you can either create these devices while you create the team or you can create them in advance. + + + + Creating a network team + Create a team interface: + &prompt.sudo;nmcli connection add type team con-name CONNECTION_NAME ifname TEAM_NAME team.runner RUNNER-TYPE + + For example, to create a network team team0 with the + activebackup runner, run: + + &prompt.sudo;nmcli connection add type team con-name team0 ifname team0 team.runner active.backup + + + View the list of network interfaces: + &prompt.user;nmcli device status + + DEVICE TYPE STATE CONNECTION + wlan0 wifi connected Vision + virbr0 bridge connected (externally) virbr0 + p2p-dev-wlan0 wifi-p2p disconnected -- + eth0 ethernet unavailable -- + lo loopback unmanaged -- + +You can add the listed devices to the team. In further p2p-dev-wlan0 is +not configured, while virbr0 is configured and has a connection profile. Both +the devices are used in further examples. + + +Configure port interfaces to the team: + +&prompt.sudo;nmcli connection add type wifi-p2p slave-type team con-name team0-port1 ifname p2p-dev-wlan0 master team0 +A new profile is created for p2p-dev-wlan0 and added to the team0 connection. +Assign the existing connection to the team: +&prompt.sudo;nmcli connection modify bond0 master team0 +The connection profile for bond0 is added to the team0 connection. + +Activate the connection: +&prompt.sudo;nmcli connection up bond0 +Configure the IPv4 settings: + + +To use the team device as a port of other devices: +&prompt.sudo;nmcli connection modify team0 ipv4.method disabled + + +To use DHCP, no configuration is required. + + + +To configure a static IPv4 address, network mask, default gateway and DNS server to the bond0 connection, run the command: +&prompt.sudo;nmcli connection modify team0 ipv4.addresses '192.0.2.1/24' ipv4.gateway '192.0.2.254' ipv4.dns '192.0.2.253' ipv4.dns-search 'example.com' ipv4.method manual + + + +Configure the IPv6 settings: + + +To use this team device as a port of other devices: +&prompt.sudo;nmcli connection modify team0 ipv6.method disabled + + +To use stateless address autoconfiguration (SLAAC), no action is required. + + +To set a static IPv6 address, network mask, default gateway and DNS server to the team0 connection: +&prompt.sudo;nmcli connection modify team0 ipv6.addresses '2001:db8:1::1/64' ipv6.gateway '2001:db8:1::fffe' ipv6.dns '2001:db8:1::fffd' ipv6.dns-search 'example.com' ipv6.method manual + + + + +Activate the connection: +&prompt.sudo;nmcli connection up team0 + +To view the status of the team: +&prompt.sudo;teamdctl team0 state + +
+
+ Configuring a network bridge + + A network bridge is a device that facilitates communication between two or more network segments, creating a single network from multiple segments + +To configure a network bridge, ensure the following: + + + Install two or more physical or virtual devices on the server. + + + + To use Ethernet devices as ports for the bridge, ensure the server + has physical or virtual Ethernet devices installed and connected + to a switch. + + + + When using team, bond or VLAN devices as ports for the + bridge, you can create these devices either during bridge creation + or beforehand. + + + + Creating a network bridge + Create a bridge interface: + &prompt.sudo;nmcli connection add type bridge con-name CONNECTION_NAME ifname BRIDGE_NAME + + For example, we created a bridge: bridge0 by running the command: + + &prompt.sudo;nmcli connection add type bridge con-name bridge0 ifname bridge0 + + View the list of network interfaces to verify that + bridge0 is created: + &prompt.user;nmcli device status + + DEVICE TYPE STATE CONNECTION + wlan0 wifi connected Vision + virbr0 bridge connected (externally) virbr0 + p2p-dev-wlan0 wifi-p2p disconnected -- + eth0 ethernet unavailable -- + lo loopback unmanaged -- + bridge0 bridge connecting (getting IP configuration) brdige0 + +The bridge is in the state getting IP configuration, because you have not +assigned interfaces to it yet. Later you will assign the interfaces: p2p-dev-wlan0 +(not configured) and virbr0 (configured with a +connection profile). + + +Add interfaces to the bridge: +&prompt.sudo;nmcli connection add type wifi-p2p slave-type bridge con-name bridge0-port1 ifname p2p-dev-wlan0 master bridge0 +A new profile is created for p2p-dev-wlan0 and added to the bridge0 connection. +To assign an existing connection to the bridge: +&prompt.sudo;nmcli connection modify bond0 master bridge0 +The connection profile for bond0 + is added to the bridge0 connection. + +Restart the connection: +&prompt.sudo;nmcli connection up bond0 +Configure the IPv4 settings: + + +To use the bridge device as a port of other devices: +&prompt.sudo;nmcli connection modify bridge0 ipv4.method disabled + + +To use DHCP, no configuration is required. + + + +To configure a static IPv4 address, network mask, +default gateway and DNS server to the bridge0 +connection: +&prompt.sudo;nmcli connection modify bridge0 ipv4.addresses '192.0.2.1/24' ipv4.gateway '192.0.2.254' ipv4.dns '192.0.2.253' ipv4.dns-search 'example.com' ipv4.method manual + + + +Configure the IPv6 settings: + + +To use this bridge device as a port of other devices: +&prompt.sudo;nmcli connection modify bridge0 ipv6.method disabled + + +To use stateless address autoconfiguration (SLAAC), no action is required. + + +To set a static IPv6 address, network mask, default gateway and DNS server to the bridge0 connection: +&prompt.sudo;nmcli connection modify bridge0 ipv6.addresses '2001:db8:1::1/64' ipv6.gateway '2001:db8:1::fffe' ipv6.dns '2001:db8:1::fffd' ipv6.dns-search 'example.com' ipv6.method manual + + + +Activate the connection: +&prompt.sudo;nmcli connection up bridge0 + +Verify the connection: +&prompt.user;nmcli device +When you activate any port of the connection, &nm; also activates the bridge, but not the other ports of it. +Enable all ports automatically when the bridge is enabled: +&prompt.sudo;nmcli connection modify bridge0 connection.autoconnect-slaves 1 + + + View the link status of Ethernet devices that are ports of a specific bridge. + &prompt.sudo;ip link show master bridge0 + + + + View the status of Ethernet devices that are ports of any bridge device. + + &prompt.sudo;bridge link show + + +
+
+ Configuring a VPN connection + + A VPN (Virtual Private Network) connection is a secure, encrypted tunnel between your device and another network over the Internet. + +You can configure a VPN connection using the nmcli command. + + Installing and configuring a VPN connection + + Install OpenVPN: + &prompt.sudo; zypper install networkmanager-openvpn + + + Create a VPN connection: + &prompt.sudo;nmcli connection add type vpn con-name MyOpenVPN ifname -- vpn-type openvpn + + + + Configure the settings: + &prompt.sudo;nmcli connection modify MyOpenVPN vpn.data "remote=VPN-SERVER-ADDRESS,username=YOUR-USERNAME" + &prompt.sudo;nmcli connection modify MyOpenVPN vpn.secrets "password=YOUR-PASSWORD" + +Configure DNS settings: +&prompt.sudo;nmcli connection modify MyOpenVPN ipv4.dns "8.8.8.8 8.8.4.4" +Add routes: +&prompt.sudo;nmcli connection modify MyOpenVPN ipv4.routes "192.168.1.0/24 192.168.1.1" + +Activate the VPN connections: +&prompt.sudo;nmcli connection up MyOpenVPN +Verify if the configured connection is active: +&prompt.user;nmcli connection show --active + + +
+
\ No newline at end of file diff --git a/tasks/networkmanager-nmcli-install.xml b/tasks/networkmanager-nmcli-install.xml new file mode 100644 index 000000000..e2ec061ab --- /dev/null +++ b/tasks/networkmanager-nmcli-install.xml @@ -0,0 +1,34 @@ + + + %entities; +]> + + + + + + + Installing &nm; + + + + + You can install &nm; using zypper. Once you + install, you can enable &nm; to start automatically at boot time. + + + Install &nm;: + &prompt.sudo;zypper install NetworkManager + Enable &nm;: +&prompt.sudo;systemctl enable NetworkManager +Once &nm; is enabled, the change persists across reboots. + diff --git a/tasks/networkmanager-nmcli-logging.xml b/tasks/networkmanager-nmcli-logging.xml new file mode 100644 index 000000000..2ad7ac27b --- /dev/null +++ b/tasks/networkmanager-nmcli-logging.xml @@ -0,0 +1,120 @@ + + + %entities; +]> + + + + + + + NetworkManager logging + + + + + &nm; activities are logged by the journald system logging mechanism. The NetworkManager logs are saved in /var/log/syslog, and you can access the details using the journalctl command. + + + + + The type of logged &nm; activities differs according to the + current logging level. Available levels are described below: + + + + ERR—logs only error messages. For example, connection failures. + + + WARN—logs warnings and errors. For example, authentication issues. + + + INFO—logs informational messages. That is the default level for all + logging domains. + + + DEBUG—logs detailed debugging information. For example, detailed DHCP negotiations + + + TRACE—logs very detailed usually unimportant events. For example, packet-level details. + + + + To check the current logging level, run: + +&prompt.user;nmcli general logging + + +INFO PLATFORM,RFKILL,ETHER,WIFI,BT,MB,DHCP4,DHCP6,PPP,IP4,IP6,AUTOIP4,DNS,VPN,SHARING,SUPPLICANT,AGENTS,SETTINGS,SUSPEND,CORE,DEVICE,OLPC,INFINIBAND,FIREWALL,ADSL,BOND,VLAN,BRIDGE,TEAM,CONCHECK,DCB,DISPATCH,AUDIT,SYSTEMD,PROXY + + +The output shows that the logging level is INFO for all domains—that is the default setting. You can +modify logging levels on particular domains and then the command outputs only the modified domains. + + +To change the logging level on all domains, run: + +&prompt.sudo;general logging level LEVEL domains ALL + +For example, to revert changes to the default setting: + +&prompt.sudo;nmcli general logging level INFO domains ALL + +To change a logging level on particular domains, for example to set DEBUG on +DNS and FIREWALL, run: + +&prompt.sudo;nmcli general logging level DEBUG domains FIREWALL,DNS + +The following list provides commands to manage &nm; logs using journald + +Managing &nm; logs + +Viewing logs + + +To view the &nm; logs + +&prompt.sudo;journalctl -u NetworkManager + +To view the &nm; logs realtime: + +&prompt.sudo;journalctl -u NetworkManager -f + +To view only specific logs, use grep to filter the journalctl +output. For example, for log related to DHCP, run: + +&prompt.sudo;journalctl -u NetworkManager | grep DHCP + + + +Saving logs + +To save &nm; logs to a file, for example, to +networkmanager.log: +&prompt.sudo;journalctl -u NetworkManager > networkmanager.log + +To save the &nm; logs of a specific time to a file, for example, to networkmanager_timerange.log: + +&prompt.sudo;journalctl -u NetworkManager --since "YYYY-MM-DD HH:MM:SS" --until "YYYY-MM-DD HH:MM:SS" > networkmanager_timerange.log +To save the &nm; logs with real-time monitoring and save them as and when generated: + +&prompt.sudo;journalctl -u NetworkManager -f >> live_networkmanager.log + + + + diff --git a/tasks/networkmanager-nmcli-start.xml b/tasks/networkmanager-nmcli-start.xml new file mode 100644 index 000000000..f596e1c30 --- /dev/null +++ b/tasks/networkmanager-nmcli-start.xml @@ -0,0 +1,83 @@ + + + %entities; +]> + + + + + + + Managing the &nm; daemon + + + + + The &nm; daemon is a standard &systemd; service so you can use the + systemctl command to manage the daemon. + + + + + You can use any of the following commands to manage the &nm; daemon: + + + + + Checking status + + + To check if the &nm; daemon is running and thus the network should be active: + + &prompt.user;systemctl status network + + + +Restarting the daemon + + +For example, in cases of networking problem, you can try to restart the &nm; Daemon by using the +following command: + +&prompt.sudo;systemctl restart network + + + + Stopping the daemon + + You can stop &nm; during network configuration changes or to switch to manual control. You + can also stop the service for troubleshooting or debugging network issues. By stopping &nm; you + ensure that the &nm; does not automatically manage the interface or overwrite your settings + during manual configuration. You can also stop &nm; to manually address specific requirements for + network interfaces. + + To stop the &nm; daemon: + + &prompt.sudo;systemctl stop network + + + + Starting the &nm; daemon + + + If you stopped the daemon, you need to start it again to manage all network connections: + + &prompt.sudo;systemctl start NetworkManager + + + + diff --git a/tasks/networkmanager-nmcli-troubleshoot.xml b/tasks/networkmanager-nmcli-troubleshoot.xml new file mode 100644 index 000000000..4a9c272fd --- /dev/null +++ b/tasks/networkmanager-nmcli-troubleshoot.xml @@ -0,0 +1,142 @@ + + + %entities; +]> + + + + + + Troubleshooting + + + + + Learn how to debug and troubleshoot &nm; installation and configuration issues. + + + +
+ Network is not running + + + If network is not working, this may be caused &nm; itself. To check that proceed as follows: + + + + + Check that &nm; is enabled and active: + + &prompt.sudo;systemctl status network + + + + If &nm; is disabled, enable it: + + &prompt.sudo;systemctl enable NetworkManager + + + + If &nm; is inactive, restart it: + + &prompt.sudo;restart NetworkManager + + + +
+
+ Wi-Fi connectivity issue + + If you are experiencing problems with Wi-Fi connectivity, proceed as described below: + + + + + + + View the list of Wi-fi connections + + &prompt.sudo;nmcli device wifi list + + + + If the particular device is listed, verify that the Wi-fi connection is active: + + &prompt.sudo;nmcli connection show --active + + + + If the Wi-Fi connection is not listed, verify the Wi-Fi status: + + &prompt.sudo;nmcli device status + + + +If the status is disconnected, activate the connection. + +&prompt.sudo;nmcli connection up CONNECTION_NAME + + + +If the status is unavailable, restart &nm;: + +&prompt.sudo;systemctl restart NetworkManager + + + + +Inspect the &nm; logs for error messages. +&prompt.sudo;journalctl -u NetworkManager -n 100 + + + The Wi-Fi device may be blocked: + + + + Check if the device is blocked: + + &prompt.sudo;rfkill list + +phy0: Wireless LAN +Soft blocked: yes +Hard blocked: no + + + + + Unblock the device: + + &prompt.sudo;rfkill unblock all + + + + + + IPv4 static address may be configured incorrectly, to check that, reset to use DHCP: + + &prompt.sudo;nmcli connection modify SSID ipv4.method auto + + + + Try to activate the connection again: + + &prompt.sudo;nmcli connection up SSID + + + + Try to reconnect to the Wi-Fi network: + + &prompt.sudo;nmcli device wifi connect SSID password PASSWORD + + +
+