码迷,mamicode.com
首页 > Web开发 > 详细

Network_config.sh

时间:2014-09-04 22:25:50      阅读:274      评论:0      收藏:0      [点我收藏+]

标签:os   ar   for   sp   on   c   linux   ad   ef   

#!/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



Network_config.sh

标签:os   ar   for   sp   on   c   linux   ad   ef   

原文地址:http://my.oschina.net/javaite/blog/310303

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!