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

Implementation of modifying configuration files in Docker container

1. Enter the container docker run [option] image ...

Implementation code for adding slash to Vue element header

<template> <div class="app-containe...

Master the commonly used HTML tags for quoting content in web pages

Use blockquote for long citations, q for short ci...

What to do if you forget your mysql password

Forgot your MySQL password twice? At first I did ...

Solution to Apache cross-domain resource access error

In many cases, large and medium-sized websites wi...

How to Monitor Linux Memory Usage Using Bash Script

Preface There are many open source monitoring too...

JavaScript BOM Explained

Table of contents 1. BOM Introduction 1. JavaScri...

How to display JSON data in HTML

background: Sometimes we need to display json dat...

Steps of an excellent registration process

For a website, it is the most basic function. So l...

Summary of Spring Boot Docker packaging tools

Table of contents Spring Boot Docker spring-boot-...

Methods and steps to upgrade MySql5.x to MySql8.x

Several Differences Between MySQL 5.x and MySQL 8...

HTML table tag tutorial (31): cell width and height attributes WIDTH, HEIGHT

By default, the width and height of the cell are ...

Explain how to analyze SQL efficiency

The Explain command is the first recommended comm...