"How to change ip address in Linux"

Query ip address

We use the ip addr command on linux to query the ip address

    ip addr

image.png
ip address to view the address

Check whether the ip address is smooth

We use the ping command on linux to check whether the ip is smooth

    ping 192.168.126.129

image.png
Description ip smooth

If the ip is not displayed, or there is a problem with the network card, then execute the following command:
    service NetworkManager stop 
    chkconfig  NetworkManager  off    永久关闭 Manager网卡
    service  network restart		  重启network网卡

Modify ip address

The first step-find the directory of the ip address

If I need to change the ip address, I must enter the ip address directory, the directory is as follows:

    cd /etc/sysconfig/network-scripts/

image.png

The second step-modify the ip address

1.1- If you modify it, first find the ifcfg-ens33 file in the ip address directory

image.png

1-2-vim to enter the file
     vim ifcfg-ens33
1-3-Modify the ip address after entering the file

image.png

After entering the IPADDR, I will change our ip

Step 3-Restart the ip address

我们重启ip的话使用以下命令:
    service network restart

image.png

The same as shown in the picture indicates a successful restart

The fourth step-check the ip address (whether it was successfully modified)

    ip addr

image.png

The ip was successfully changed. . . . .

Guess you like

Origin blog.csdn.net/weixin_45103228/article/details/113756805