标签:method class static system eof net line inux none
1 #!/bin/bash 2 3 set -e 4 hostname="test" 5 ipaddr="192.168.134.10" 6 7 # grub 8 set flag=0 9 grep -e "net.ifnames=0" /etc/default/grub > /dev/null 2>&1 || flag=1 10 if [[ ${flag} -ne 0 ]];then 11 s=`grep GRUB_CMDLINE_LINUX /etc/default/grub` 12 s2="${s%\"*} net.ifnames=0 biosdevname=0\"" 13 sed -i "s/GRUB_CMDLINE_LINUX=.*/${s2}/g" /etc/default/grub 14 grub2-mkconfig -o /boot/grub2/grub.cfg 15 unset s 16 unset s2 17 flag=0 18 fi 19 20 mv /etc/sysconfig/network-scripts/ifcfg-ens32 /etc/sysconfig/network-scripts/ifcfg-ens32.bak || true ; echo "zhangjia*********************" ; sleep 30 21 cat > /etc/sysconfig/network-scripts/ifcfg-eth0 << EOF 22 TYPE="Ethernet" 23 PROXY_METHOD="none" 24 BOOTPROTO="static" 25 NAME="eth0" 26 DEVICE="eth0" 27 ONBOOT="yes" 28 IPADDR="${ipaddr}" 29 GATEWAY="192.168.134.2" 30 NETMASK="255.255.255.0" 31 DNS1="8.8.8.8" 32 EOF 33 34 [[ grep ${hostname} /etc/hostname ]] || echo "${hostname}" >> /etc/hostname 35 systemctl disable NetworkManager && systemctl stop NetworkManager 36 setenforce 0 ; sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config 37 echo "10s after reboot..." && sleep 10 38 reboot
标签:method class static system eof net line inux none
原文地址:https://www.cnblogs.com/zhj5551/p/11198324.html