CentOS6每次开机都要ifup eth0
方法一 :
vim /etc/sysconfig/network-scripts/ifcfg-eth0
把里面的 ONBOOT 设为 yes
(测试无效)
方法二:
echo ifup eth0 >> /etc/rc.local
备注
# Network configurations
touch /etc/sysconfig/network-scripts/ifcfg-eth0
echo DEVICE="eth0" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo BOOTPROTO="static" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo DNS1=192.168.0.1 >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo GATEWAY=192.168.0.1 >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo IPADDR=192.168.0.180 >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo IPV6INIT="no" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo NETMASK="255.255.255.0" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo ONBOOT="yes" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo TYPE="Ethernet" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo DEFROUTE=yes >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo PREFIX=16 >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo ifup eth0 >> /etc/rc.local
# network driver installation
cp /mnt/tele/OneKey/e1000e-3.4.0.2.tar.gz /opt/ins
tar -xvf /opt/ins/e1000e-3.4.0.2.tar.gz -C /opt/ins
cd /opt/ins/e1000e-3.4.0.2/src
make clean
make install
modprobe e1000e
rm -rf /opt/ins
参考