nmcli

来源:互联网 发布:上海婚纱摄影推荐知乎 编辑:程序博客网 时间:2024/05/16 18:26

Part 1: nmcli查看网络信息

[root@server ~]nmcli con show[root@server ~]nmcli con show --active

这里写图片描述

[root@server ~]nmcli con show "eno16777736"

[root@server ~]# nmcli con show eno16777736
connection.id: eno16777736
connection.uuid: e51e8116-c7f0-4007-81e6-d433b005b122
connection.interface-name: –
connection.type: 802-3-ethernet
connection.autoconnect: yes
connection.timestamp: 1461337868
connection.read-only: no
connection.permissions:
connection.zone: –
connection.master: –
connection.slave-type: –
connection.secondaries:
connection.gateway-ping-timeout: 0
802-3-ethernet.port: –
802-3-ethernet.speed: 0
802-3-ethernet.duplex: –
802-3-ethernet.auto-negotiate: yes
802-3-ethernet.mac-address: 00:0C:29:07:59:08
802-3-ethernet.cloned-mac-address: –
802-3-ethernet.mac-address-blacklist:
802-3-ethernet.mtu: auto
802-3-ethernet.s390-subchannels:
802-3-ethernet.s390-nettype: –
802-3-ethernet.s390-options:
ipv4.method: manual
ipv4.dns: 192.168.124.2
ipv4.dns-search:
ipv4.addresses: { ip = 192.168.124.80/24, gw = 192.168.124.2 }
ipv4.routes: { dst = 192.168.124.2/24, nh = 192.168.124.2, mt = 0 }
……

[root@server ~]nmcli dev status[root@server ~]nmcli dev show eno16777736

这里写图片描述

Part 2 : nmcli配置网络连接
为现有连接添加一个额外ip

[root@server ~]nmcli connection modify eno16777736 +ipv4.addresses 192.168.124.82/24[root@server ~]nmcli connection show eno16777736 |grep ipv4

这里写图片描述

定义一个名为exam-con的新连接,给予ip地址,网关和dns,使用静态ip

[root@server ~]nmcli connection add con-name exam-con ifname eno16777736 type ethernet ip4 10.0.8.11/24 gw4 10.0.8.254[root@server ~]nmcli connection modify exam-con ipv4.dns 10.0.8.253

检查结果
这里写图片描述
禁止自动启动

[root@server ~]# nmcli connection modify exam-con connection.autoconnect no[root@server ~]# nmcli connection modify eno16777736 connection.autoconnect yes

检查结果
这里写图片描述

0 0
原创粉丝点击