Centos7修改網(wǎng)卡名字

1.第一步

cd /etc/sysconfig/network-scripts/ 
    mv ifcfg-ens33 ifcfg-eth0 
    mv ifcfg-ens34 ifcfg-eth1

2.修改網(wǎng)卡內(nèi)容

cat > ifcfg-eth0<<END 
    TYPE=Ethernet
    BOOTPROTO=none
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    NAME=eth0
    DEVICE=eth0
    ONBOOT=yes
    IPADDR=10.0.0.201
    PREFIX=24
    GATEWAY=10.0.0.254
    DNS1=223.5.5.5
    DNS2=223.6.6.6
    END
    [root@CentOS7 network-scripts]#
 cat  >ifcfg-eth1<<END
    TYPE=Ethernet
    BOOTPROTO=none
    DEFROUTE=yes
    IPV4_FAILURE_FATAL=no
    NAME=eth1
    DEVICE=eth1
    ONBOOT=yes
    IPADDR=172.16.1.200
    PREFIX=24
    END
    [root@CentOS7 network-scripts]#

3.修改并生成grub配置

[root@CentOS7 network-scripts]# vim   /etc/sysconfig/grub
    GRUB_TIMEOUT=5
    GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
    GRUB_DEFAULT=saved
    GRUB_DISABLE_SUBMENU=true
    GRUB_TERMINAL_OUTPUT="console"
    GRUB_CMDLINE_LINUX="rhgb net.ifnames=0 biosdevname=0 quiet"
    GRUB_DISABLE_RECOVERY="true"
    [root@CentOS7 network-scripts]#

4. 生成grub啟動(dòng)菜單

[root@CentOS7 network-scripts]# grub2-mkconfig -o /boot/grub2/grub.cfg
    Generating grub configuration file ...
    Found linux image: /boot/vmlinuz-3.10.0-327.el7.x86_64
    Found initrd image: /boot/initramfs-3.10.0-327.el7.x86_64.img
    Found linux image: /boot/vmlinuz-0-rescue-4860b79d6cd240788b962a1dbdef488d
    Found initrd image: /boot/initramfs-0-rescue-4860b79d6cd240788b962a1dbdef488d.img
    done
    [root@CentOS7 network-scripts]#

5.安裝ifconfig

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum install wget net-tools vim   bash-completion   lrzsz nmap nc tree -y
systemctl stop firewalld.service
systemctl disable firewalld.service
sed -i.ori 's#SELINUX=enforcing#SELINUX=disabled#' /etc/selinux/config

6.重啟系統(tǒng)

reboot
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。