Fixing networking-cli.adoc

This commit is contained in:
Eduard Alexander Lucena Mendoza 2018-02-28 12:47:51 -03:00
parent 2f6d611223
commit fd55a37bc3

View file

@ -1,4 +1,4 @@
= CLI = NetworkManager Command Line Interface (nmcli)
[[description]] [[description]]
== Description == Description
@ -10,18 +10,21 @@
Display overall status of NetworkManager Display overall status of NetworkManager
[source,bash,subs="+quotes"]
---- ----
nmcli general status nmcli general status
---- ----
Display active connections Display active connections
[source,bash]
---- ----
nmcli connection show --active nmcli connection show --active
---- ----
Display all configured connections Display all configured connections
[source,bash]
---- ----
nmcli connection show configured nmcli connection show configured
---- ----
@ -31,14 +34,16 @@ nmcli connection show configured
Connect to a configured connection by name Connect to a configured connection by name
[source,bash,subs="+quotes"]
---- ----
nmcli connection up id <connection name> nmcli connection up id _connection name_
---- ----
Disconnection by name Disconnection by name
[source,bash,subs="+quotes"]
---- ----
nmcli connection down id <connection name> nmcli connection down id _connection name_
---- ----
[[wifi]] [[wifi]]
@ -46,38 +51,44 @@ nmcli connection down id <connection name>
Get Wifi status Get Wifi status
[source,bash]
---- ----
nmcli radio wifi nmcli radio wifi
---- ----
Turn wifi on or off Turn wifi on or off
[source,bash,subs="+quotes"]
---- ----
nmcli radio wifi <on|off> nmcli radio wifi _on|off_
---- ----
List available access points(AP) to connect to List available access points(AP) to connect to
[source,bash]
---- ----
nmcli device wifi list nmcli device wifi list
---- ----
Refresh previous list Refresh previous list
[source,bash]
---- ----
nmcli device wifi rescan nmcli device wifi rescan
---- ----
Create a new connection to an open AP Create a new connection to an open AP
[source,bash,subs="+quotes"]
---- ----
nmcli device wifi connect <SSID|BSSID> nmcli device wifi connect _SSID|BSSID_
---- ----
Create a new connection to a password protected AP Create a new connection to a password protected AP
[source,bash,subs="+quotes"]
---- ----
nmcli device wifi connect <SSID|BSSID> password <password> nmcli device wifi connect _SSID|BSSID_ password _password_
---- ----
[[network-interfaces]] [[network-interfaces]]
@ -85,14 +96,16 @@ nmcli device wifi connect <SSID|BSSID> password <password>
List available devices and their status List available devices and their status
[source,bash]
---- ----
nmcli device status nmcli device status
---- ----
Disconnect an interface Disconnect an interface
[source,bash,subs="+quotes"]
---- ----
nmcli device disconnect iface <interface> nmcli device disconnect iface _interface_
---- ----
[[create-or-modify-a-connection]] [[create-or-modify-a-connection]]
@ -100,14 +113,16 @@ nmcli device disconnect iface <interface>
To create a new connection using an interactive editor To create a new connection using an interactive editor
[source,bash,subs="+quotes"]
---- ----
nmcli connection edit con-name <name of new connection> nmcli connection edit con-name _name of new connection_
---- ----
To edit an already existing connection using an interactive editor To edit an already existing connection using an interactive editor
[source,bash,subs="+quotes"]
---- ----
nmcli connection edit <connection name> nmcli connection edit _connection name_
---- ----
[[exampletutorial]] [[exampletutorial]]
@ -115,12 +130,14 @@ nmcli connection edit <connection name>
Let's create a new connection Let's create a new connection
[source,bash,subs="+quotes"]
---- ----
nmcli connection edit con-name <name of new connection> nmcli connection edit con-name _name of new connection_
---- ----
It will ask us to define a connection type It will ask us to define a connection type
[source,bash]
---- ----
Valid connection types: 802-3-ethernet (ethernet), 802-11-wireless (wifi), wimax, gsm, cdma, infiniband, adsl, bluetooth, vpn, 802-11-olpc-mesh (olpc-mesh), vlan, bond, team, bridge, bond-slave, team-slave, bridge-slave Valid connection types: 802-3-ethernet (ethernet), 802-11-wireless (wifi), wimax, gsm, cdma, infiniband, adsl, bluetooth, vpn, 802-11-olpc-mesh (olpc-mesh), vlan, bond, team, bridge, bond-slave, team-slave, bridge-slave
Enter connection type: Enter connection type:
@ -128,12 +145,14 @@ Enter connection type:
In this example we will use ethernet In this example we will use ethernet
[source,bash]
---- ----
Enter connection type: ethernet Enter connection type: ethernet
---- ----
Next this will appear, note that "nmcli>" is a prompt and that it lists the main settings available Next this will appear, note that `nmcli>` is a prompt and that it lists the main settings available
[source,bash]
---- ----
===| nmcli interactive connection editor |=== ===| nmcli interactive connection editor |===
@ -146,21 +165,23 @@ You may edit the following settings: connection, 802-3-ethernet (ethernet), 802-
nmcli> nmcli>
---- ----
We will edit the setting "ipv4" We will edit the setting `ipv4`
[source,bash]
---- ----
nmcli> goto ipv4 nmcli> goto ipv4
---- ----
Note that after this our promt has changed to this to indicate that we are currently editing the "ipv4" setting Note that after this our promt has changed to this to indicate that we are currently editing the "ipv4" setting
[source,bash]
---- ----
nmcli ipv4> nmcli ipv4>
---- ----
List available properties under the setting "ipv4" and describe the property "method" List available properties under the setting `ipv4` and describe the property `method`
[source,bash]
---- ----
nmcli ipv4> describe nmcli ipv4> describe
@ -170,21 +191,25 @@ Property name?
Property name? method Property name? method
---- ----
Let's set property "method" to "auto" Let's set property `method` to `auto`
[source,bash]
---- ----
nmcli ipv4> set method auto nmcli ipv4> set method auto
---- ----
Now that we have finished editing the "ipv4" setting let's go back to the main level. Execute the following command until the prompt looks like this "nmcli>" Now that we have finished editing the `ipv4` setting let's go back to the main level.
Execute the following command until the prompt looks like this `nmcli>`
[source,bash]
---- ----
nmcli> back nmcli> back
---- ----
If you need to list again the main settings use the "goto" command without any arguments. After that just press enter and ignore the error. If you need to list again the main settings use the `goto` command without any arguments.
After that just press enter and ignore the error.
[source,bash]
---- ----
nmcli> goto nmcli> goto
@ -194,22 +219,24 @@ Setting name?
It is possible to set a value for a property directly from the main level It is possible to set a value for a property directly from the main level
[source,bash]
---- ----
nmcli> set <setting>.<property> <value> nmcli> set __setting__.__property__ _value_
---- ----
For example: For example:
[source,bash,subs="+quotes"]
---- ----
nmcli> set connection.autoconnect TRUE nmcli> set connection.autoconnect TRUE
nmcli> set connection.interface-name <interface name this connection is bound to> nmcli> set connection.interface-name _interface name this connection is bound to_
nmcli> set ethernet.cloned-mac-address <Spoofed MAC address> nmcli> set ethernet.cloned-mac-address _Spoofed MAC address_
---- ----
Finally check the connection details, save and exit Finally check the connection details, save and exit
[source,bash]
---- ----
nmcli> print nmcli> print
@ -225,10 +252,13 @@ To manually edit a ifcfg connection configuration open or create with a text edi
A description of most common configuration options is available at: http://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-networkscripts-interfaces.html A description of most common configuration options is available at: http://access.redhat.com/site/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/s1-networkscripts-interfaces.html
To modify a connection password open with a text editor and edit the file "keys-" located in "/etc/sysconfig/network-scripts/". The password is stored in plain text. For example To modify a connection password open with a text editor and edit the file `keys-` located in `/etc/sysconfig/network-scripts/`.
The password is stored in plain text.
For example
[source,bash,subs="+quotes"]
---- ----
$ cat /etc/sysconfig/network-scripts/keys-<connection name> $ cat /etc/sysconfig/network-scripts/keys-__connection name__
WPA_PSK='password' WPA_PSK='password'
---- ----
@ -236,8 +266,9 @@ Or if using keyfile, simply edit the connection file located inside `/etc/Networ
Finally save the files and to apply changes to an already active connection execute Finally save the files and to apply changes to an already active connection execute
[source,bash,subs="+quotes"]
---- ----
nmcli connection up id <connection name> nmcli connection up id _connection name_
---- ----
[[delete-a-connection-configuration]] [[delete-a-connection-configuration]]
@ -245,8 +276,9 @@ nmcli connection up id <connection name>
Delete the connection Delete the connection
[source,bash,subs="+quotes"]
---- ----
nmcli connection delete id <connection name> nmcli connection delete id _connection name_
---- ----
Please note this also deactivates the connection. Please note this also deactivates the connection.
@ -254,9 +286,10 @@ Please note this also deactivates the connection.
[[documentation-for-networkmanager-command-line-interface-nmcli]] [[documentation-for-networkmanager-command-line-interface-nmcli]]
== Documentation for NetworkManager Command Line Interface nmcli == Documentation for NetworkManager Command Line Interface nmcli
The primary reference for nmcli are the manual pages nmcli and nmcli-examples. For a quick reference, the user can type `nmcli The primary reference for nmcli are the manual pages nmcli and nmcli-examples.
[help]` to print the supported options and commands. The help parameter can also be used to obtain a more detailed description for the For a quick reference, the user can type `nmcli help` to print the supported options and commands.
individual commands. For example `nmcli connection help` and `nmcli connection add help` show a description for the possible connection operations and for how to add connections, respectively. The help parameter can also be used to obtain a more detailed description for the individual commands.
For example `nmcli connection help` and `nmcli connection add help` show a description for the possible connection operations and for how to add connections, respectively.
The newest version of the manual page can be found on https://developer.gnome.org/NetworkManager/unstable/nmcli.html[nmcli] and https://developer.gnome.org/NetworkManager/unstable/nmcli-examples.html[nmcli-examples]. The newest version of the manual page can be found on https://developer.gnome.org/NetworkManager/unstable/nmcli.html[nmcli] and https://developer.gnome.org/NetworkManager/unstable/nmcli-examples.html[nmcli-examples].
@ -267,7 +300,10 @@ nmcli maybe contain some bugs and lack some features graphical tools for Network
To see all available options for your version of nmcli To see all available options for your version of nmcli
[source,bash]
---- ----
info nmcli info nmcli
---- ----
See a typo, something missing or out of date, or anything else which can be improved?
Edit this document at https://pagure.io/fedora-docs/quick-docs.