Today came into contact with a new task to modify the Linux IP address. Using the wave of the server, operating system for CentOS7.
(a) In order to enable the IP address to be permanently effective. First enter the edit vi/etc/sysconfig/network-scripts/ifcfg-enp4s0f0 file.
(ii) A description of the following document:
DEVICE=ENP4S0F0 network card corresponding to the device alias, such as IFCFG-ENP4S0F0 first network card
Bootproto's Chinese translation is the boot source, representing the way that the network card obtains the IP address, the DHCP (dynamic Host Configuration Protocol) represents the dynamically generated IP address by the DHCP server, static indicates that the IP address is static IP.
BROADCAST=192.168.0.255 Subnet Broadcast Address
Hwaddr=00:50:56:8e:47:ee Network card Physical Address
ipaddr=12.168.1.117 Network card IP address
Ipv6init=no whether to enable Ipv6ipv6_autoconf=no
netmask=255.255.255.0 NIC corresponding to the network mask
The network address of the NETWORK=192.168.1.0 network card
Onboot=yes This network interface is set when the system is started, and when set to Yes, the device is activated when the system is started. The default setting is yes.
As for the following type and UUID this is not necessary, this type of network card.
(iii) using the VI editor, insert by inserting key, enter edit mode.
(d) 3. Move the cursor to the IPADDR Settings section and change to the IP address you want to set, as in this case, to 1.118. Press the ESC key. Enter Colon: Wq save exit will prompt "/etc/sysconfig/network-scripts/ifcfg-enp4s0f0" 14L, 302C Writte
(five) After setting up, restart the network services, the following Figure 2 commands can service network restart
(vi) In the second view of your IP address, you will find that has changed.
PS: On many older servers, the device name is generally eth0, and now many new machines are no longer named in this way, for example, the device name for this article is enp4s0f0.