码迷,mamicode.com
首页 > 其他好文 > 详细

nmcli几个常用命令

时间:2020-02-16 16:32:31      阅读:107      评论:0      收藏:0      [点我收藏+]

标签:连接   常用命令   device   top   加载   dff   connect   path   idg   

1.nmcli connection 用于查看连接

2.nmcli device用于查看当前网络设备

3.nmcli connection modify用于修改当前连接配置

4.nmcli connection reload 重新加载连接配置

 

简单示例如下:

[root@localhost /]# nmcli connection
NAME    UUID                                  TYPE      DEVICE
eno1    6b06dff7-65a3-4ca7-bfc7-c3bf1af8d52f  ethernet  eno1   
virbr0  1486fe12-2531-42a1-a413-ecba62d34a84  bridge    virbr0
eno1    2df29981-3b89-4862-9b23-652e7b5027b7  ethernet  --     
[root@localhost /]# nmcli connection show
NAME    UUID                                  TYPE      DEVICE
eno1    6b06dff7-65a3-4ca7-bfc7-c3bf1af8d52f  ethernet  eno1   
virbr0  1486fe12-2531-42a1-a413-ecba62d34a84  bridge    virbr0
eno1    2df29981-3b89-4862-9b23-652e7b5027b7  ethernet  --     
[root@localhost /]# nmcli connection show eno1
connection.id:                          eno1
connection.uuid:                        6b06dff7-65a3-4ca7-bfc7-c3bf1af8d52f
........................
ipv4.method:                            manual
ipv4.dns:                               192.168.1.1
ipv4.dns-search:                        --
ipv4.dns-options:                       ""
ipv4.dns-priority:                      0
ipv4.addresses:                         192.168.1.2/24
ipv4.gateway:                           192.168.1.1
ipv4.routes:                            --
ipv4.route-metric:                      -1
ipv4.route-table:                       0 (unspec)
[root@localhost /]# nmcli connection show -active
NAME    UUID                                  TYPE      DEVICE
eno1    6b06dff7-65a3-4ca7-bfc7-c3bf1af8d52f  ethernet  eno1   
virbr0  1486fe12-2531-42a1-a413-ecba62d34a84  bridge    virbr0
[root@localhost /]# nmcli connection show eno1
connection.id:                          eno1
connection.uuid:                        6b06dff7-65a3-4ca7-bfc7-c3bf1af8d52f
................
ipv4.method:                            manual
ipv4.dns:                               192.168.1.1
ipv4.dns-search:                        --
ipv4.dns-options:                       ""
ipv4.dns-priority:                      0
ipv4.addresses:                         192.168.1.2/24
ipv4.gateway:                           192.168.1.1

[root@localhost /]# nmcli device
DEVICE      TYPE      STATE      CONNECTION
eno1        ethernet  connected  eno1       
virbr0      bridge    connected  virbr0     
lo          loopback  unmanaged  --         
virbr0-nic  tun       unmanaged  --         
[root@localhost /]# nmcli device show
GENERAL.DEVICE:                         eno1
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         90:B1:1C:8F:4C:33
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     eno1
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveC>
WIRED-PROPERTIES.CARRIER:               on
IP4.ADDRESS:                             192.168.1.2/24
IP4.GATEWAY:                            192.168.1.1
IP4.ROUTE:                               dst = 192.168.1.0/24, nh = 0.0.0.0, mt >
IP4.DNS:                                 192.168.1.1
[root@localhost /]# nmcli device show eno1
GENERAL.DEVICE:                         eno1
GENERAL.TYPE:                           ethernet
GENERAL.HWADDR:                         90:B1:1C:8F:4C:33
GENERAL.MTU:                            1500
GENERAL.STATE:                          100 (connected)
GENERAL.CONNECTION:                     eno1
GENERAL.CON-PATH:                       /org/freedesktop/NetworkManager/ActiveC>
WIRED-PROPERTIES.CARRIER:               on
IP4.ADDRESS:                             192.168.1.2/24
IP4.GATEWAY:                            192.168.1.1
IP4.ROUTE:                               dst = 192.168.1.0/24, nh = 0.0.0.0, mt >
IP4.DNS:                                 192.168.1.1


[root@localhost /]# nmcli connection modify eno1 ipv4.method manual ipv4.addresses 192.168.1.2/24 ipv4.gateway 192.168.1.1 ipv4.dns 192.168.1.1



[root@localhost /]# nmcli connection reload



nmcli几个常用命令

标签:连接   常用命令   device   top   加载   dff   connect   path   idg   

原文地址:https://www.cnblogs.com/cloudapecs/p/12317150.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!