CentOS 6.9에서 nmcli를 사용하여 고정 IP를 생성하려고 하는데 man nmcli가 온라인 예제처럼 충분한 옵션을 표시하지 않기 때문에 그렇게 할 수 없습니다. 모든 사람의 이해를 위해 여기에 매뉴얼 페이지를 붙여 넣을 예정입니다. Ubuntu에서 변경한 후 많은 차이점을 발견했으므로 무엇이 잘못되었는지 알려주십시오. 아니면 배포판의 잘못입니까?
NMCLI(1) NMCLI(1)
NAME
nmcli - command-line tool for controlling NetworkManager
SYNOPSIS
nmcli [ OPTIONS ] OBJECT { COMMAND | help }
OBJECT := { nm | con | dev }
OPTIONS := {
-t[erse]
-p[retty]
-m[mode] tabular | multiline
-f[ields] <field1,field2,...> | all | common
-e[scape] yes | no
-v[ersion]
-h[elp]
}
DESCRIPTION
nmcli is a command-line tool for controlling NetworkManager and getting its status. It is not meant as a replacement of nm-applet or other similar clients. Rather it’s a complementary utility to these pro-
grams. The main nmcli’s usage is on servers, headless machines or just for power users who prefer the command line.
The use cases comprise:
— Initscripts: ifup/ifdown can utilize NetworkManager via nmcli instead of having to manage connections itself and possible interfere with NetworkManager.
— Servers, headless machines: No GUI is available; then nmcli is used to talk directly to NetworkManager and control only system-wide connections.
— User sessions: For this case, nmcli can talk to nm-applet to find user connections. It can still talk directly to NetworkManager for manipulating these connections. As nmcli doesn’t have direct access
to user configuration data in GConf, nm-applet handles that itself. That may, for example, cause the applet to pop up keyring dialogs when secrets are needed.
OPTIONS
-t, --terse
Output is terse. This mode is designed and suitable for computer (script) processing.
-p, --pretty
Output is pretty. This causes nmcli to produce easy readable outputs for humans, i.e. values are aligned, headers are printed, etc.
-m, --mode tabular | multiline
Switch between tabular and multiline output. If omitted, default is tabular for most commands. For the commands producing more structured information, that cannot be displayed on a single line,
default is multiline. Currenly, they are:
’nmcli con list id|uuid <name>’
’nmcli dev list’
tabular - Output is a table where each line describes a single entry. Columns define particular properties of the entry.
multiline - Each entry comprises more lines, each property on its own line. The values are prefixed with the property name.
-f, --fields <field1,field2,...> | all | common
This option is used to specify what fields (column names) should be printed. Valid field names differ for specific commands. List available fields by providing an invalid value to the --fields
option.
all is used to print all valid field values of the command. common is used to print common field values of the command. If omitted, default is common. The option is mandatory when --terse is used.
In this case, generic values all and common cannot be used. (This is to maintain compatibility when new fields are added in the future).
-e, --escape yes | no
Whether to escape ’:’ and ’\’ characters in terse tabular mode. The escape character is ’\’. If omitted, default is yes.
-v, --version
Show nmcli version.
-h, --help
Print help information.
OBJECT
nm NetworkManager
Use this object to inquire and change state of NetworkManager.
COMMAND := { status | sleep | wakeup | wifi | wwan }
status
Show overall status of NetworkManager. This is the default action, when no command is provided to nm object.
Reference to D-Bus:
No simple reference.
sleep
Put NetworkManager to sleeping mode. Thus all interfaces that NetworkManager manages are deactivated.
Reference to D-Bus:
interface: org.freedesktop.NetworkManager
method: Sleep
arguments: TRUE
wakeup
Awake NetworkManager from sleep. When NetworkManager is awaken, devices are available to be activated.
Reference to D-Bus:
interface: org.freedesktop.NetworkManager
method: Sleep
arguments: FALSE
wifi [on|off]
Inquire or set status of WiFi in NetworkManager. Without any further argument, WiFi status is printed; on enables WiFi; off disables WiFi.
Reference to D-Bus:
No simple reference.
wwan [on|off]
Inquire or set status of WWAN in NetworkManager. Without any further argument, WWAN status is printed; on enables WWAN; off disables WWAN.
Reference to D-Bus:
No simple reference.
con Connections
Get information about NetworkManager’s connections.
con Connections
Get information about NetworkManager’s connections.
COMMAND := { list | status | up | down }
list [id <id> | uuid <id> | system | user]
List configured connections. Without a parameter, configured connection from both system and user settings services are listed. system argument filters only system-wide connections, user
prints user connections only. In order to get connection details, id with connection’s name or uuid with connection’s UUID shall be specified. When no command is given to con object, the
default action is ’nmcli con list’.
Reference to D-Bus:
No simple reference.
status
Print status of active connections.
Reference to D-Bus:
No simple reference.
up id <id> | uuid <id> [iface <iface>] [ap <hwaddr>] [--nowait] [--timeout <timeout>]
Activate a connection. The connection is identified by its name using id or UUID using uuid. For requiring particular device to activate the connection on, iface option with interface name
should be given. ap option can further concretize what AP should be used in case of WiFi connection. --nowait option causes nmcli to exit immediately and not to wait for command completion.
--timeout option provides a means to specify how long to wait for operation completion.
Reference to D-Bus:
interface: org.freedesktop.NetworkManager
method: ActivateConnection
arguments: according to arguments
down id <id> | uuid <id>
Deactivate a connection. The connection is identified by its name using id or UUID using uuid.
Reference to D-Bus:
interface: org.freedesktop.NetworkManager
method: DeactivateConnection
arguments: according to arguments
dev Devices
Get information about devices.
COMMAND := { status | list | disconnect | wifi }
status
Print status of devices. This is the default action, when no command is specified to dev object.
Reference to D-Bus:
No simple reference.
list [iface <iface>]
Get detailed information about devices. Without an argument, all devices are examined. To get information for a specific device, iface argument with the interface name should be provided.
Reference to D-Bus:
No simple reference.
disconnect iface <iface> [--nowait] [--timeout <timeout>]
Disconnect a device and prevent the device from automatically activating further connections without user/manual intervention. --nowait option causes nmcli to exit immediately and not to wait
for command completion. --timeout option provides a means to specify how long to wait for operation completion.
Reference to D-Bus:
interface: org.freedesktop.NetworkManager.Device
method: Disconnect
arguments: none
wifi [list [iface <iface>] [hwaddr <hwaddr>]]
List available WiFi access points. iface and hwaddr options can be used to get just APs for particular interface or specific AP, respectively.
Reference to D-Bus:
No simple reference.
BUGS
There are probably some. If you find a bug, please report to https://bugzilla.gnome.org/ - product NetworkManager.
SEE ALSO
nm-tool(1), NetworkManager(8).
14 April 2010 NMCLI(1)
(END)
답변1
사용 가능한 연결을 나열합니다.
nmcli con show
또는
nmcli connection show
연결 수정
nmcli con edit "connection name"
또는
nmcli connection edit "connection name"
고정 IP 설정:
nmcli> set ipv4.addresses 192.168.1.100/24
nmcli> save
nmcli> quit
그런 다음 네트워크 관리자를 다시 시작하십시오.
다음을 통해 구성된 IP를 볼 수 있습니다.
nmcli> print
IP 주소를 제거하려면(여러 IP를 추가하지 않으려면 고정 IP를 추가하기 전에 이 방법을 사용해야 합니다):
nmcli> remove ipv4.addresses