How to configure the IP and host name of the CentOS7 system

  

CentOS has just been updated to CentOS7 in recent days, so many users do not know how to install and configure CentOS7, especially the host name and IP of CentOS7. The configuration is somewhat different from the previous version. So how does the CentOS7 system perform IP and hostname network configuration?

Tip: Centos7 is no visual interface.

Enter the login screen

Enter the root entry

Enter the root password set above to enter

System login success

Set IP address, gateway DNS

Description: After CentOS 7.0 is installed by default, it does not automatically open the network connection!

cd /etc/sysconfig/network-scripts/#Enter the network configuration file directory

vi ifcfg-eno16777736 #Edit the configuration file, add the following changes

HWADDR=00 :0C:29:8D:24:73

TYPE=Ethernet

BOOTPROTO=static #Enable Static IP Address

DEFROUTE=yes

PEERDNS= Yes

PEERROUTES=yes

IPV4_FAILURE_FATAL=no

IPV6INIT=yes

IPV6_AUTOCONF=yes

IPV6_DEFROUTE=yes

IPV6_PEERDNS=yes

IPV6_PEERROUTES=yes

IPV6_FAILURE_FATAL=no

NAME=eno16777736

UUID=ae0965e7-22b9-45aa-8ec9-3f0a20a85d11< Br>

ONBOOT=yes #Enable automatic network connection enable

IPADDR0=192.168.21.128 #Set IP address

PREFIXO0=24 #Set subnet mask

GATEWAY0=192.168.21.2 #设置网关器

DNS1=8.8.8.8 #设置主DNS

DNS2=8.8.4.4 #设置备DNS

:wq! # 保存退出

service network restart #再网络

ping http://www.xitongzhijia.net/#test whether the network is normal

ip addr #View IP address< Br>

Set the host name to www

hostname www #Set the host name to www

vi /etc/hostname #Edit configuration file

www #修改localhost. Localdomain is www

:wq! #SaveExit

vi /etc/hosts #Edit Configuration File

127.0.0.1 localhost www #Modify localhost.localdomain to www

:wq! #SaveExit

shutdown -r now #restart the system

The above is how the CentOS7 system performs IP and hostname network configuration. After configuring the IP and hostname, you can start surfing the Internet. It is.

Copyright © Windows knowledge All Rights Reserved