新装系统ping百度显示未知服务问题解决办法

[root@backup ~]# ping www.baidu.com

ping: www.baidu.com: Name or service not known 显示ping百度是个未知的服务

# yum install tree

Cannot find a valid baseurl for repo: base/7/x86_64 显示无法找到有效的repo

解决排错思路

1.先ping自己网关

# ping 10.0.0.254

PING 10.0.0.254 (10.0.0.254) 56(84) bytes of data.
64 bytes from 10.0.0.254: icmp_seq=1 ttl=128 time=0.393 ms
64 bytes from 10.0.0.254: icmp_seq=2 ttl=128 time=1.04 ms
^C
ping自己网关是显示通的

2.查看自己的网络服务配置

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
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=eth0
UUID=2e9db5b3-5dca-41a1-8fa0-180fa9c43d5b
DEVICE=eth0
ONBOOT=yes
IPADDR=10.0.0.41
PREFIX=24
GATEWAY=10.0.0.254
IPV6_PRIVACY=no
看了下也没问题

3.看下防火墙开没开

 # systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:firewalld(1)
也是关闭状态

4.看下selinux服务关没关

# cat /etc/selinux/config 

新装系统ping百度显示未知服务问题解决办法_第1张图片
也是关闭状态

5.查看 /etc/hosts 配置 (解析名称信息,域名和ip地址解析记录 文件)

# cat /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
没有问题

6.查看 /etc/resolv.conf 配置(域名解析 配置DNS地址 文件)

# cat /etc/resolv.conf

在这里插入图片描述
竟然空空如也 找到问题所在

解决办法

# vi /etc/resolv.conf

添加

# Generated by NetworkManager
nameserver 10.0.0.254

保存退出

7.再ping就通了

# ping www.baidu.com

PING www.a.shifen.com (182.61.200.7) 56(84) bytes of data.
64 bytes from 182.61.200.7 (182.61.200.7): icmp_seq=1 ttl=128 time=17.4 ms
64 bytes from 182.61.200.7 (182.61.200.7): icmp_seq=2 ttl=128 time=13.5 ms
64 bytes from 182.61.200.7 (182.61.200.7): icmp_seq=3 ttl=128 time=36.4 ms

8.尝试是否可用yum

# yum install tree

Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.163.com
* extras: mirror.jdcloud.com
* updates: mirror.jdcloud.com
base                                                                                   | 3.6 kB  00:00:00     
extras                                                                                 | 2.9 kB  00:00:00     
updates                                                                                | 2.9 kB  00:00:00     
^C/2): updates/7/x86_64/primary_db       67% [====================          ] 2.2 MB/s | 6.9 MB  00:00:01 ETA 

Exiting on user cancel

yum可用了

解决了ping和yum的问题

你可能感兴趣的:(问题解决)