centos系列报错

centos系列报错

一、网络问题

1、报错:ping: www.baidu.com: Name or service not known(centos8)

(1)查看网卡配置:

  • [root@CentOS8Shaowenhua network-scripts]# cat /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
    NAME=ens160
    UUID=db82a9d9-b72a-40a0-9a43-badbf4d17834
    DEVICE=ens160
    ONBOOT=yes
    IPADDR=192.168.27.128
    NETMASK=255.255.255.0
    GATEWAY=192.168.27.2
    DNS1=192.168.27.128
    DNS2=8.8.8.8
    DNS3=114.114.114.114
  • 添加域名解析:DNS3=114.114.114.114

(2)vi /etc/resolv.conf

  • Generated by NetworkManager

    nameserver 192.168.27.128
    nameserver 8.8.8.8
    nameserver 114.114.114.114

    (3)重启网卡:

    nmcli networking off

    nmcli networking on

    nmcli c reload

    image-20240421183022238

    (4)ping 连通性测试

    • [root@CentOS8Shaowenhua network-scripts]# ping -c 3 www.baidu.com
      PING www.a.shifen.com (220.181.38.149) 56(84) bytes of data.
      64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=1 ttl=128 time=57.1 ms
      64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=2 ttl=128 time=47.3 ms
      64 bytes from 220.181.38.149 (220.181.38.149): icmp_seq=3 ttl=128 time=47.5 ms

      --- www.a.shifen.com ping statistics ---
      3 packets transmitted, 3 received, 0% packet loss, time 4067ms
      rtt min/avg/max/mdev = 47.264/50.624/57.067/4.564 ms
      [root@CentOS8Shaowenhua network-scripts]#

2、使用nmcli命令生成配置文件

/etc/sysconfig/network-scripts/目录下

使用nmcli con add con-name ens36 type ethernet ifname ens36命令

posted @ 2024-04-21 18:56  朝暮青丝  阅读(74)  评论(0)    收藏  举报