zoukankan      html  css  js  c++  java
  • 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、修该网卡配置文件(自定义一个ip地址,然后重启网卡使其生效)

    [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
  • 相关阅读:
    SmartJS 第一期(0.1)发布
    smartJS 0.1 API 讲解
    smartJS 0.1 API 讲解
    20160113006 asp.net实现ftp上传代码(解决大文件上传问题)
    20151224001 GridView 多按钮的各种使用方法
    20151221001 GridView 模板
    20151218001 雕爷自白:我为什么非要这么干
    20151210001 DataGridView 选中与被选中
    20151126001 网页中嵌入谷歌动态地图
    20151125001 询问对话框 中的文字换行
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/15072276.html
Copyright © 2011-2022 走看看