Vim/etc/sysconfig/network-scripts/ifcfg-eth0 on behalf of the configuration file
Write
Device = eth0 # describe the device alias for the NIC, for example, it is eth0 in the ifcfg-eth0 File
Bootproto = static # Set the way for the NIC to obtain the IP address. The possible options are static, DHCP, or BOOTP, which respectively correspond to the IP address specified by the static state and the IP address obtained through the DHCP protocol, IP addresses obtained through the BOOTP protocol
Broadcast = 192.168.0.255 # corresponding subnet broadcast address
Hwaddr = 00: 07: E9: 05: E8: B4 # physical address of the corresponding Nic
Ipaddr = 12.168.1.2 # If you set the method for obtaining the IP address from the NIC to static, this field specifies the IP address of the NIC.
Ipv6init = No
Ipv6_autoconf = No
Netmask = 255.255.255.0 # network mask corresponding to the network adapter
Network = 192.168.1.0 # network address of the NIC
Onboot = yes # whether to set this network interface when the system starts. If it is set to yes, the device is activated when the system starts.
Restart the network:/etc/init. d/network restart
Modify static IP address in centos