Network_config.sh

#!/bin/bash 

service iptables stop
chkconfig iptables off

sed -i ‘/SELINUX=enforcing/s/^/#/‘ /etc/selinux/config
sed -i ‘/#SELINUX=enforcing/a SELinux=disabled‘ /etc/selinux/config 

cp /etc/sysconfig/network /etc/sysconfig/network.bak
rm /etc/sysconfig/network
cat >> /etc/sysconfig/network << "EOF"
NETWORKING=yes
HOSTNAME=oracle11g.local
#开启NTP客户端时启用
#NTPSERVERARGS=iburst
GATEWAY=192.168.1.1
EOF

echo "192.168.1.128 oracle11g oracle11g.local" >> /etc/hosts 

cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0.bak
rm  /etc/sysconfig/network-scripts/ifcfg-eth0
sed -n ‘/HWADDR=/p‘ /etc/sysconfig/network-scripts/ifcfg-eth0.bak >> /etc/sysconfig/network-scripts/ifcfg-eth0
sed -n ‘/UUID=/p‘ /etc/sysconfig/network-scripts/ifcfg-eth0.bak >> /etc/sysconfig/network-scripts/ifcfg-eth0

cat >> /etc/sysconfig/network-scripts/ifcfg-eth0 << "EOF"
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.1.128
PREFIX=24
GATEWAY=192.168.1.1
DNS1=192.168.1.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
EOF

sed -i ‘/Red Hat Enterprise Linux Server release 6.5 (Santiago)/s/^/#/‘ /etc/redhat-release
sed -i ‘a Red Hat Enterprise Linux Server release 5.0 (Tikanga)‘ /etc/redhat-release



郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。