Linux7修改网络-nmcli介绍
[root@iyoume01 network-scripts]# nmcli con del enp0s8
Connection 'enp0s8' (24d676cf-7612-4e9f-8909-4818bf905070) successfully deleted.
[root@iyoume01 network-scripts]#
[root@iyoume01 network-scripts]#
[root@iyoume01 network-scripts]# nmcli con sh
NAME UUID TYPE DEVICE
enp0s3 372ce1cd-659b-470d-8b19-73fbaee48cd0 ethernet enp0s3
virbr0 ceec7d36-cae0-4e57-ad9f-54a37ee1970e bridge virbr0
[root@iyoume01 network-scripts]# nmcli conn add type ethernet con-name enp0s8 ifname enp0s8
Connection 'enp0s8' (451608f1-3fad-4747-84fd-ba9876ec59ef) successfully added.
[root@iyoume01 network-scripts]#
[root@iyoume01 network-scripts]# nmcli con sh
NAME UUID TYPE DEVICE
enp0s3 372ce1cd-659b-470d-8b19-73fbaee48cd0 ethernet enp0s3
virbr0 ceec7d36-cae0-4e57-ad9f-54a37ee1970e bridge virbr0
enp0s8 451608f1-3fad-4747-84fd-ba9876ec59ef ethernet enp0s8
[root@iyoume01 network-scripts]# nmcli dev
DEVICE TYPE STATE CONNECTION
enp0s3 ethernet connected enp0s3
virbr0 bridge connected virbr0
enp0s8 ethernet connecting (getting IP configuration) enp0s8
lo loopback unmanaged --
virbr0-nic tun unmanaged --
[root@iyoume01 network-scripts]#
[root@iyoume01 network-scripts]# nmcli connection modify enp0s8 ipv4.method manual
Error: Failed to modify connection 'enp0s8': ipv4.addresses: this property cannot be empty for 'method=manual'
[root@iyoume01 network-scripts]# nmcli connection modify enp0s8 ipv4.address 10.10.0.140/24
[root@iyoume01 network-scripts]# nmcli connection modify enp0s8 ipv4.method manual
[root@iyoume01 network-scripts]#
[root@iyoume01 network-scripts]# nmcli connection modify enp0s8 ipv4.method manual
connection.autoconnect yes