for many friends who have just come into contact with Linux, how to set the IP address of the Linux system, as the first step, the following small series of CentOS system as an example, to show you how to set the IP address of the CentOS , how do I modify the Linux system IP address?
View IP AddressLogin to connect to the CentOS system, enter ifconfig to view IP address information for the current local computer, such as
Temporarily set IP addressFor example, the above query IP is 1.117, enter ifconfig eth0 (default is the first network card) followed by IP address, netmask and gateway, if not set, use the default mask
Checking the IP again becomes the new IP address.
Note that this method is modified only temporarily, restarting the NIC or server and restoring
Set \ Modify IP Address
If you want to make the IP address permanent, you need to edit the NIC configuration file
Use the VI editor settings, such as Vi/etc/sysconfig/network-scripts/ifcfg-eth0
describe the document; Device=eth0 NIC corresponding device alias, such as Ifcfg-eth0 first NIC Bootproto=static
How the NIC obtains the IP address,
Static IP Address
DHCP (get IP via DHCP protocol)
bootip IP address obtained via BOOTP protocol 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 IPV6 is enabled ipv6_ AUTOCONF =no netmask=255.255.255.0 network card corresponding to netmask NETWORK=192.168.1.0 Network Address of the NIC ONBOOT=yes whether this network interface is set when the system starts, and when set to Yes, activates the device when the system starts. The default setting is Yes
As for the following type and UUID this does not have to worry about, the type of the network card
2. Using the VI editor, pressInsert key Insertion, enter edit mode
3. Move the cursor to the IPADDR Settings section and change to the IP address you want to set.
As in this example, change to 1.118. Press the ESC key.
Enter Colon: Wq Save exit
Will prompt "/etc/sysconfig/network-scripts/ifcfg-eth0" 14L, 302C written
4. set up, the network service restart, such as 2 commands can be service network restart
5. View IP again you will find that you have changed to a new IP address 1.118
Graphical interface operation
Besides
You can manipulate it in the graphical interface. Edit the network card settings, or use the Netconfig command to enter the graphical interface settings
After setting, if IP is required to take effect. Also need to restart the network service, or restart the computer
Precautions
Linux_centos How to set IP address, how to modify the IP address of Linux