Environment:
Centos7.4_x64
The setting method is as follows:
Enter the network card configuration directory
cd /etc/sysconfig/network-scripts/
ifconfig View the network card information and obtain the name of the network card ens32
(Recommended tutorial: centos usage tutorial)
Find the configuration The file ifcfg-ens32
is modified as follows:
vim ifcfg-ens32 TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no BOOTPROTO=static IPADDR=192.168.1.149 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 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=ens32 UUID=d16fe359-9256-4414-a557-19d751b4fc72 DEVICE=ens32 ONBOOT=yes
Restart the network card
systemctl restart network
Recommended related video tutorials: linux video tutorial
The above is the detailed content of How to set a static ip address in centos. For more information, please follow other related articles on the PHP Chinese website!