Home  >  Article  >  Operation and Maintenance  >  How to modify ip address in linux

How to modify ip address in linux

王林
王林Original
2020-05-15 15:04:477566browse

How to modify ip address in linux

You can modify the ip address by modifying the configuration file.

1. Modify the eth0 configuration file

[root@lnode1 ~]# cd /etc/sysconfig/network-scripts/
TYPE=Ethernet
PROXY_METHOD=none    //修改
BROWSER_ONLY=no
BOOTPROTO=none
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=eth0
UUID=4f5f8b5d-4b51-4e1c-98c7-40f0eb90f241
DEVICE=eth0    
ONBOOT=yes   // 修改
IPADDR=192.168.4.12    //修改
PREFIX=24    //修改

2. Modify the eth1 configuration file

First add the network card

[root@lnode1 ~]# nmcli connection add  con-name eth1 ifname eth1 type ethernet //先添加网卡

Then modify the configuration file, the method is the same as modifying eth0 The configuration file is the same.

3. Restart the network card service

[root@lnode1 ~]# systemctl restart  NetworkManager

Recommended tutorial: linux tutorial

The above is the detailed content of How to modify ip address in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn