天天看點

在CENTOS7/RHEL7修改網卡名稱

1、禁用可預測命名規則

# vim /etc/default/grub

添加兩句: net.ifnames=0 biosdevname=0

GRUB_TIMEOUT=5

GRUB_DEFAULT=saved

GRUB_DISABLE_SUBMENU=true

GRUB_TERMINAL_OUTPUT="console"

GRUB_CMDLINE_LINUX="rd.lvm.lv=centos/root rd.lvm.lv=centos/swap net.ifnames=0 biosdevname=0 rhgb quiet"

GRUB_DISABLE_RECOVERY="true"

# grub2-mkconfig -o /boot/grub2/grub.cfg

Generating grub configuration file ...

Found linux image: /boot/vmlinuz-3.10.0-229.el7.x86_64

Found initrd image: /boot/initramfs-3.10.0-229.el7.x86_64.img

Found linux image: /boot/vmlinuz-0-rescue-a8ecfd39a4014521ae54ccef4ada1c67

Found initrd image: /boot/initramfs-0-rescue-a8ecfd39a4014521ae54ccef4ada1c67.img

done

2、修改網卡配置檔案

# cd /etc/sysconfig/network-scripts/

# mv ifcfg-enoxxxxxx ifcfg-eth0

3、修改裝置對應名稱

# vim /etc/udev/rules.d/70-persistent-ipoib.rules

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:0c:29:e0:17:54", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

4、重新開機系統即可

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

yum clean all

yum makecache

systemctl   動作   服務名.service

yum -y install   net-tools

CentOS 7.0預設使用的是firewall作為防火牆,這裡改為iptables防火牆。

firewall:

systemctl start firewalld.service#啟動firewall

systemctl stop firewalld.service#停止firewall

systemctl disable firewalld.service#禁止firewall開機啟動

本文轉自 295631788 51CTO部落格,原文連結:http://blog.51cto.com/hequan/1768380,如需轉載請自行聯系原作者

繼續閱讀