Home>Article>Operation and Maintenance> How to modify ip in centos
How to modify ip in centos?
Two ways for Centos to modify IP
Method 1:
View the current ip address of the system: ip add
The nmtui command brings up the modification window: nmtui
##Restart the network card: /etc /init.d/network restart Or: service network restart##Method 2:
Enter the network configuration file directory
First, make sure to operate under the root user. Enter the network configuration file network-scripts directory.
cd /etc/sysconfig/network-scripts/Find the configuration file we need to modify
Use the ls command to list the files in this directory. The "ifcfg-ens33" file is the network configuration file we need to modify.
Modify the configuration file
Use the vim command (vi command is also available) to configure the file,
We need to modify BOOTPROTO="static", which means changing dhcp to static, modify ONBOOT="yes", which means setting the network card to be enabled at boot, and add it below the text.
IPADDR=192.168.0.230 #静态IP GATEWAY=192.168.0.1 #默认网关 NETMASK=255.255.255.0 #子网掩码 DNS1=192.168.0.1 #DNS 配置 DNS2=8.8.8.8 #谷歌地址
ESC: WQ, save and exit!
Restart the network service
Use the service network restart command to restart the network service.
Recommended video tutorial for learning Linux:
//m.sbmmt.com/course/list/33.htmlThe above is the detailed content of How to modify ip in centos. For more information, please follow other related articles on the PHP Chinese website!