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

Nest.js hashing and encryption example detailed explanation

0x0 Introduction First of all, what is a hash alg...

4 ways to optimize MySQL queries for millions of data

Table of contents 1. The reason why the limit is ...

How to block and prohibit web crawlers in Nginx server

Every website usually encounters many non-search ...

MySQL configuration master-slave server (one master and multiple slaves)

Table of contents Ideas Host Configuration Modify...

HTML basic summary recommendation (title)

HTML: Title Heading is defined by tags such as &l...

Docker custom network implementation

Table of contents 1. Customize the network to rea...

Gojs implements ant line animation effect

Table of contents 1. Gojs Implementation 1. Drawi...

How to draw a cool radar chart in CocosCreator

Table of contents Preface Preview text Graphics C...

How are spaces represented in HTML (what do they mean)?

In web development, you often encounter characters...

Add and delete table information using javascript

Getting Started with JavaScript JavaScript is a l...

Analysis of MySQL user management operation examples

This article describes the MySQL user management ...