Questo contenuto non è disponibile nella lingua selezionata.

7.3. Network Bonding Using the NetworkManager Command Line Tool, nmcli


Note

To create a bond connection with the nmcli tool, issue the following command:
~]$ nmcli con add type bond ifname mybond0nmcli con add type bond ifname mybond0
Connection 'bond-mybond0' (5f739690-47e8-444b-9620-1895316a28ba) successfully added.
Copy to Clipboard Toggle word wrap
Note that as no con-name was given for the bond, the connection name was derived from the interface name by prepending the type.
NetworkManager supports most of the bonding options provided by the kernel. For example:
~]$ nmcli con add type bond ifname mybond0 bond.options "mode=balance-rr,miimon=100"nmcli con add type bond ifname mybond0 bond.options "mode=balance-rr,miimon=100"nmcli con add type bond ifname mybond0 bond.options "mode=balance-rr,miimon=100"
Connection 'bond-mybond0' (5f739690-47e8-444b-9620-1895316a28ba) successfully added.
Copy to Clipboard Toggle word wrap
To add a port interface:
  1. Set the controller property to the bond interface name, or to the name of the controller connection:
~]$ nmcli con add type ethernet ifname ens3 master mybond0nmcli con add type ethernet ifname ens3 master mybond0nmcli con add type ethernet ifname ens3 master mybond0nmcli con add type ethernet ifname ens3 master mybond0
Connection 'bond-slave-ens3' (220f99c6-ee0a-42a1-820e-454cbabc2618) successfully added.
Copy to Clipboard Toggle word wrap
To add a new port interface, repeat the previous command with the new interface. For example:
~]$ nmcli con add type ethernet ifname ens7 master mybond0nmcli con add type ethernet ifname ens7 master mybond0nmcli con add type ethernet ifname ens7 master mybond0nmcli con add type ethernet ifname ens7 master mybond0
Connection 'bond-slave-ens7' (ecc24c75-1c89-401f-90c8-9706531e0231) successfully added.
Copy to Clipboard Toggle word wrap
To activate the ports, issue a command as follows:
~]$ nmcli con up bond-slave-ens7nmcli con up bond-slave-ens7
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/14)
Copy to Clipboard Toggle word wrap
~]$ nmcli con up bond-slave-ens3nmcli con up bond-slave-ens3
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/15)
Copy to Clipboard Toggle word wrap
When you activate a port, the controller connection also starts. You can see Section 7.1, “Understanding the Default Behavior of Controller and Port Interfaces” for more information. In this case, it is not necessary to manually activate the controller connection.
It is possible to change the active_slave option and the primary option of the bond at runtime, without deactivating the connection. For example to change the active_slave option, issue the following command:
~]$ nmcli dev mod bond0 +bond.options "active_slave=ens7"nmcli dev mod bond0 +bond.options "active_slave=ens7"nmcli dev mod bond0 +bond.options "active_slave=ens7"nmcli dev mod bond0 +bond.options "active_slave=ens7"nmcli dev mod bond0 +bond.options "active_slave=ens7"
Connection successfully reapplied to device 'bond0'.
Copy to Clipboard Toggle word wrap
or to change the primary option:
~]$ nmcli dev mod bond0 +bond.options "primary=ens3"nmcli dev mod bond0 +bond.options "primary=ens3"nmcli dev mod bond0 +bond.options "primary=ens3"nmcli dev mod bond0 +bond.options "primary=ens3"nmcli dev mod bond0 +bond.options "primary=ens3"
Connection successfully reapplied to device 'bond0'.
Copy to Clipboard Toggle word wrap

Note

The active_slave option sets the currently active port whereas the primary option of the bond specifies the active port to be automatically selected by kernel when a new port is added or a failure of the active port occurs.
Torna in cima
Red Hat logoGithubredditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi. Esplora i nostri ultimi aggiornamenti.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita il Blog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

Theme

© 2025 Red Hat