Linux beginners in virtual machines configure IP and restart the network

Linux beginners in virtual machines configure IP and restart the network

For those who are new to virtual machines or have just installed Linux in a virtual machine, you need to configure the IP address yourself because the system is installed in the virtual machine.

Let's configure this IP address in several steps:

Step 1: Open your virtual machine, open Linux, and log in using the root account.

As shown in the figure, I am using the CentOS7.2 system. After clicking to log in, enter the command interface and enter vi /etc/sysconfig/network-scripts/ifcfg-eth0 (the latter eth is different for each computer, you can press the tab key to complete it.)

Follow the above instructions to enter the IP configuration interface, as shown in the figure

Since I have already configured it, there will be three more fields than yours (IPADDR, GATEWAY, NETMASK).

Press the i key to enter insert mode and set BOOTTPROTO to static
Set ONBOOT to yes

Add IPADDR (static IP) instance 192.168.2.200 GATEWAY (gateway) 192.168.2.1 NETMASK (subnet mask) 255.255.255.0

After completion, press shift+q, enter: wq, save and exit.

Then return to your virtual machine operation interface, click Edit in the virtual machine, select Virtual Network Editor, add a network and select Host-only mode. Then change the subnet IP of the network you just added to 192.168.2.0 (in my example), and the first three digits must be the same as your IP address.

As shown in the figure

After completing the above steps, click OK, then right-click your virtual machine, select Settings, and change your network adapter to the network you just created.

As shown in the figure

After exiting, enter service network restart to restart the network service

Then you can use Xshell or Xftp to connect to your server. If the connection is successful, it means that your IP address has been successfully configured and you can connect.

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • CentOS7 network configuration under VMware virtual machine (host wireless Internet access)
  • Tutorial on how to modify the IP address of a Linux virtual machine, check the gateway, and configure the network environment
  • Implementation of CentOS8.0 network configuration
  • VMWare virtual machine 15.X LAN network configuration tutorial diagram
  • Detailed explanation of the steps for configuring the Centos7 bridge network under VMware
  • Detailed explanation of NAT configuration in Linux network
  • How to configure DNS in Docker's default bridge network
  • Analysis of the process of configuring a simple network environment based on Tcl language

<<:  Summary of the use of TypeScript in React projects

>>:  MySQL 5.7.17 installation and configuration graphic tutorial

Recommend

Write a dynamic clock on a web page in HTML

Use HTML to write a dynamic web clock. The code i...

How to write memory-efficient applications with Node.js

Table of contents Preface Problem: Large file cop...

Web design and production test questions and reference answers

<br />Web Design and Production Test Part I ...

Understanding the MySQL query optimization process

Table of contents Parsers and preprocessors Query...

How to modify the default network segment of Docker0 bridge in Docker

1. Background When the Docker service is started,...

A brief description of the relationship between k8s and Docker

Recently, the project uses kubernetes (hereinafte...

Docker-compose one-click deployment of gitlab Chinese version method steps

1. Introduction to gitlab Gitlab official address...

Vue uses Amap to realize city positioning

This article shares the specific code of Vue usin...

MySQL series 9 MySQL query cache and index

Table of contents Tutorial Series 1. MySQL Archit...

How to quickly use mysqlreplicate to build MySQL master-slave

Introduction The mysql-utilities toolset is a col...

In-depth understanding of asynchronous waiting in Javascript

In this article, we’ll explore how async/await is...

Vue2 implements provide inject to deliver responsiveness

1. Conventional writing in vue2 // The parent com...

MySQL deep paging (how to quickly paginate tens of millions of data)

Table of contents Preface Case optimization summa...