主机无法连接,ping不通

安装软件包时,无法获得主机连接。

  [root@tandelin ~]# yum packages
    Warning: failed to download mirrors file (cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv'); using local file '/usr/share/doc/R-3.5.1/CRAN_mirrors.csv'
    Warning: unable to access index for repository https://mirror.lzu.edu.cn/CRAN/src/contrib:
      cannot open URL 'https://mirror.lzu.edu.cn/CRAN/src/contrib/PACKAGES'
    Warning messages:
    1: In download.file(url, destfile = f, quiet = TRUE) :
      URL 'https://cran.r-project.org/CRAN_mirrors.csv': status was 'Couldn't resolve host name'
    2: packages ‘rJava’, ‘Rcpp’, ‘RJSONIO’, ‘bitops’, ‘digest’, ‘functional’, ‘stringr’, ‘plyr’, ‘reshape2’, ‘dplyr’, ‘R.methodsS3’, ‘caTools’, ‘Hmisc’ are not available (for R version 3.5.1) 

需要添加一个nameserver 和网关,在windows下查找,获得网关信息。编辑vi /etc/resolv.conf文件
在这里插入图片描述

[root@tandelin ~]#vi /etc/resolv.conf
# Generated by NetworkManager
# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xx
# DOMAIN=“ww.com”
search “DNS后缀”
nameserver  “默认网关”
nameserver “默认网关”

配置好网关后,需要关闭防火墙,重启网络服务

[root@tandelin ~]#service iptables stop

[root@tandelin ~]#service network restart

检查是否成功

[root@tandelin ~]#ping baidu.com

猜你喜欢

转载自blog.csdn.net/tandelin/article/details/87634779
今日推荐