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

 

参考

centos 开机启动脚本_Zerore的博客-CSDN博客_centos 开机启动脚本

如何解决centos下设备eth0不存在-木庄网络博客 

posted @ 2022-07-05 13:39  quanzhan  阅读(325)  评论(0编辑  收藏  举报