Solve the problem of being unable to ping the external network after installing Centos7 in VMware

Solve the problem of being unable to ping the external network after installing Centos7 in VMware

A problem occurred when configuring a cluster. Originally, all three virtual machines could ping the external network, but suddenly only one could ping the external network. The three virtual machines could ping each other. I looked at many methods and compared the relevant network configurations in /etc/sysconfig/network-scripts/ifcfg-ens33 of the three virtual machines. There was still no problem. Later, I found the answer on a foreign website.

Answer link 1: https://geekflare.com/no-internet-connection-from-vmware-with-centos-7/

Answer link 2: https://stackoverflow.com/questions/22010904/cannot-connect-centos-vm-to-internet-nat-connection

The second answer link is from stackoverflow.

Simply put, use the command dhclient -v

That is, re-obtain the IP address.

The first answer first describes the problem: the IP address cannot be obtained using the ifconfig command (I personally installed the mini version, which does not have this command installed. If you are in the same situation as me, you can install it. Of course, if you can't connect to the external network like me, then hehehe)

The author gives possible reasons for the problem: the network adapter is not enabled, or it cannot obtain a DHCP IP address.

The answer 1 also gives the method of automatic startup:

Open /etc/init.d

Create a file net-autostart (you can name it yourself)

#!/bin/bash
# Solution for "No Internet Connection from VMware"
#
### BEGIN INIT INFO
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
### END INIT INFO
dhclient -v

After saving, change the permissions

chmod 755 net-autostart

Set up auto-start

chkconfig --add net-autostart

Then reboot

Summarize

The above is what I introduced to you to solve the problem of not being able to ping the external network after installing Centos7 in VMware. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!
If you find this article helpful, please feel free to reprint it and please indicate the source. Thank you!

You may also be interested in:
  • Solve the problem that VMware host-only mode virtual machines cannot ping physical machines
  • Solve the problem that VMware cannot ping the host and the host cannot ping the virtual machine

<<:  JS interview question: Can forEach jump out of the loop?

>>:  Javascript combined with Vue to achieve automatic path finding for any maze image

Recommend

Tomcat maxPostSize setting implementation process analysis

1. Why set maxPostSize? The tomcat container has ...

Tutorial on binary compilation and installation of MySql centos7 under Linux

// It took me a whole afternoon to install this, ...

MySQL database deletes duplicate data and only retains one method instance

1. Problem introduction Assume a scenario where a...

Nginx configuration and compatibility with HTTP implementation code analysis

Generate SSL Key and CSR file using OpenSSL To co...

The principle and implementation of js drag effect

The drag function is mainly used to allow users t...

How to view available network interfaces in Linux

Preface The most common task after we install a L...

How to find the specified content of a large file in Linux

Think big and small, then redirect. Sometimes Lin...

Solutions for high traffic websites

First: First, confirm whether the server hardware ...

How to disable ads in the terminal welcome message in Ubuntu Server

If you are using the latest Ubuntu Server version...

CUDA8.0 and CUDA9.0 coexist under Ubuntu16.04

Preface Some of the earlier codes on Github may r...

How to generate Hive table creation statement comment script in MySQL metadata

Preface This article mainly introduces the releva...

Summary of Creating and Using Array Methods in Bash Scripts

Defining an array in Bash There are two ways to c...

Several ways to implement 0ms delay timer in js

Table of contents queueMicrotask async/await Mess...