How to configure the ip address of the newly created virtual machine

AS WE ALL KNOW, if you want to play virtual machines, you need computer hardware support, after all, you start with three. The more I play my computer, the more it lags. Fortunately, the computer provided by the company is still very good, so I can do it.

But I haven’t played it for a long time, and it took me a few hours to configure the ip when I played it again. Let’s record the process:

During the installation, I chose to use the local network, but after entering the system, I found that ifconfig could not recognize it, so I could only use yum install net-tools to download the relevant installation package, and the result indicated that the network could not be connected.

Generally speaking, if you choose to use the local network during installation, you should be able to directly create a dynamic ip to access the network.

could not resolve hots:

 

Check the information on the Internet and say that nameserver 8.8.8.8 should be configured on /etc/resolv.conf

What's interesting is that when I first created it, there was no nameserver 8.8.8.8 in it, but after I added it, even if I deleted it, it will still be automatically generated after restarting, please answer!

Let me talk about my configuration:

First check the ip address, open the virtual machine software, click

Workstation->Edit->Virtual Network Editor, click Change Configuration, record the subnet IP, click NAT

Record the gateway and fill in the configuration:

 

 

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

Revise

BOOTPROTO= static

ONBOOT=YES

Add to:

IPADDR=192.168.233.103 (keep the same as the local configuration, only need to modify the last number, try to set consecutive numbers)

NETWORK=255.255.255.0

GATEWAY=192.168.233.2 (fill in the NAT in the virtual machine network configuration)

DNS1=8.8.8.8

 

Restart the network after the configuration is complete: service network restart

At this point the configuration is complete

have a test:

ping  www.baidu.com

View ip after installing net-tools

 

Gossip:

Originally also set the local virtual machine part of the settings

Modify the ipV4 in the properties

The settings are as follows:

But if you find out later that you don’t modify it, you can also set a static ip, so there must be no modification here.

 

 

 

 

 

 

Guess you like

Origin blog.csdn.net/qq_40513633/article/details/109749439