The network configuration is saved in the network-scripts folder. We first go to the directory and use the following command:
cd /etc/sysconfig/network-scripts/
(recommended Tutorial: centos usage tutorial)
Then we look at the files in the directory and find an ifcfg-ensxxx network configuration file. If not, create one. Here is ifcfg-ens33
Use vim to open the ifcfg-ens33 file and modify the relevant configuration
After modifying the configuration file, the content is as follows:
TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static #这里改成static代表设置静态ip 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=ens33 UUID=99c45215-02e8-4e93-baee-8760f25ee478 DEVICE=ens33 ONBOOT=yes #启动自动运行 ZONE=public IPADDR=192.168.1.19 NETMASK=255.255.255.0 GETEWAY=192.168.1.1 DNS1=192.168.1.1 PREFIX=24 GATEWAY=192.168.0.1
Recommended related video tutorials: linux video tutorial
The above is the detailed content of How to configure ip address in centos system. For more information, please follow other related articles on the PHP Chinese website!