How to set the IP address of CentOS, Linux How to modify IP address
Step through ReadingBaidu Experience: jingyan.baidu.com
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 CentOS, how to modify the Linux system IP address?
steps to readBaidu Experience: jingyan.baidu.comTools/Materials
Baidu Experience: jingyan.baidu.comView IP Address
- 1
Login to connect to the CentOS system, enter ifconfig to view IP address information for the current local computer, such as
steps to read END
Baidu Experience: jingyan.baidu.comTemporarily set IP address
- 1
For 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
Steps to read
- 2
Checking the IP again becomes the new IP address.
Note that this method is modified only temporarily, restarting the NIC or server and restoring
steps to read END
Baidu Experience: jingyan.baidu.comSet \ Modify IP Address
- 1
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
Steps to read
- 2
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 through the BOOTP protocol broadcast=192.168.0.255 subnet broadcast address HWADDR=00:50:56:8e:47:ee nic Physical Address ipaddr =12.168.1.117 Network card IP address
Ipv6init=no whether to enable IPV6ipv6_autoconf=no netmask=255.255.255.0 network card corresponding netmask networ k=192.168.1.0 the network address of the NIC Onboot=yes if the system is set to Yes when it is started, the device is activated 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
- 3
2. Using the VI editor, press the Insert key to enter edit mode
Steps to read
- 4
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
Steps to read
- 5
4. After setting up, restart the network service, such as 2 commands can be service network restart
Steps to read
- 6
5. Check the IP again you will find that you have changed to the new IP address 1.118.
END
Baidu Experience: jingyan.baidu.comGraphical interface operation
- 1
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
Steps to read
- 2
After setting, if IP is required to take effect. Also need to restart the network service, or restart the computer
END
Baidu Experience: jingyan.baidu.comPrecautions
How to set the IP address of CentOS, Linux How to modify IP address