Solution to VMware virtual machine no network

Solution to VMware virtual machine no network

1. Problem Description

When installing Ubuntu 19.1, the installation process is extremely slow. It feels like it is running but the installation is extremely slow. In fact, this is not a problem with the computer or the virtual machine, but a network problem. Because the network is not good, it is extremely slow. After the installation is complete and I enter the system, I open the browser but cannot access the web page or ping it. This is also a problem with the virtual machine network allocation.

2. Problem Solving

1. If there is no network when installing the virtual machine system

Open the virtual machine settings and select host-only mode:

2. If there is no network after entering the virtual machine system

Open the virtual machine settings and select bridge mode. However, this is not the best solution. See below for details:

Save and exit, the problem will be solved. Let's analyze why this happens.

3. Principle Analysis

Let me give you a brief summary first.

Essentially:

  • Bridge mode: Virtual machines in the virtual network can access each other and can access physical machines and external network devices, which is equivalent to an independent host;
  • NAT mode: External network devices cannot access the virtual machine, but the virtual machine can access it;
  • Host-only mode: The virtual machine cannot access the external network and can only communicate with the physical machine.

Now let me explain why:

  • Because when we install the virtual machine, we use the iso file stored in the computer's hard drive, so the virtual machine will only communicate with the computer when it is born. Here we assume that our computer is the mother of the virtual machine, so we choose the host-only mode, which means that it can only communicate with the physical machine;
  • After the installation is completed, that is, when the child grows up and no longer needs to rely on the mother, he is independent and becomes an independent host. At this time, we should let him develop independently and let him see the outside world. After all, the child is grown up and cannot be controlled. At this time, we should give him bridge mode. At this time, the computer is equivalent to a bridge connecting to the outside world, and the virtual machine can be used as an independent computer.

After we install the virtual machine, we can see that there are 4 ways to connect to the network:

They are:

  • Bridge Mode
  • NAT Mode
  • Host-only mode
  • LAN Segment

Among them: bridging and NAT can meet the needs of virtual machines to connect to the external network, while the host-only mode cannot connect to the external network, but can achieve communication with the physical machine.

After VMware is installed, two virtual network cards will be automatically generated:

They are VMnet 1 and VMnet 8 respectively.

VMnet1 is used in hostonly mode, and VMnet8 is used in NAT mode.

  • VMnet1 is the host network card, used to connect to the network in host mode;
  • VMnet8 is a NAT network card, which is used to connect to the network via NAT, and their IP addresses are randomly generated.

The difference between the four connection methods:

1. Bridge mode

Bridge mode can be divided into two ways to connect:

The first is to directly connect the virtual machine's network card to the physical network:

However, it is not recommended to do so. This method allows the virtual machine's network card to communicate directly with the physical machine's network card.

  • This can be very convenient for Windows virtual machines, so you don’t have to think too much about it;
  • It can also be used in a Linux virtual machine, but this method is not recommended because it is not conducive to maintenance and sometimes the virtual machine may not be able to connect to the Internet.

So if you see this, then congratulations, you are lucky, you have found the best way to connect:

The second method is:

Select a specific virtual network

Open the Virtual Network Editor:

Click Change Configuration (requires administrator privileges):

Just select bridge mode:

This method is bridged through a virtual network.

This method is equivalent to directly adding a virtual network VMnet0 between the virtual machine network card and the physical machine network card . VMnet0 can choose whether the bridged network card is a wired network card or a wireless network card, or it can be selected automatically.

For example, if the physical machine accesses the Internet through a wireless network card, and VMnet0 selects a wired network card, it will definitely not be able to connect to the Internet.

My personal experience is to select "Automatic" and let VMnet0 automatically select a network card that can access the Internet.

"Bridging" means that the virtual machine's network card directly hands over the data packet to the physical network card of the physical machine for processing;

The virtual machine must have its own IP address, DNS, gateway and other information.

Two ways of illustration

Note: Problems may occur when using bridge mode on campus networks.

2. NAT mode

NAT (Network Address Translation)

This is equivalent to adding a switch directly between the virtual machine and the physical machine, which is equivalent to having a NAT address translation function, which can automatically convert the virtual machine's IP into an IP in the same network segment as the physical machine.

In fact, VMnet8 is in NAT mode and has its own DHCP function, which can assign IP addresses to virtual machines.

VMnet8

It enables virtual machines to communicate with physical machines and virtual machines to communicate with external networks, but the external network cannot communicate with the virtual machine. If you want to use the virtual machine as a server, you must not choose this mode.

3. Host-only mode (hostonly)

In this mode, the internal virtual machine is connected to a virtual network card VMnet1 that can provide DHCP function. VMnet1 is equivalent to a switch, which forwards the data packets sent by the virtual machine to the physical network card, but the physical network card will not forward the data packets outward. Therefore, the host-only mode can only be used for communication between virtual machines and between virtual machines and physical machines.

4. LAN segment

The LAN segment is equivalent to simulating a switch or hub to connect different virtual machines. It does not exchange data with the physical machine or the external network, thus building an independent network. There is no DHCP function, so you need to manually configure the IP or configure a DHCP server separately.

The above is my personal experience. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Solution to VMware virtual machine NAT mode can not connect to the Internet
  • Quickly solve the problem that CentOS cannot access the Internet in VMware
  • Solution to the problem that VM12 virtual machine cannot connect to the Internet when using bridge mode (graphic explanation)

<<:  Vue uses calculated properties to complete the production of dynamic sliders

>>:  Version numbers in css and js links in HTML (refresh cache)

Recommend

The solution of html2canvas that pictures cannot be captured normally

question First, let me talk about the problem I e...

Three ways to copy MySQL tables (summary)

Copy table structure and its data The following s...

HTML 5.1 learning: 14 new features and application examples

Preface As we all know, HTML5 belongs to the Worl...

A detailed explanation of the subtle differences between Readonly and Disabled

Readonly and Disabled both prevent users from chan...

MySQL tutorial thoroughly understands stored procedures

Table of contents 1. Concepts related to stored p...

Vue implements a simple marquee effect

This article shares the specific code of Vue to a...

Introduction to fourteen cases of SQL database

Data Sheet /* Navicat SQLite Data Transfer Source...

How to apply TypeScript classes in Vue projects

Table of contents 1. Introduction 2. Use 1. @Comp...

Detailed tutorial for downloading, installing and configuring MySQL 5.7.27

Table of contents 1. Download steps 2. Configure ...

Detailed explanation of VueRouter routing

Table of contents vue router 1. Understand the co...

Nginx access control and parameter tuning methods

Nginx global variables There are many global vari...

Vue implements two routing permission control methods

Table of contents Method 1: Routing meta informat...

The difference between name and value in input tag

type is the control used for input and output in t...

Two ways to start Linux boot service

Table of contents rc.local method chkconfig metho...