欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

主机无法连接,ping不通

程序员文章站 2022-05-10 11:04:31
...

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

  [aaa@qq.com ~]# 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文件
主机无法连接,ping不通

[aaa@qq.com ~]#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 “默认网关”

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

[aaa@qq.com ~]#service iptables stop

[aaa@qq.com ~]#service network restart

检查是否成功

[aaa@qq.com ~]#ping baidu.com