Centos7 change the default Nic to eth

Source: Internet
Author: User

Centos7 change the default Nic to eth

1. Change the default Nic to eth0.

Vi/etc/sysconfig/network-scripts/ifcfg-eno16777736

# First, edit the NIC configuration file and change the NAME to eth0.

Mv/etc/sysconfig/network-scripts/ifcfg-eno16777736/etc/sysconfig/network-scripts/ifcfg-eth0

# Then, rename the file

2. Edit Grub Configuration

Vim/etc/default/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 = "crashkernel = autord. lvm. lv = centos/rootrd. lvm. lv = centos/swapnet. ifnames = 0 biosdevname = 0 rhgbquiet"

GRUB_DISABLE_RECOVERY = "true"

# Disable this predictable naming rule. At startup, pass the Kernel Parameter "net. ifnames = 0 biosdevname = 0. Edit/etc/default/grub and add "net. ifnames = 0 biosdevname = 0" to the grubw.linelinux variable.

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

# Regenerate GRUB configuration and update Kernel Parameters

3. Set device name rules

Vim/etc/udev/rules. d/70-persistent-net.rules

SUBSYSTEM = "net", ACTION = "add", DRIVERS = "? * ", ATTR {address} =" 00: 0c: 29: 84: 3a: 14 ", ATTR {type} =" 1 ", KERNEL = "eth *", NAME = "eth0"

# According to the FAQ in the Centos official WIKI, if you have multiple interfaces and want to control their device names, instead of naming and creating the kernel in its own way, /etc/udev/rules. d/XXX-net.rules rules are necessary

# After restart

[Root @ localhost ~] # Ip
1: lo: <LOOPBACK, UP, LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
Link/loopback 00: 00: 00: 00: 00: 00 brd 00: 00: 00: 00: 00: 00
Inet 127.0.0.1/8 scope host lo
Valid_lft forever preferred_lft forever
Inet6: 1/128 scope host
Valid_lft forever preferred_lft forever
2: eth0: <BROADCAST, MULTICAST, UP, LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
Link/ether 00: 0c: 29: 5b: 71: b3 brd ff: ff
Inet 192.168.1.205/24 brd 192.168.1.255 scope global eth0
Valid_lft forever preferred_lft forever
Inet6 fe80: 20c: 29ff: fe5b: 71b3/64 scope link

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.