标签:nat emc ddr tab save 配置 虚拟网络 pos class
##初始化网络(可在虚拟网络编辑器查看自己的网段) ##方法一:静态初始化 read -p "输入你当前Linux的IP地址:" ip ETH=` ifconfig -a | head -1 | awk -F ":" ‘{print $1}‘` GATE="`echo $ip | awk -F "." ‘{print $1"."$2"."$3"."}‘`.2" cat > /etc/sysconfig/network-scripts/ifcfg-$ETH <<EOF TYPE=Ethernet BOOTPROTO=static NAME=$ETH DEVICE=$ETH IPADDR="$ip" GATEWAY=$GATE ONBOOT=yes DNS1=8.8.8.8 EOF ##方法2:dhcp分配 cat > /etc/sysconfig/network-scripts/ifcfg-$ETH <<EOFTYPE=Ethernet BOOTPROTO=dhcp NAME=$ETH DEVICE=$ETH ONBOOT=yes EOF
##(RHEL6) cat > /etc/sysconfig/network <<EOF NETWORKING=yes HOSTNAME=server-123 EOF ##(RHEL7) hostnamectl --static set-hostname server-123
##关闭防火墙(RHEL6) iptables -t filter -F iptables -t nat -F service iptables save service iptables stop chkconfig iptables off chkconfig ip6tables off chkconfig ip6tables off ##关闭防火墙(RHEL7) iptables -t filter -F iptables -t nat -F systemctl save iptables systemctl stop iptables systemctl disabled iptables sed -ir ‘/SELINUX/{s/enforcing/disabled/}‘ /etc/selinux/config
##将sr0永久性挂载 mkdir /iso chmod u+x /etc/rc.d/rc.local echo "mount /dev/sr0 /iso" >> /etc/rc.d/rc.local ##配置yum源 touch /etc/yum.repos.d/base.repo cat > /etc/yum.repos.d/base.repo << EOF [base] name=mybase baseurl=file:///iso/ enabled=1 gpgcheck=0 EOF
init 6
总结:将适用于自己RHEL/CENTOS (6,7)版本的脚本代码复制执行即可
标签:nat emc ddr tab save 配置 虚拟网络 pos class
原文地址:https://www.cnblogs.com/1312862978Hg/p/9692444.html