Detailed explanation of setting static ip network card for CentOS 8 VMware virtual machine to access the Internet

Detailed explanation of setting static ip network card for CentOS 8 VMware virtual machine to access the Internet

first step:

In VMware, click "Edit" - "Virtual Network Editor". As shown in the figure below, I chose NAT mode: The following VMnet2 is configured


insert image description here

You can write any subnet IP and calculate the subnet mask yourself. If you are not familiar with it, just configure it the same as mine.

Class A default subnet mask: 255.0.0.0
Class B default subnet mask: 255.255.0.0
Class C default subnet mask: 255.255.255.0

To use a static IP, uncheck Use local DHCP service to assign IP addresses to virtual machines (this is selected by default).

Click NAT Settings

Remember the gateway IP as shown below, and finally configure the virtual machine IP file


Alt

application

Step 2: Enter the virtual machine

Log in to centos8 with root privileges and edit the file vi /etc/sysconfig/network-scripts/ifcfg-ens33. The effect is as follows:

TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=static #Note that it is set to static static DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=ens33
UUID=aa18fb34-fea8-4fff-83a4-1ebed631beff
DEVICE=ens33
ONBOOT=yes #If it is no, change it to yes, indicating that the network card device automatically starts GATEWAY=192.168.0.2 #The gateway address here is the gateway address obtained in the previous step IPADDR=192.168.0.150 #Write anything within the gateway range NETMASK=255.255.255.0 #Subnet mask DNS1=8.8.8.8 #DNS1 here uses Google,
DNS2=223.6.6.6 #DNS2 uses Alibaba

Then: wq save and exit

Step 3: Refresh the network card configuration

CentOS 8 use: nmcli c reload

CentOS7 uses /etc/init.d/network restart

Summarize

The above is what I introduced to you about setting up a static IP network card for the CentOS 8 VMware virtual machine to access the Internet. 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:
  • Graphic tutorial on installing CentOS7 on VMware 15.5
  • VMware installation of Centos8 system tutorial diagram (Chinese graphical mode)
  • VMware virtual machine installation CentOS 8 (1905) system tutorial diagram
  • vmware workstation12 installation centos prompts VMware Player and Device/Credential Guard are incompatible, reasons and solutions
  • Graphical tutorial on installing CentOS 7.3 on VMWare
  • VMware installation of CentOS virtual machine and configuration network graphic tutorial

<<:  Vue implements carousel animation

>>:  How to view and modify the time zone in MySQL

Recommend

MySQL uses frm files and ibd files to restore table data

Table of contents Introduction to frm files and i...

Detailed explanation of key uniqueness of v-for in Vue

Table of contents 1. DOM Diff 2. Add key attribut...

How to start a Java program in docker

Create a simple Spring boot web project Use the i...

Node quickly builds the backend implementation steps

1. First install node, express, express-generator...

Summary of knowledge points about events module in Node.js

Through the study and application of Node, we kno...

Docker renames the image name and TAG operation

When using docker images, images with both REPOSI...

Detailed analysis of MySQL master-slave delay phenomenon and principle

1. Phenomenon In the early morning, an index was ...

What should I do if I can't view the source file of a web page?

Q: Whether using Outlook or IE, when you right-cl...

How to customize more beautiful link prompt effect with CSS

Suggestion: Handwriting code as much as possible c...

Detailed explanation of common commands in MySQL 8.0+

Enable remote access Enable remote access rights ...

Installation steps of docker-ce on Raspberry Pi 4b ubuntu19 server

The Raspberry Pi model is 4b, 1G RAM. The system ...

VMware virtual machine three connection methods example analysis

NAT In this way, the virtual machine's networ...