centos8如何重启网卡
2021/7/29 7:07:08
本文主要是介绍centos8如何重启网卡,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1、查看系统
[root@centos8pc2 network-scripts]# hostnamectl Static hostname: centos8pc2 Icon name: computer-vm Chassis: vm Machine ID: f021cde3a91b4a2688dbedfe0884e052 Boot ID: ffbe1ee973aa4d44a7b8b9d1a58683f1 Virtualization: vmware Operating System: CentOS Linux 8 CPE OS Name: cpe:/o:centos:centos:8 Kernel: Linux 4.18.0-240.el8.x86_64 Architecture: x86-64
2、修该网卡配置文件
[root@centos8pc2 network-scripts]# vim /etc/sysconfig/network-scripts/ifcfg-ens160 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static DEFROUTE=yes IPV4_FAILURE_FATAL=no IPV6INIT=yes IPV6_AUTOCONF=yes IPV6_DEFROUTE=yes IPV6_FAILURE_FATAL=no IPV6_ADDR_GEN_MODE=stable-privacy NAME=ens160 UUID=77656063-2595-411d-8b36-49caab425c3e DEVICE=ens160 ONBOOT=yes IPADDR=192.168.3.10 NETMASK=255.255.255.0 GATEWAY=192.168.3.1 DNS1=119.29.29.29
3、重启网卡
[root@centos8pc2 network-scripts]# ifconfig | head -n 3 ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.3.91 netmask 255.255.255.0 broadcast 192.168.3.255 inet6 fe80::c0fe:36f:3a46:9188 prefixlen 64 scopeid 0x20<link> [root@centos8pc2 network-scripts]# systemctl restart network Failed to restart network.service: Unit network.service not found. [root@centos8pc2 network-scripts]# nmcli c reload [root@centos8pc2 network-scripts]# ifconfig | head -n 3 ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.3.91 netmask 255.255.255.0 broadcast 192.168.3.255 inet6 fe80::c0fe:36f:3a46:9188 prefixlen 64 scopeid 0x20<link> [root@centos8pc2 network-scripts]# nmcli c up ens160 Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4) [root@centos8pc2 network-scripts]# ifconfig | head -n 3 ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255 inet6 fe80::c0fe:36f:3a46:9188 prefixlen 64 scopeid 0x20<link> [root@centos8pc2 network-scripts]# cat /proc/version Linux version 4.18.0-240.el8.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Fri Sep 25 19:48:47 UTC 2020
这篇关于centos8如何重启网卡的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-23DevExpress 怎么实现右键菜单(Context Menu)显示中文?-icode9专业技术文章分享
- 2024-12-22怎么通过控制台去看我的页面渲染的内容在哪个文件中呢-icode9专业技术文章分享
- 2024-12-22el-tabs 组件只被引用了一次,但有时会渲染两次是什么原因?-icode9专业技术文章分享
- 2024-12-22wordpress有哪些好的安全插件?-icode9专业技术文章分享
- 2024-12-22wordpress如何查看系统有哪些cron任务?-icode9专业技术文章分享
- 2024-12-21Svg Sprite Icon教程:轻松入门与应用指南
- 2024-12-20Excel数据导出实战:新手必学的简单教程
- 2024-12-20RBAC的权限实战:新手入门教程
- 2024-12-20Svg Sprite Icon实战:从入门到上手的全面指南
- 2024-12-20LCD1602显示模块详解