1. host文件相关
  • hosts文件在/etc/hosts
  • 修改完成后如何生效
    1. 安装nscd
      1
      apt install nscd
    2. 清除DNS数据
      1
      /etc/init.d/nscd restart
    3. 若无效,则清除DNS缓存
      1
      /etc/init.d/networking restart
  1. 安装CentOS后访问网络报错”network is unreachable”
  • 编辑**/etc/sysconfig/network-scripts文件夹下的ifcfg-enxxx**文件
  • 将ONBOOT属性改为yes
  • 重启网络
    1
    service network restart