Based on the environment

Ip Command Introduction

The IP command is used to set network information for the Linux operating system. You can use the IP command to set the IP address, subnet mask, gateway, and route information. This section describes how to view IP addresses and set temporary IP addresses, subnet masks, and gateways.

View the IP addresses of all network adapters

ip a
Copy the code

Note:

Inet is followed by the IP address

View the IP address of a single network adapter

ip addr show eth0
Copy the code

The temporary IP address of the nic is set

Setting a Temporary IP address

IP addr add 192.168.100.18/24 dev eth0Copy the code

View the effect after the change

The original address