标签:装机 yum ip
适用于centos7
[root@node7_1 ~]# cat yum_ip.sh
#!/bin/bash
# is used to centos 7
mv /etc/sysconfig/network-scripts/ifcfg-eno16777728{,.bak}
cat > /etc/sysconfig/network-scripts/ifcfg-eno16777728 << eof
TYPE=Ethernet
BOOTPROTO=none
NM_CONTROLLED=no
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
IPV6_AUTOCONF=no
IPV6_DEFROUTE=no
IPV6_PEERDNS=no
IPV6_PEERROUTES=no
IPV6_FAILURE_FATAL=no
NAME=eno16777728
UUID=76f9cf7b-5390-44da-af35-16fdf334f81f
DEVICE=eno16777728
ONBOOT=yes
IPADDR=192.168.1.200
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS=202.106.0.20
eof
cat > /etc/resolv.conf << eof
nameserver 202.106.0.20
eof
for i in `ls /etc/yum.repos.d/`
do
mv /etc/yum.repos.d/$i{,.bak}
done
cat > /etc/yum.repos.d/aliyun.repo << eof
[aliyun]
name=ali
baseurl=http://mirrors.aliyun.com/centos/7/os/x86_64/
gpgcheck=0
enabled=1
[epel]
name=epel
baseurl=http://mirrors.aliyun.com/epel/7/x86_64/
gpgcheck=0
enabled=1
eof
/etc/init.d/network restart
本文出自 “Linux” 博客,请务必保留此出处http://ridingonhorse.blog.51cto.com/11265295/1872812
标签:装机 yum ip
原文地址:http://ridingonhorse.blog.51cto.com/11265295/1872812