### Multiple Connection Sections Example Source: https://networkmanager.dev/docs/api/latest/NetworkManager.conf.html Demonstrates how to define multiple connection configurations using sections that start with 'connection'. Sections are processed in order, with '[connection]' always last. ```ini [connection] ipv6.ip6-privacy=0 connection.autoconnect-ports=1 vpn.timeout=120 [connection-wifi-wlan0] match-device=interface-name:wlan0 ipv4.route-metric=50 [connection-wifi-other] match-device=type:wifi ipv4.route-metric=55 ipv6.ip6-privacy=1 ``` -------------------------------- ### Enable nm-cloud-setup for Amazon EC2 Source: https://networkmanager.dev/docs/api/latest/nm-cloud-setup.html This example demonstrates how to enable and configure nm-cloud-setup for Amazon EC2. It involves installing the package, creating a systemd service override to set the environment variable, and enabling the service and timer. ```bash dnf install -y NetworkManager-cloud-setup mkdir -p /etc/systemd/system/nm-cloud-setup.service.d cat > /etc/systemd/system/nm-cloud-setup.service.d/10-enable-ec2.conf << EOF [Service] Environment=NM_CLOUD_SETUP_EC2=yes EOF # systemctl enable nm-cloud-setup.service mkdir -p /etc/systemd/system/NetworkManager.service.wants/ ln -s /usr/lib/systemd/system/nm-cloud-setup.service /etc/systemd/system/NetworkManager.service.wants/nm-cloud-setup.service # systemctl enable nm-cloud-setup.timer mkdir -p /etc/systemd/system/timers.target.wants/ ln -s /etc/systemd/system/timers.target.wants/nm-cloud-setup.timer /usr/lib/systemd/system/nm-cloud-setup.timer # systemctl daemon-reload ``` -------------------------------- ### Device Section Configuration Example Source: https://networkmanager.dev/docs/api/latest/NetworkManager.conf.html Shows a configuration for the 'device' section, which contains per-device persistent settings. This example matches a specific interface and enables management. ```ini [device] match-device=interface-name:eth3 managed=1 ``` -------------------------------- ### Set IPv4 Address and Method Source: https://networkmanager.dev/docs/api/latest/nmcli-examples.html This example demonstrates setting a static IPv4 address with a prefix and confirms the method to 'manual'. ```bash nmcli> **goto ipv4.addresses** nmcli ipv4.addresses> desc === [addresses] === [NM property description] Array of IP addresses. [nmcli specific description] Enter a list of IPv4 addresses formatted as: ip[/prefix], ip[/prefix],... Missing prefix is regarded as prefix of 32. Example: 192.168.1.5/24, 10.0.0.11/24 nmcli ipv4.addresses> set 192.168.1.100/24 Do you also want to set 'ipv4.method' to 'manual'? [yes]: yes nmcli ipv4.addresses> print addresses: 192.168.1.100/24 nmcli ipv4.addresses> back nmcli ipv4> b ``` -------------------------------- ### Example VF Configuration String Source: https://networkmanager.dev/docs/api/latest/settings-sriov.html Illustrates the string format for configuring a single virtual function (VF) with specific attributes like MAC address and spoof-check. ```text 2 mac=00:11:22:33:44:55 spoof-check=true ``` -------------------------------- ### StartFind Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Device.WifiP2P.html Starts a find operation for Wi-Fi P2P peers. This method allows initiating a scan for nearby Wi-Fi P2P devices. ```APIDOC ## StartFind ### Description Start a find operation for Wi-Fi P2P peers. ### Method DBUS ### Endpoint org.freedesktop.NetworkManager.Device.WifiP2P.StartFind ### Parameters #### In Parameters - **options** (a{sv}) - Required - Options of find. - **timeout** (i) - Optional - Timeout value in the range of 1-600 seconds. The default is 30 seconds. ### Response (No specific response details provided in the source for success.) ### Signal Details #### PeerAdded - **peer** (o) - The object path of the newly found access point. #### PeerRemoved - **peer** (o) - The object path of the Wi-Fi P2P peer that has disappeared. ``` -------------------------------- ### Enable and Start nm-cloud-setup Systemd Timer Source: https://networkmanager.dev/docs/api/latest/nm-cloud-setup.html Enable the nm-cloud-setup systemd timer to run the configuration tool periodically. This is useful for applying updates during boot or after network changes. ```bash systemctl enable --now nm-cloud-setup.timer ``` -------------------------------- ### Provide WPA PSK credentials for Wi-Fi Source: https://networkmanager.dev/docs/api/latest/nmcli.html Example of a credentials file format for activating a WPA Wi-Fi connection with a Pre-Shared Key (PSK). ```text wifi-sec.psk:the_password ``` -------------------------------- ### Device Matching Examples Source: https://networkmanager.dev/docs/api/latest/NetworkManager.conf.html Illustrates various ways to specify device matching criteria, including interface names, MAC addresses, device types, drivers, and negative matching. ```text interface-name:em4 mac:00:22:68:1c:59:b1;mac:00:1E:65:30:D1:C4;interface-name:eth2 interface-name:vboxnet*,except:interface-name:vboxnet2 *,except:mac:00:22:68:1c:59:b1 ``` -------------------------------- ### Bond Options Example Source: https://networkmanager.dev/docs/api/latest/settings-bond.html Dictionary of key/value pairs for bonding options. Both keys and values must be strings. Option names must contain only alphanumeric characters. ```text options {'mode': 'balance-rr'} ``` -------------------------------- ### Start Wi-Fi P2P Peer Discovery Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Device.WifiP2P.html Initiates a search for Wi-Fi P2P peers. The 'options' argument can specify a timeout in seconds. ```dbus StartFind (IN a{sv} options); ``` -------------------------------- ### Commit Network Changes with nmcli Checkpoint Source: https://networkmanager.dev/docs/api/latest/nmcli-examples.html This example shows how to use `nmcli dev checkpoint` to apply a network change and then confirm it. If the change is successful, confirming it abandons the checkpoint. If not confirmed, the network state reverts to the checkpoint. ```bash $ **nmcli dev checkpoint -- ip link del br0** Type "Yes" to commit the changes: **Yes** ``` -------------------------------- ### Startup Property Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Indicates whether NetworkManager is still starting up. This becomes FALSE when NetworkManager has finished attempting to activate every connection it might be able to activate at startup. ```APIDOC ## Startup Property ### Description Indicates whether NM is still starting up; this becomes FALSE when NM has finished attempting to activate every connection that it might be able to activate at startup. ### Type readable b ``` -------------------------------- ### ListConnections Source: https://networkmanager.dev/docs/api/latest/ix01.html Fetches a list of all available network connections configured on the system. This is essential for enumerating and understanding the current network setup. ```APIDOC ## ListConnections() ### Description Lists all available network connections. ### Method N/A (This is a method call, not an HTTP endpoint) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example N/A ### Response #### Success Response - **Connections Array** (array) - An array of connection objects. #### Response Example N/A ``` -------------------------------- ### Configure Logging Backend to Journal Source: https://networkmanager.dev/docs/api/latest/NetworkManager.conf.html Set the logging backend to 'journal' to send logs to systemd-journald. If '--debug' is used when starting NetworkManager, messages will also be printed to stderr. ```ini [logging] backend=journal ``` -------------------------------- ### Run nm-cloud-setup Manually Source: https://networkmanager.dev/docs/api/latest/nm-cloud-setup.html Execute the nm-cloud-setup binary directly to apply network configuration. This tool is idempotent and can be run multiple times. ```bash /usr/libexec/nm-cloud-setup ``` -------------------------------- ### state Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Gets the current state of the NetworkManager. ```APIDOC ## state ### Description Gets the current state of the NetworkManager. ### Method DBUS ### Endpoint org.freedesktop.NetworkManager.state ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ``` org.freedesktop.NetworkManager.state() ``` ### Response #### Success Response (200) - **state** (u) - An integer representing the NetworkManager state. #### Response Example ``` 2 ``` ``` -------------------------------- ### ConnectivityCheckUri Property Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Gets the URI that NetworkManager uses for connectivity checks. ```APIDOC ## ConnectivityCheckUri Property ### Description The URI that NetworkManager will hit to check if there is internet connectivity. ### Type readable s ``` -------------------------------- ### Get overall NetworkManager state Source: https://networkmanager.dev/docs/api/latest/nmcli.html Displays the general operational status of NetworkManager. ```bash nmcli -t -f STATE general ``` -------------------------------- ### Activate a connection using credentials from a file Source: https://networkmanager.dev/docs/api/latest/nmcli.html Activates a connection and provides credentials (e.g., WPA PSK) using a file. Each line in the file should be in the format 'setting_name.property_name:the password'. ```bash nmcli connection up id "My WiFi" passwd-file /path/to/credentials.txt ``` -------------------------------- ### Connectivity Property Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Gets the result of the last connectivity check, useful for detecting captive portals. ```APIDOC ## Connectivity Property ### Description The result of the last connectivity check. The connectivity check is triggered automatically when a default connection becomes available, periodically and by calling a CheckConnectivity() method. This property is in general useful for the graphical shell to determine whether the Internet access is being hijacked by an authentication gateway (a "captive portal"). In such case it would typically present a web browser window to give the user a chance to authenticate and call CheckConnectivity() when the user submits a form or dismisses the window. To determine the whether the user is able to access the Internet without dealing with captive portals (e.g. to provide a network connection indicator or disable controls that require Internet access), the "State" property is more suitable. ### Returns NMConnectivityState ### Type readable u ``` -------------------------------- ### Enable nm-cloud-setup Systemd Service Source: https://networkmanager.dev/docs/api/latest/nm-cloud-setup.html Enable the nm-cloud-setup systemd service to ensure the tool runs only once at any given time. This service is also used by the nm-cloud-setup timer. ```bash systemctl enable nm-cloud-setup.service ``` -------------------------------- ### AddConnectionUnsaved Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Settings.html Adds a new connection without saving it to disk immediately. The connection is not started automatically. ```APIDOC ## AddConnectionUnsaved ### Description Add new connection but do not save it to disk immediately. This operation does not start the network connection unless (1) device is idle and able to connect to the network described by the new connection, and (2) the connection is allowed to be started automatically. Use the 'Save' method on the connection to save these changes to disk. ### Method POST ### Endpoint /org/freedesktop/NetworkManager/Settings ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **connection** (a{sa{sv}}) - Required - Connection settings and properties. ### Request Example ```json { "connection": { "connection": { "id": "MyWifiUnsaved", "uuid": "...", "type": "wifi" }, "wifi": { "ssid": "MyNetwork" } } } ``` ### Response #### Success Response (200) - **path** (o) - Object path of the new connection that was just added. #### Response Example ```json { "path": "/org/freedesktop/NetworkManager/Settings/3" } ``` ``` -------------------------------- ### State Property Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Gets the overall state of the NetworkManager daemon, considering active connections and connectivity status. ```APIDOC ## State Property ### Description The overall state of the NetworkManager daemon. This takes state of all active connections and the connectivity state into account to produce a single indicator of the network accessibility status. The graphical shells may use this property to provide network connection status indication and applications may use this to check if Internet connection is accessible. Shell that is able to cope with captive portals should use the "Connectivity" property to decide whether to present a captive portal authentication dialog. ### Returns NMState ### Type readable u ``` -------------------------------- ### Get Connection by UUID Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Settings.html Finds the object path of a network connection using its unique identifier (UUID). ```dbus GetConnectionByUuid (IN s uuid, OUT o connection); ``` -------------------------------- ### Create and connect to a Wi-Fi network Source: https://networkmanager.dev/docs/api/latest/nmcli.html Creates a new connection profile for a specified Wi-Fi SSID and password, then connects to it. Useful for first-time connections. ```bash nmcli dev wifi con "Cafe Hotspot 1" password caffeine name "My cafe" ``` -------------------------------- ### Sample OpenVPN Configuration Source: https://networkmanager.dev/docs/api/latest/nm-settings-keyfile.html A sample configuration for an OpenVPN connection using the keyfile format. This snippet includes VPN service type, authentication details, and server information. ```ini [connection] id=RedHat-openvpn uuid=7f9b3356-b210-4c0e-8123-bd116c9c280f type=vpn timestamp=1385401165 [vpn] service-type=org.freedesktop.NetworkManager.openvpn connection-type=password password-flags=3 remote=ovpn.my-company.com cipher=AES-256-CBC reneg-seconds=0 port=443 username=joe ca=/etc/openvpn/ISCA.pem tls-remote=ovpn.my-company.com [ipv6] method=auto [ipv4] method=auto ignore-auto-dns=true never-default=true ``` -------------------------------- ### Get Settings Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Settings.Connection.html Retrieves the settings maps that describe the network configuration, excluding any secrets required for connection. ```APIDOC ## Get Settings ### Description Retrieves the settings maps that describe the network configuration, excluding any secrets required for connection. ### Method GetSettings ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **settings** (a{sa{sv}}) - The nested settings maps describing this object. #### Response Example ```json { "settings": { "setting_name": { "key": "value" } } } ``` ``` -------------------------------- ### Get NetworkManager Logging Configuration Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Retrieves the current logging verbosity level and the set of domains for which logging is enabled. ```gdbus GetLogging (OUT s level, OUT s domains); ``` -------------------------------- ### Get List of All Network Devices Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Retrieves a list of all network devices, including those that are not yet realized but can be automatically created. ```dbus GetAllDevices (OUT ao devices); ``` -------------------------------- ### Configure nm-cloud-setup via Systemd Override Source: https://networkmanager.dev/docs/api/latest/nm-cloud-setup.html Set environment variables for nm-cloud-setup by creating a systemd override file. This allows customization of cloud provider opt-ins and other settings. ```bash systemctl edit nm-cloud-setup.service ``` -------------------------------- ### Basic NetworkManager.conf Structure Source: https://networkmanager.dev/docs/api/latest/NetworkManager.conf.html A minimal NetworkManager.conf file defining the main section and specifying the keyfile plugin. ```ini [main] plugins=keyfile ``` -------------------------------- ### Get Device Status Source: https://networkmanager.dev/docs/api/latest/nmcli.html Prints the status of all network devices. This is the default action for `nmcli device` if no command is specified. ```bash nmcli device status ``` -------------------------------- ### Show all connections in multi-line format Source: https://networkmanager.dev/docs/api/latest/nmcli.html Displays all connection details, formatted for readability with multiple lines per connection. ```bash nmcli -p -m multiline -f all con show ``` -------------------------------- ### Get NetworkManager State Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Retrieves the overall networking state managed by NetworkManager. This is based on the state of all network devices under its management. ```gdbus state (OUT u state); ``` -------------------------------- ### NewConnection Signal Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Settings.html Emitted when a new connection has been added after NetworkManager has started up and initialized. This signal is not emitted for connections read during startup. ```APIDOC ## NewConnection Signal ### Description Emitted when a new connection has been added after NetworkManager has started up and initialized. This signal is not emitted for connections read while starting up. To retrieve the initial connection list, call ListConnections() and then listen for this signal for subsequent updates. ### Signal DBUS_SIGNAL ### Path /org/freedesktop/NetworkManager/Settings ### Parameters #### Arguments - **connection** (object path) - Object path of the new connection. ### Event Example (DBus signal emission with connection object path) ``` -------------------------------- ### AddConnection Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Settings.html Adds a new connection and saves it to disk. The connection is started automatically if the device is idle and the connection is allowed to auto-connect. ```APIDOC ## AddConnection ### Description Add new connection and save it to disk. This operation does not start the network connection unless (1) device is idle and able to connect to the network described by the new connection, and (2) the connection is allowed to be started automatically. ### Method POST ### Endpoint /org/freedesktop/NetworkManager/Settings ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **connection** (a{sa{sv}}) - Required - Connection settings and properties. ### Request Example ```json { "connection": { "connection": { "id": "MyWifi", "uuid": "...", "type": "wifi" }, "wifi": { "ssid": "MyNetwork" }, "802-1x": { "eap": "tls" } } } ``` ### Response #### Success Response (200) - **path** (o) - Object path of the new connection that was just added. #### Response Example ```json { "path": "/org/freedesktop/NetworkManager/Settings/2" } ``` ``` -------------------------------- ### Import OpenVPN Configuration with nmcli Source: https://networkmanager.dev/docs/api/latest/nmcli.html Imports an OpenVPN configuration file into NetworkManager. The file path should be valid and the file correctly formatted. ```bash nmcli con import type openvpn file ~/Downloads/frootvpn.ovpn ``` -------------------------------- ### Print Connection Details Source: https://networkmanager.dev/docs/api/latest/nmcli-examples.html This command displays the detailed configuration of the current network connection. ```bash nmcli> **print** =========================================================================== Connection details =========================================================================== connection.id: ethernet-4 connection.uuid: de89cdeb-a3e1-4d53-8fa0-c22546c775f4 connection.interface-name: -- connection.type: 802-3-ethernet connection.autoconnect: yes connection.autoconnect-priority: 0 connection.timestamp: 0 connection.read-only: no connection.permissions: connection.zone: -- connection.controller: -- connection.port-type: -- connection.secondaries: connection.gateway-ping-timeout: 0 --------------------------------------------------------------------------- 802-3-ethernet.port: -- 802-3-ethernet.speed: 0 802-3-ethernet.duplex: -- 802-3-ethernet.auto-negotiate: yes 802-3-ethernet.mac-address: -- 802-3-ethernet.cloned-mac-address: -- 802-3-ethernet.mac-address-blacklist: 802-3-ethernet.mtu: 1492 802-3-ethernet.s390-subchannels: 802-3-ethernet.s390-nettype: -- 802-3-ethernet.s390-options: --------------------------------------------------------------------------- ipv4.method: manual ipv4.dns: ipv4.dns-search: ipv4.addresses: 192.168.1.100/24 ipv4.gateway: 192.168.1.1 ipv4.routes: ipv4.route-metric: -1 ipv4.ignore-auto-routes: no ipv4.ignore-auto-dns: no ipv4.dhcp-client-id: -- ipv4.dhcp-send-hostname: yes ipv4.dhcp-hostname: -- ipv4.never-default: no ipv4.may-fail: yes --------------------------------------------------------------------------- ipv6.method: auto ipv6.dns: ipv6.dns-search: ipv6.addresses: ipv6.routes: ipv6.route-metric: -1 ipv6.ignore-auto-routes: no ipv6.ignore-auto-dns: no ipv6.never-default: no ipv6.may-fail: yes ipv6.ip6-privacy: -1 (unknown) ipv6.dhcp-hostname: -- --------------------------------------------------------------------------- ``` -------------------------------- ### Create Open vSwitch Bridge and Internal Interface Source: https://networkmanager.dev/docs/api/latest/nm-openvswitch.html Adds an Open vSwitch bridge and configures a single internal interface with a static IP address. Use this to set up a basic bridge with network connectivity. ```bash $ nmcli conn add type ovs-bridge conn.interface bridge0 Connection 'ovs-bridge-bridge0' (d10fc64d-1d48-4394-a1b8-e1aea72f27d5) successfully added. $ nmcli conn add type ovs-port conn.interface port0 controller bridge0 Connection 'ovs-port-port0' (5ae22bae-bba4-4815-9ade-7e635633e1f0) successfully added. $ nmcli conn add type ovs-interface port-type ovs-port conn.interface iface0 \ controller port0 ipv4.method manual ipv4.address 192.0.2.1/24 Connection 'ovs-interface-iface0' (3640d2a1-a2fd-4718-92f1-cffadb5b6cdc) successfully added. ``` -------------------------------- ### Get NetworkManager Permissions Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Retrieves the permissions a caller has for authenticated operations. Use the returned values to indicate to users which operations they can perform. ```gdbus GetPermissions (OUT a{ss} permissions); ``` -------------------------------- ### Sample VLAN Configuration Source: https://networkmanager.dev/docs/api/latest/nm-settings-keyfile.html A sample configuration for a VLAN interface using the keyfile format. This snippet defines the VLAN interface name, parent device, and VLAN ID. ```ini [connection] id=VLAN for building 4A uuid=8ce1c9e0-ce7a-4d2c-aa28-077dda09dd7e interface-name=VLAN-4A type=vlan [vlan] interface-name=VLAN-4A parent=eth0 id=4 ``` -------------------------------- ### Get Multiple Fields from a Connection Source: https://networkmanager.dev/docs/api/latest/nmcli-examples.html Retrieves both IPv4 address and DNS information for a connection. Multiple fields can be requested, separated by commas. ```bash $ nmcli -g ip4.address,ip4.dns connection show my-con-eth0 192.168.1.12/24 192.168.1.1 ``` -------------------------------- ### Get IP4 Address of a Connection Source: https://networkmanager.dev/docs/api/latest/nmcli-examples.html Retrieves the IPv4 address of a specific network connection using the nmcli command with the -g option. ```bash $ nmcli -g ip4.address connection show my-con-eth0 192.168.1.12/24 ``` -------------------------------- ### Get Applied Connection Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Device.html Retrieves the currently applied connection settings and its version ID for a network device, based on the provided flags. ```APIDOC ## GetAppliedConnection ### Description Retrieves the currently applied connection settings and its version ID for a network device, based on the provided flags. ### Method GetAppliedConnection ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **flags** (u) - Required - Flags which would modify the behavior of the GetAppliedConnection call. Invalid flags are rejected. ### Request Example ```json { "flags": 0 } ``` ### Response #### Success Response (0) - **connection** (a{sa{sv}}) - The applied connection settings. - **version_id** (t) - The version ID of the applied connection. #### Response Example ```json { "connection": { "example_setting": { "value": "example_value" } }, "version_id": 12345 } ``` ``` -------------------------------- ### Updated Signal Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Settings.Connection.html The 'Updated' signal is emitted when connection settings or permissions change. Clients should re-read the connection to get the latest changes. ```dbus Updated (); ``` -------------------------------- ### Create and connect to a Wi-Fi hotspot Source: https://networkmanager.dev/docs/api/latest/nmcli.html Creates a Wi-Fi hotspot connection profile and activates it. The command also prints the password for other devices to use. ```bash nmcli -s dev wifi hotspot con-name QuickHotspot ``` -------------------------------- ### Show available Wi-Fi connections for an interface Source: https://networkmanager.dev/docs/api/latest/nmcli.html Lists all known connection profiles that can be used with a specific Wi-Fi interface. ```bash nmcli -f CONNECTIONS device show wlp3s0 ``` -------------------------------- ### Get Connection Settings Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Settings.Connection.html Retrieves the settings maps that describe the network configuration. This method does not return secrets, which must be requested separately. ```gdbus GetSettings (OUT a{sa{sv}} settings); ``` -------------------------------- ### Sample Ethernet Network Configuration Source: https://networkmanager.dev/docs/api/latest/nm-settings-keyfile.html A sample configuration for an ethernet network using the keyfile format. This snippet defines basic connection properties and MAC address. ```ini [connection] id=Main eth0 uuid=27afa607-ee36-43f0-b8c3-9d245cdc4bb3 type=802-3-ethernet autoconnect=true [ipv4] method=auto [802-3-ethernet] mac-address=00:23:5a:47:1f:71 ``` -------------------------------- ### List all connection profiles Source: https://networkmanager.dev/docs/api/latest/nmcli.html Lists all in-memory and on-disk connection profiles. Use --active to show only active profiles. Ordering can be customized by category like active, name, type, or path. ```bash nmcli connection show ``` -------------------------------- ### Create Open vSwitch Bond Source: https://networkmanager.dev/docs/api/latest/nm-openvswitch.html Sets up an Open vSwitch bond by creating an OVS port and attaching multiple Ethernet interfaces to it. This enhances network resilience and throughput. ```bash $ nmcli conn add type ovs-port conn.interface bond0 controller bridge0 Connection 'ovs-port-bond0' (d154ebf9-e999-4e1b-a084-a3de53d25d8a) successfully added. $ nmcli conn add type ethernet conn.interface eth2 controller bond0 Connection 'ovs-slave-eth2' (475ac1bf-30b2-4534-a877-27f33f58b082) successfully added. $ nmcli conn add type ethernet conn.interface eth3 controller bond0 Connection 'ovs-slave-eth3' (8dedeecb-ed12-482b-b77a-24a4fb835136) successfully added. ``` -------------------------------- ### Get List of Realized Network Devices Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Retrieves a list of network devices that are currently realized by the system. This list excludes device placeholders. ```dbus GetDevices (OUT ao devices); ``` -------------------------------- ### Add Ethernet Connection and Configure SR-IOV VFs Source: https://networkmanager.dev/docs/api/latest/nmcli-examples.html Demonstrates adding an Ethernet connection and configuring SR-IOV VFs, including MAC address, VLAN, trust, spoof-check, and max-tx-rate settings. ```bash $ nmcli con add type ethernet con-name EthernetPF ifname em1 $ nmcli con modify EthernetPF sriov.total-vfs 3 sriov.autoprobe-drivers false $ nmcli con modify EthernetPF sriov.vfs '0 mac=00:11:22:33:44:55 vlans=10, 1 trust=true spoof-check=false' $ nmcli con modify EthernetPF +sriov.vfs '2 max-tx-rate=20' ``` -------------------------------- ### Activate a connection with progress Source: https://networkmanager.dev/docs/api/latest/nmcli.html Activates a connection profile and displays the progress of the activation process. Specify the interface name if needed. ```bash nmcli -p con up "My wired connection" ifname eth0 ``` -------------------------------- ### Get Applied Connection Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Device.html Retrieves the currently applied connection settings for a device. Use flags value 0 as no flags are currently defined. ```dbus GetAppliedConnection (IN u flags, OUT a{sa{sv}} connection, OUT t version_id); ``` -------------------------------- ### CheckpointCreate Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Creates a network configuration checkpoint. ```APIDOC ## CheckpointCreate ### Description Creates a network configuration checkpoint. ### Method DBUS ### Endpoint org.freedesktop.NetworkManager.CheckpointCreate ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **devices** (ao) - Required - An array of object paths for the devices to include in the checkpoint. - **rollback_timeout** (u) - Required - The timeout in seconds for automatic rollback. - **flags** (u) - Required - Flags to control checkpoint creation. ### Request Example ``` org.freedesktop.NetworkManager.CheckpointCreate(['/org/freedesktop/NetworkManager/Devices/0'], 60, 0) ``` ### Response #### Success Response (200) - **checkpoint** (o) - The object path of the created checkpoint. #### Response Example ``` '/org/freedesktop/NetworkManager/Checkpoints/0' ``` ``` -------------------------------- ### CheckpointAdjustRollbackTimeout Method Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Resets the rollback timeout for a given checkpoint. The added seconds start from now. The 'Created' property remains unchanged, but 'RollbackTimeout' is recalculated. ```dbus CheckpointAdjustRollbackTimeout (IN o checkpoint, IN u add_timeout); ``` -------------------------------- ### org.freedesktop.NetworkManager.SecretAgent Methods Source: https://networkmanager.dev/docs/api/latest/ix01.html Provides methods for managing secrets within the NetworkManager system, including canceling secret retrieval, deleting, getting, and saving secrets. ```APIDOC ## org.freedesktop.NetworkManager.SecretAgent ### Description Methods for interacting with NetworkManager's secret agent to manage sensitive network information. ### Methods - **CancelGetSecrets()**: Cancels an ongoing request to retrieve secrets. - **DeleteSecrets()**: Deletes stored secrets. - **GetSecrets()**: Retrieves stored secrets. - **SaveSecrets()**: Saves secrets to the system. ``` -------------------------------- ### Get Secrets Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Settings.Connection.html Retrieves the secrets associated with a specific setting or all secrets for the network configuration. Only secrets from persistent storage or the requestor's session are returned. ```APIDOC ## Get Secrets ### Description Retrieves the secrets associated with a specific setting or all secrets for the network configuration. Only secrets from persistent storage or the requestor's session are returned. ### Method GetSecrets ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **setting_name** (s) - Required - Name of the setting to return secrets for. If empty, all secrets will be returned. ### Request Example ```json { "setting_name": "wifi" } ``` ### Response #### Success Response (200) - **secrets** (a{sa{sv}}) - Nested settings maps containing secrets. #### Response Example ```json { "secrets": { "ssid": { "value": "my_network" } } } ``` ``` -------------------------------- ### Sample WPA-EAP WiFi Configuration Source: https://networkmanager.dev/docs/api/latest/nm-settings-keyfile.html A sample configuration for a WPA-EAP secured WiFi network, including PEAP with MSCHAPv2 and an always-ask secret. It specifies security settings and EAP parameters. ```ini [connection] id=CompanyWIFI uuid=cdac6154-a33b-4b15-9904-666772cfa5ee type=wifi autoconnect=false [wifi] ssid=CorpWLAN mode=infrastructure security=802-11-wireless-security [wifi-security] key-mgmt=wpa-eap [ipv4] method=auto [ipv6] method=auto [802-1x] eap=peap; identity=joe ca-cert=/home/joe/.cert/corp.crt phase1-peapver=1 phase2-auth=mschapv2 password-flags=2 ``` -------------------------------- ### Get Connection Secrets Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Settings.Connection.html Retrieves secrets for a specific setting or all secrets if setting_name is empty. Only secrets from persistent storage or a session Secret Agent are returned. ```gdbus GetSecrets (IN s setting_name, OUT a{sa{sv}} secrets); ``` -------------------------------- ### Connect Method Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.VPN.Plugin.html Initiates a VPN connection without allowing interactive secret requests. The connection details are provided. ```dbus Connect (IN a{sa{sv}} connection); ``` -------------------------------- ### Show static configuration of a connection Source: https://networkmanager.dev/docs/api/latest/nmcli.html Retrieves the static configuration settings for a specified connection profile. ```bash nmcli -f profile con s "My wired connection" ``` -------------------------------- ### Add New Connection (Saved) Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Settings.html Adds a new network connection profile and saves it to disk. The connection may be started automatically if conditions are met. ```dbus AddConnection (IN a{sa{sv}} connection, OUT o path); ``` -------------------------------- ### Add a new Ethernet connection interactively Source: https://networkmanager.dev/docs/api/latest/nmcli.html Opens an interactive editor to create and configure a new Ethernet connection profile. ```bash nmcli connection edit type ethernet con-name "yet another Ethernet connection" ``` -------------------------------- ### CheckpointAdjustRollbackTimeout Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.html Resets the timeout for rolling back a checkpoint. The added seconds start counting from the current time. The 'Created' property remains unchanged, but 'RollbackTimeout' is recalculated. ```APIDOC ## CheckpointAdjustRollbackTimeout() ### Description Resets the timeout for rollback for the checkpoint. The added seconds start counting from now. The 'Created' property of the checkpoint will stay unchanged, but the 'RollbackTimeout' will be recalculated. ### Method N/A (This is a method call, not an HTTP method) ### Endpoint N/A (This is a D-Bus method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **checkpoint** (o) - Required - The checkpoint to be rolled back. - **add_timeout** (u) - Required - Number of seconds from now in which the timeout will expire. Set to 0 to disable the timeout. ### Request Example ``` CheckpointAdjustRollbackTimeout (in checkpoint, in add_timeout) ``` ### Response #### Success Response N/A (Method call, success is indicated by lack of error) #### Response Example N/A ``` -------------------------------- ### Add team controller and Ethernet ports Source: https://networkmanager.dev/docs/api/latest/nmcli-examples.html Creates a team interface with a specified configuration file and adds two Ethernet ports to it. ```bash nmcli con add type team con-name Team1 ifname Team1 config team1-controller-json.conf ``` ```bash nmcli con add type ethernet con-name Team1-port1 ifname em1 controller Team1 ``` ```bash nmcli con add type ethernet con-name Team1-port2 ifname em2 controller Team1 ``` -------------------------------- ### Bring Device Up Source: https://networkmanager.dev/docs/api/latest/nmcli.html Connects a network device. NetworkManager attempts to find and activate a suitable connection, creating a new profile with default settings if none exists. The default timeout is 90 seconds. ```bash nmcli device up eth0 ``` -------------------------------- ### Get All Visible Access Points Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.Device.Wireless.html Retrieves a list of all access points visible to the Wi-Fi device, including those with hidden SSIDs. This is the recommended method for obtaining a comprehensive list. ```dbus GetAllAccessPoints (OUT ao access_points); ``` -------------------------------- ### org.freedesktop.NetworkManager.Device.Reapply() Method Source: https://networkmanager.dev/docs/api/latest/ix01.html The Reapply() method is available for NetworkManager devices. ```APIDOC ## Reapply() ### Description Applies pending changes to the device configuration. ### Method (Method call, not HTTP) ``` -------------------------------- ### NetworkManager PPP Interface Methods Source: https://networkmanager.dev/docs/api/latest/gdbus-org.freedesktop.NetworkManager.PPP.html Lists the available methods for the org.freedesktop.NetworkManager.PPP D-Bus interface. ```dbus NeedSecrets (OUT s username, OUT s password); SetIp4Config (IN a{sv} config); SetIp6Config (IN a{sv} config); SetState (IN u state); SetIfindex (IN i ifindex); ```