Solution to the problem that Ubuntu cannot connect to the Internet in the virtual machine

Solution to the problem that Ubuntu cannot connect to the Internet in the virtual machine

It is very painful to set up a virtual machine that cannot connect to the Internet. Here I will talk about my personal experience with Ubuntu's NAT Internet access problem. I have no experience with other bridge connections, etc.

Ubuntu version: ubuntu-16.04-desktop-amd64.iso

1. Check/set up the NAT network

Open VMware Workstation, click Edit - Virtual Network Editor , and view the network in NAT mode.

As shown in the figure below, if you don’t like the automatically assigned subnet IP, you can click Restore Default Settings, but it will still be automatically assigned and you cannot set it yourself.

Click NAT Settings to view the subnet IP subnet mask and view and set the gateway IP

Click DHCP settings to view and set the automatically assigned IP range . The manually assigned IPs used later will be among these IPs.

2. Set the IP of the virtual machine

Click VMware Workstation virtual machine -> Settings to open the virtual machine settings

Set the network connection to NAT connection mode

Start the virtual machine, enter the graphical interface, and click the network up and down arrows in the upper right corner . The wired connection 1 icon is the network currently in use. If there are other networks, you can connect to other networks

We click Edit Connections below to enter the IP settings.

Select the IP to be edited, click Edit to enter the network settings interface

Select IPv4 Settings , enter the network settings interface, and select the Method:

Automatic means automatic allocation. In order to make our network fixed , we choose Manual.

Click Add below to add a network , including setting Address (IP address), NetMask and Gateway

Among them, Address is the IP range in DHCP of the virtual network editor NAT interface, Netmask is the subnet mask in DHCP, and Gateway is the gateway in NAT settings.

After the settings are completed, save and exit, click the network up and down arrows in the upper right corner, click Disconnect, and then select the network we set. Here we select wired connection 1.

This is equivalent to reloading the network configuration file to access the network.

Now let's check the IP of the network;

Ping the host's IP, not the NAT network (but the host's own IP), Ping Baidu

PING host machine's IP and Baidu's results

Networking effect:

hint:

If you can ping the IP but cannot ping Baidu or other pings with domain names as the object, it means that there is no tool to resolve the domain name. We need to set the domain name server IP in the virtual machine:

View the host's IP domain name server address 210.22.70.3

Set the IP of the DNS server in the virtual machine network settings: This should be enough

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • Detailed explanation of how to build an Ftp server on Ubuntu (success guaranteed)
  • How to decompile android apk in ubuntu environment
  • Detailed configuration of wireless network card under Ubuntu Server
  • VMware workstation 12 install Ubuntu 14.04 (64 bit)
  • VMware Workstation 14 Pro installation Ubuntu 16.04 tutorial
  • Solution to Ubuntu not being able to connect to the Internet
  • Ubuntu16.04 builds php5.6 web server environment
  • How to build nfs service in ubuntu16.04
  • How to modify the time zone and time in Ubuntu system
  • Solution to no Chinese input method in Ubuntu

<<:  Solution to secure-file-priv problem when exporting MySQL data

>>:  Detailed explanation of Javascript closures and applications

Recommend

How to find websites with SQL injection (must read)

Method 1: Use Google advanced search, for example...

Should I use distinct or group by to remove duplicates in MySQL?

Preface About the performance comparison between ...

How to regularly clean up docker private server images

Using CI to build docker images for release has g...

The most commonly used HTML escape sequence

In HTML, <, >, &, etc. have special mean...

Solve the problem of installing Theano on Ubuntu 19

Solution: Directly in the directory where you dow...

React Hook usage examples (6 common hooks)

1. useState: Let functional components have state...

40 fonts recommended for famous website logos

Do you know what fonts are used in the logo desig...

MySQL learning to create and operate databases and table DDL for beginners

Table of contents 1. Operate the database 1.1 Cre...

Native JS to implement image carousel JS to implement small advertising plug-in

Recently I want to use native JS to implement som...

A practical record of checking and processing duplicate MySQL records on site

Table of contents Preface analyze Data Total Repe...

Using NTP for Time Synchronization in Ubuntu

NTP is a TCP/IP protocol for synchronizing time o...

Centos7 install mysql5.6.29 shell script

This article shares the shell script of mysql5.6....

Docker container time zone adjustment operation

How to check if the Docker container time zone is...

js implements custom drop-down box

This article example shares the specific code of ...