Centos7 networking configuration tutorial after installation, centos7 tutorial
Generally, after centos is installed (on a virtual machine), you need to configure the service by yourself. Next I will explain how to configure
Networking Procedure
First, open the two services of the virtual machine,Right click my computer> Manage> Find service> StartTwo services:
Then configure the configuration file under centos.
The procedure is as follows:
Open the terminal and enterSudo-I,Enter PasswordEnter ls/etc/sysconfig/network-scripts/In administrator mode/
Show the relevant configuration file and find the ifcfg-ensxxx file. You may not be the same as mine. Remember or copy the file and use it multiple times.
Enter vim/etc/sysconfig/network-scripts/ifcfg-ensxxx.
Modify"ONBOOT = no"If the value is no, you cannot access the Internet. Change it to" yes "first ". Press esc->: wq under vim to save and exit the vim editor.
If not, vim canVimChangeGeditThis makes it easy to modify. Enter shutdown-r now and restart your computer to connect to the Internet.
Note:
If there is a networking icon in the upper right corner, open the terminal and enter:Service NetworkManager startOpen NetworkManager.
Set a fixed ip Address
Enter ifconfig to find the corresponding IP Address
Open the ifcfg-ensxxx file again and add
IPADDR = 192.168.83.131 // Add IP address PREFIX = 24 // mask GATEWAY = 192.168.83.1 // Add GATEWAY
Modify host name
First enter the root user and then perform the following steps
View Host Name: Enter:Hostname
Procedure
Input: vim/etc/sysconfig/network
Display
NETWORKING=yes HOSTNAME= localhost.localdomain
Set the value after HOSTNAME = to the user name you want.
Modify the ing between host name and IP address
Terminal input:Vim/etc/hosts
-Add content at the end of the file. Format: IP address Host Name (separated by spaces). Save and exit.
192.168.83.131 yang1
Output after success: ping yang1 to check whether the operation is successful.