CentOS 7 cannot access the Internet after modifying the network card

CentOS 7 cannot access the Internet after modifying the network card

Ping www.baidu.com unknown domain name

Modify the host ip address

insert image description here

Right click properties

insert image description here

Select Attributes

This option was originally obtained automatically and may change later, so choose a fixed IP. This IP is obtained by entering ipconfig in the cmd window of the win10 host:

insert image description here

insert image description here

It is said on the Internet that the IP address in the virtual machine must be consistent with that of the physical host, but mine is indeed not consistent.

Virtual machine network configuration

insert image description here

Open the Virtual Network Editor.

insert image description here

The IP address filled in the first place should be consistent with the win10 host configuration above. The fourth field is filled with 0, otherwise it conflicts with the mask. The fourth field of subnet gateway (DNS) can be filled with 1 or 2.

insert image description here

Select DHCP. Finally confirmed.

Configure ifcfg-ens33 \ eth0 network card

At first, my network card was ens33 (centos7's network card starts with ens, and centos6's network card starts with eth). Due to vcs license issues, I changed its name to eth0. Notice! If you use the eth0 network card, be sure to mv the ens33 network card to other files, because these files will be traversed when the system starts. As a result, if ipaddr0 is configured in ens33, this ipaddr0 will be used first; finally, you will see the metaphysical phenomenon of eth0's ipaddr=ipaddr0 in ifconfig.

There is no need to manually add any ipaddr, mask, or gateway addresses here! ! ! (I added it, but it was not used in the end)

insert image description here

If ipaddr is not filled in, the system will assign ipaddr=169.254.199.128 by default, which is assigned by DHCP.

insert image description here

Ping this ipaddr, and you can receive data, indicating that the ip is usable

insert image description here

Ping the subnet gateway (DNS), and you can receive data, indicating that DNS is available.

insert image description here

However, after configuring the virtual machine, the DNS often cannot be pinged and needs to be restarted/rebooted.

The reason is that the /etc/resolv.conf file has not been updated and is still the previous DNS. The picture below shows the file after restart. You can see that the DNS has been updated. Ping this dns passed.

insert image description here

ping www.baidu.com

insert image description here

Ok, you can go online now!

Of course, you don't have to restart, but there will be more steps, which I will not go into here.

This is the end of this article about how to solve the problem of centos7 being unable to access the Internet after modifying the network card. For more relevant content about centos7 being unable to access the Internet, please search for previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope everyone will support 123WORDPRESS.COM in the future!

You may also be interested in:
  • Solve the problem that the CentOS7 virtual machine cannot access the Internet and set up the CentOS7 virtual machine to use a static IP to access the Internet
  • CentOS7 network configuration under VMware virtual machine (host wireless Internet access)
  • Solution to the problem of not being able to access the Internet when installing centos7 with VmWare

<<:  HTML code to add icons to transparent input box

>>:  HTML+CSS to achieve simple navigation bar function

Recommend

How to handle long data when displaying it in html

When displaying long data in HTML, you can cut off...

Question about custom attributes of html tags

In previous development, we used the default attr...

Advanced Usage Examples of mv Command in Linux

Preface The mv command is the abbreviation of mov...

Sample code for implementing radar chart with vue+antv

1. Download Dependency npm install @antv/data-set...

Vue component encapsulates sample code for uploading pictures and videos

First download the dependencies: cnpm i -S vue-uu...

The DOCTYPE mode selection mechanism of well-known browsers

Document Scope This article covers mode switching...

A brief analysis of whether using iframe to call a page will cache the page

Recently, I have a project that requires using ifr...

Summary of the unknown usage of "!" in Linux

Preface In fact, the humble "!" has man...

Solve the black screen problem after VMware installs Linux system and starts

1. Installation environment 1. HUAWEI mate x cpu ...

JavaScript to achieve the effect of clicking on the submenu

This article shares the specific code of JavaScri...

Learn to deploy microservices with docker in ten minutes

Since its release in 2013, Docker has been widely...

Four solutions for using setTimeout in JS for loop

Table of contents Overview Solution 1: Closures S...

Analysis of MySQL latency issues and data flushing strategy process

Table of contents 1. MySQL replication process 2....