The text-based user interface nmtui
for network settings is intuitive, so here's a note of the command line interface nmcli
.
Displays a list of recognized network interfaces. nmcli c
Example
# nmcli c[onnection]
NAME UUID TYPE DEVICE
ens160 xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx ethernet ens160
Check the current status. nmcli
Example
# nmcli
Check the detailed settings of the specified network (connection ID). nmcli c s [connection ID]
Example
# nmcli c[onnection] s[how] ens160
Changes the settings of the specified network (connection ID).
nmcli c [onnection] m [odifty] [connection ID] [+ |-] \
Example
Fixed IP(For DHCP, set manual to auto)
# nmcli c m ens160 ipv4.method manual
DNS
# nmcli c m ens160 ipv4.dns 8.8.8.8,8.8.4.4
IP address
# nmcli c m ens160 ipv4.addresses 192.168.45.10/24
default gateway
# nmcli c m ens160 ipv4.gateway 192.168.45.254
IPv6 disabled
# nmcli c m ens160 ipv6.method ignore
Automatic connection
# nmcli c m ens160 connection.autoconnect yes
Static route
# nmcli c m ens160 ipv4.routes "192.168.100.0/24 192.168.45.253"
Reflect connection system settings(No need for down)
# nmcli c up ens160
hostname
# nmcli g[eneral] hostname centkun8.fukuchan-senpai.local
Tips
How to set multiple IP addresses, DNS, static routes, etc. Also, how to delete.
Example
Set multiple items separated by commas
# nmcli c m ens160 ipv4.dns "8.8.8.8,8.8.4.4"
「+Add to the existing settings with "" in the head
# nmcli c m ens160 +ipv4.dns "1.1.1.1"
「-Prefix "" to delete only the matching parameters
# nmcli c m ens160 -ipv4.dns "8.8.4.4"
「""Erase the parameter with
# nmcli c m ens160 ipv4.dns ""
Recommended Posts