Linux——Centos8.2如何重启网卡服务

简介: Linux——Centos8.2如何重启网卡服务

前言

Centos8已经废弃了network.service,请使用nmcli

内容

[root@localhost ~]# nmcli --help
Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }
OPTIONS
  -a, --ask                                ask for missing parameters
  -c, --colors auto|yes|no                 whether to use colors in output
  -e, --escape yes|no                      escape columns separators in values
  -f, --fields <field,...>|all|common      specify fields to output
  -g, --get-values <field,...>|all|common  shortcut for -m tabular -t -f
  -h, --help                               print this help
  -m, --mode tabular|multiline             output mode
  -o, --overview                           overview mode
  -p, --pretty                             pretty output
  -s, --show-secrets                       allow displaying passwords
  -t, --terse                              terse output
  -v, --version                            show program version
  -w, --wait <seconds>                     set timeout waiting for finishing operations
OBJECT
  g[eneral]       NetworkManager's general status and operations
  n[etworking]    overall networking control
  r[adio]         NetworkManager radio switches
  c[onnection]    NetworkManager's connections
  d[evice]        devices managed by NetworkManager
  a[gent]         NetworkManager secret agent or polkit agent
  m[onitor]       monitor NetworkManager changes

命令详解

  1. 使用nmcli重新回载网络配置
nmcli c up ens33
nmcli d reapply ens33
nmcli d connect ens33
  1. 打开网卡
# nmcli c up <网卡>
  1. 查看网卡信息
# nmcli con 
NAME   UUID                                  TYPE      DEVICE 
ens33  36a7b552-ab17-4b2d-afd9-de96c6c935eb  ethernet  ens33
  1. 显示具体的网络接口信息
# nmcli connection show ens33
  1. 显示所有活动连接
# nmcli connection show --active
  1. 删除一个网卡连接
# nmcli connection delete ens33
  1. 给xxx添加一个IP(IPADDR)
# nmcli connection modify ens33 ipv4.addresses 192.168.0.51
  1. 给xxx添加一个子网掩码(NETMASK)
# nmcli connection modify ens33 ipv4.addresses 192.168.0.51/24
  1. IP获取方式设置成手动(BOOTPROTO=static/none)
# nmcli connection modify ens33 ipv4.method manual
  1. 添加一个ipv4
# nmcli connection modify ens33 +ipv4.addresses 192.168.0.51/24
  1. 删除一个ipv4
# nmcli connection modify ens33 -ipv4.addresses 192.168.0.51/24
  1. 添加DNS
# nmcli connection modify ens33 ipv4.dns 114.114.114.114
  1. 删除DNS
# nmcli connection modify ens33 -ipv4.dns 114.114.114.114
  1. 添加一个网关(GATEWAY)
# nmcli connection modify ens33 ipv4.gateway 192.168.0.1
  1. 网关和DNS一起写入
# nmcli connection modify ens33 ipv4.dns 114.114.114.114 ipv4.gateway 192.168.0.1

学无止境,谦卑而行.

目录
相关文章
|
17天前
|
Linux 网络安全 Apache
CentOS 7.2配置Apache服务httpd(上)
CentOS 7.2配置Apache服务httpd(上)
133 1
|
18天前
|
NoSQL Linux Redis
在 centos7 下重启/开启 redis 服务器
本文提供了一种在Centos 7操作系统下如何重启Redis服务器的步骤,包括停止Redis服务、确认停止成功以及重新启动Redis服务。
28 2
在 centos7 下重启/开启 redis 服务器
|
11天前
|
Ubuntu Linux 网络安全
Linux中服务管理问题
【10月更文挑战第4天】
11 2
|
21天前
|
Linux
linux关机重启
linux关机重启 登录注销 shutdown -h now 立刻关机 shutdown -h 1 一分钟后重启 shutdown -r now 重启计算机 halt 关机 reboot 重启计算机 sync 内存数据同步到磁盘
|
19天前
|
Linux
linux关机重启
linux关机重启 登录注销 shutdown -h now 立刻关机 shutdown -h 1 一分钟后重启 shutdown -r now 重启计算机 halt 关机 reboot 重启计算机 sync 内存数据同步到磁盘 linux关机重启 登录注销 shutdown -h now 立刻关机 shutdown -h 1 一分钟后重启 shutdown -r now 重启计算机 halt 关机 reboot 重启计算机 sync 内存数据同步到磁盘
|
17天前
|
Linux PHP Apache
CentOS 7.2配置Apache服务httpd(下)
CentOS 7.2配置Apache服务httpd(下)
44 1
|
20天前
|
Linux
linux关机重启
linux关机重启 登录注销 shutdown -h now 立刻关机 shutdown -h 1 一分钟后重启 shutdown -r now 重启计算机 halt 关机 reboot 重启计算机 sync 内存数据同步到磁盘
|
14天前
|
应用服务中间件 Linux Shell
Linux 配置 Nginx 服务的详细步骤,绝对干货
Linux 配置 Nginx 服务的详细步骤,绝对干货
43 0
|
18天前
|
Linux
linux关机重启
linux关机重启 登录注销 shutdown -h now 立刻关机 shutdown -h 1 一分钟后重启 shutdown -r now 重启计算机 halt 关机 reboot 重启计算机 sync 内存数据同步到磁盘 linux关机重启 登录注销
|
19天前
|
Ubuntu 网络协议 Linux
liunx各大发行版(centos,rocky,ubuntu,国产麒麟kylinos)网卡配置和包管理方面的区别
liunx各大发行版(centos,rocky,ubuntu,国产麒麟kylinos)网卡配置和包管理方面的区别