默认网卡eth0 修改为eth1后台操作步骤:
默认网卡eth0改为eth1:
echo "" > /etc/rc.local
sed -i 's/eth0/eth1/' /etc/udev/rules.d/50-persistent-net.rules
net_conf=`ls /etc/sysconfig/network-scripts/ifcfg-* | grep -v lo | tr -d ' '`
mv ${net_conf} /etc/sysconfig/network-scripts/ifcfg-eth1
sed -i 's/NAME=.*/NAME=eth1/' /etc/sysconfig/network-scripts/ifcfg-eth1
sed -i 's/DEVICE=.*/DEVICE=eth1/' /etc/sysconfig/network-scripts/ifcfg-eth1
echo "" > /etc/sysconfig/network
grub2-mkconfig -o /boot/efi/EFI/euleros/grub.cfg
grub2-mkconfig -o /boot/grub2/grub.cfg
默认网卡eth1改为eth0:
echo "" > /etc/rc.local
sed -i 's/eth1/eth0/' /etc/udev/rules.d/50-persistent-net.rules
net_conf=`ls /etc/sysconfig/network-scripts/ifcfg-* | grep -v lo | tr -d ' '`
mv ${net_conf} /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/NAME=.*/NAME=eth0/' /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i 's/DEVICE=.*/DEVICE=eth0/' /etc/sysconfig/network-scripts/ifcfg-eth0
echo "" > /etc/sysconfig/network
grub2-mkconfig -o /boot/efi/EFI/euleros/grub.cfg
grub2-mkconfig -o /boot/grub2/grub.cfg