CentOS7 Modify the NIC name to eth0 and some basic settings

Source: Internet
Author: User

Environment Description: CentOS7 minimum installation, all configurations default
After the installation is complete, set a temporary IP address for easy SSH connection configuration

View Server Interfaces

IP link

See if you have an IP address

IP addr

Set interface up

IP link Set eno16777728 up

Set up a temporary IP

IP addr Add 10.10.10.71/24 dev eno16777728

Add a Gateway

IP route add default via 10.10.10.2 Dev eno16777728

Add DNS

vi/etc/resolv.conf nameserver 119.29.29.29

I. Setting the time zone and time
1. Viewing time settings

timedatectl      local time: sat 2016-07-02 12:44:43  edt        #服务器时间   universal time: sat 2016-07-02  16:44:43 UTC        #标准时间 (timezone 0 time)          RTC time: Sat 2016-07-02 16:44:43             #硬件时间        time zone: america/new_ york  (edt, -0400)       #时区      ntp enabled:  n/aNTP synchronized: no RTC in local TZ: no       DST active: yes Last DST change: DST began at                   Sun  2016-03-13 01:59:59 est                   sun 2016-03-13 03:00:00 edt next dst change: dst ends  (the  Clock jumps one hour backwards)  at                   Sun 2016-11-06 01:59:59 EDT                   sun  2016-11-06 01:00:00 est

2. Set the time zone
View the time zone you can set

Timedatectl List-timezones | grep Asia

Set the time zone to Shanghai

Timedatectl Set-timezone Asia/shanghai

3. Synchronize the network time and write the time to the BIOS

Yum Install ntpdate-yntpdate 0.asia.pool.ntp.orgtimedatectl SET-LOCAL-RTC 1 #将硬件时钟调整为与本地时钟一致 (change BIOS time to and system time)

4. Verify that the time is correct

Timedatectl Local time:sat 2016-07-02 16:05:24 CST Universal time:sat 2016-07-02 08:05:24 UTC RTC Time:sa T 2016-07-02 16:05:24 time Zone:asia/shanghai (CST, +0800) NTP enabled:n/antp synchronized:no RTC in local TZ : Yes DST active:n/a

Two. Close Selinux,firewalld and NetworkManager

Vi/etc/selinux/config

Modify Selinux=enforcing to Selinux=disabled

Or

Sed-i ' s/selinux=.*/selinux=disabled/'/etc/selinux/config

Shutting down and stopping the firewall

Systemctl Stop Firewalldsystemctl Disable FIREWALLD

Close and stop NetworkManager

Systemctl Stop Networkmanagersystemctl Disable NetworkManager

Three. Modify the computer name

Hostnamectl Set-hostname Localhost.localdomain

Or

Vi/etc/hostnamelocalhost.localdomain

Four. Modify the NIC interface name
1. Modify grub, edit/etc/default/grub and add "net.ifnames=0" to grub_cmdline_linux variable

Vi/etc/default/grub grub_timeout=5grub_distributor= "$ (SED ' s, release. *$,,g '/etc/system-release)" grub_default= savedgrub_disable_submenu=truegrub_terminal_output= "Console" grub_cmdline_linux= "Rd.lvm.lv=centos/root rd.lvm.lv =centos/swap net.ifnames=0 rhgb quiet "grub_disable_recovery=" true "Grub2-mkconfig-o/boot/grub2/grub.cfg

2. Manually Generate 70-persistent-net.rules
View the MAC address of the interface

IP link show1:lo: <LOOPBACK,UP,LOWER_UP> MTU 65536 qdisc noqueue State UNKNOWN mode DEFAULT link/loopback 00:00 : 00:00:00:00 BRD 00:00:00:00:00:002:eno16777728: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU Qdisc Pfifo_fast State up mode DEFAULT qlen link/ether 00:0c:29:28:ac:54 BRD ff:ff:ff:ff:ff:ff

The MAC address is 00:0c:29:28:ac:54, and the MAC address is populated in the file 70-persistent-net.rules

vi/etc/udev/rules.d/70-persistent-net.rulessubsystem== "NET", action== "Add", drivers== "? *", attr{address}== "00:0c : 29:28:ac:54 ", attr{type}==" 1 ", kernel==" eth* ", name=" eth0 "

3. Modify the NIC configuration file

vi/etc/sysconfig/network-scripts/ifcfg-eth0device=eth0type=ethernetonboot=yesnm_controlled=nobootproto= noneipaddr=10.10.10.71prefix=24gateway=10.10.10.2mv/etc/sysconfig/network-scripts/ifcfg-eno16777728/etc/ Sysconfig/network-scripts/ifcfg-eno16777728.bak

4. Restart the server

Reboot

Five. Install Vim and network management components ifconfig, etc.

Yum Install Net-tools bash-completion vim-yifconfigroute


Setup Complete






This article is from the "Progress a little every day" blog, be sure to keep this source http://1step.blog.51cto.com/1160799/1795157

CentOS7 Modify the NIC name to eth0 and some basic settings

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.