Configuration of virtual machine network card --- (NET mode)

If after we create the virtual machine, our virtual machine needs to connect to the network, we will need to configure the network card of our virtual machine.

1. First, enter the configuration file of our network card.

vi /etc/sysconfig/network-scripts/ifcfg-eth0

2. After entering the configuration file, configure the following information:
Note: The contents of IPADDR and GATEWAY need to be modified. The NET mode I configured here. In layman's terms, NET mode means that we are not on a common network segment with our Windows. As long as our computer is connected to the Internet, our virtual machine can be used.

Among them, IPADDR and GATEWAY have requirements

  (1) The first part of IPADDR must be consistent with that of your own virtual machine. (The following ones are all 0, just replace the 0 with a number)

  (2) The gateway cannot be changed.

3. Note that these two positions should be changed to yes and static.

 

4. After the configuration is completed, select ESC to exit: +wq to exit, and restart the network card.

Command: service network restart Note: If no error is reported, it is complete.

service network restart

5. After the configuration is completed, take a look and ping Baidu to verify whether it is successful. If Baidu can connect, there will be no problem. If so, it means it is OK and there is no problem.

ping www.baidu.com

 

Guess you like

Origin blog.csdn.net/m0_52725750/article/details/127388074