查看

1
2
3
sudo systemctl -l |grep -E 'network|\Network'
sudo systemctl status network.service
sudo systemctl status NetworkManager.service

命令

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
whereis nmcli
# nmcli是命令行的管理NetworkManager的工具,会自动把配置写到/etc/sysconfig/network-scripts/目录下面。
nmcli -version
nmcli g status
# 修改主机名
nmcli g hostname [<hostname>]
hostnamectl set-hostname [<hostname>]
nmcli r wifi
nmcli c show
sudo nmcli c up ifname eth1
sudo ip link set eth1 up
nmcli d status
nmcli d show docker0
nmcli d show docker0 |grep IP4.ADDRESS | awk '{print $2}'
nmcli d show kube-ipvs0
nmcli d status |grep kube |wc -l
# NM_CONTROLLED=no
sudo nmcli -g all c show --active
sudo nmcli --fields NAME,UUID -t c show --active
sudo nmcli -m tabular  -f NAME,UUID,TYPE c show --active
sudo nmcli -m tabular  -f NAME,UUID,TYPE,AUTOCONNECT -t c show --active
#Error: invalid field 'id'; allowed fields: NAME,UUID,TYPE,TIMESTAMP,TIMESTAMP-REAL,AUTOCONNECT,AUTOCONNECT-PRIORITY,READONLY,DBUS-PATH,ACTIVE,DEVICE,STATE,ACTIVE-PATH,SLAVE.
# 配置文件
# vi /etc/NetworkManager/NetworkManager.conf
hostnamectl status
ifconfig

参考