centos网络配置文件模板
vi /etc/sysconfig/network-scripts/ifcfg-exxxx
BOOTPROTO=static
DEVICE=eno16777736
ONBOOT=yes
IPADDR=192.168.26.10
GATEWAY=192.168.26.2
DNS=8.8.8.8
能ping通ip却不能ping通域名
1.编辑配置文件
vi /etc/resolv.conf
2.写入下列地址,保存退出,reboot重启
nameserver 8.8.8.8
nameserver 8.8.4.4
配置yum
1.备份原文件
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.下载并设置阿里yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
如果没有wget尝试
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
3.清理和生成缓存
yum clean all
yum makecache
4.重启网卡
systemctl restart network
备用
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
红帽7
vi CentOS-Base.repo
%s/$releasever/7/g