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 install Composer in Linux

1. Download the installation script - composer-se...

Detailed explanation of the usage of 5 different values ​​of CSS position

The position property The position property speci...

Docker swarm simple tutorial

swarm three virtual machines 132,133,134 1. Initi...

How to install MySQL for beginners (proven effective)

1. Software Download MySQL download and installat...

Detailed explanation of Vue router routing guard

Table of contents 1. Global beforeEach 1. Global ...

Steps to completely uninstall the docker image

1. docker ps -a view the running image process [r...

Vue3 Vue Event Handling Guide

Table of contents 1. Basic event handling 2. Send...

How to create an index on a join table in MySQL

This article introduces how to create an index on...

How to ensure transaction characteristics of MySQL InnoDB?

Preface If someone asks you "What are the ch...

How to implement the Vue mouse wheel scrolling switching routing effect

A root routing component (the root routing compon...

Vue implements a scroll bar style

At first, I wanted to modify the browser scroll b...

VMware12 installs Ubuntu19.04 desktop version (installation tutorial)

1. Experimental description In the virtual machin...