[CentOS7 Networking Problem] Only three steps are required for nanny-level teaching. Super detailed steps are clear and clear (valid after actual testing in July 2023)

The CentOS system you just downloaded does not have a network configured. You can test it in the terminal.

There is no network at this time. Next, perform network configuration.

Note: Root permissions are required (I used root permissions throughout the process)

Enter the su root command to enter the root user

 1. Fixed IP address and network card configuration 

Currently, the IP address of our virtual machine's Linux operating system is obtained through the DHCP service.

DHCP: Obtain the IP address dynamically, that is, it will be obtained every time the device is restarted, which may cause the IP address to change frequently.

 So next we need to fix the IP address

1. Open VMware Edit->Virtual Network Editor and change settings as administrator

 

 

2. Then select 1, modify the values ​​​​in 2 and 3 (it is recommended to copy it directly, 2 can also modify the range by yourself, such as 77.0 or 66.0, etc., the value of 3 must be 255.255.255.0), and finally click 4 

 

 3. Set the gateway to 88.2 (the range at this time is between 88.0~88.2)

 4. Open the centos system terminal and enter the following command to modify the configuration file of the ens33 network card.
gedit /etc/sysconfig/network-scripts/ifcfg-ens33
 5. Just modify the content in the box, then save and exit. If there is no gedit, then change gedit in the command to vim

6. Then enter the following command to close and restart the network card
systemctl stop network
systemctl start network

 At this point, the IP address has been fixed. You only need to enter the ifconfig command to view the IP. The IP address will be 192.168.88.130 every time you restart.

ifconfig

 

 2. Modify DNS gateway

 1. Enter the following command
gedit /etc/resolv.conf
 2. Add commonly used DNS servers (just copy them), then save and exit.

nameserver 114.114.114.114

nameserver 8.8.8.8

nameserver 223.5.5.5

 3. Restart network service

systemctl restart network.service
 final test
ping www.baidu.com

 Enter the command, ping the system and the system can access the Internet normally, then press CTRL + c to exit.

 If it doesn't work, check whether you entered the wrong steps in the previous step or skipped the step. 

 

おすすめ

転載: blog.csdn.net/2301_77160836/article/details/131627487