The main system is set up in the following places:
IP address set by this confidential
Netmark Subnet Mask
Gateway Default Gateways
DNS IP
Files related to network configuration in CentOS:
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/resolv.conf
/etc/hosts
Modify the location (only the parameters that make the modification are listed, not the contents of the modification are listed):
1
/etc/sysconfig/network
gateway=192.168.1.1 #这里是设置网关, I set the router address
2
/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0
#BOOTPROTO =dhcp #dhcp是动态获取IP地址
Bootproto=static #static就是设置静态IP
ipaddr=192.168.1.21 #这里就是需要设置的静态IP
netmask=255.255.255.0 #掩码
Type=ethernet #网络类型
Nm_controlled=no
Hwaddr=xx:xx:xx:xx:xx:xx
Onboot=yes
uuid=*************
3
/etc/resolv.conf
NameServer 192.168.1.1 #指定DNS
4
/etc/hosts
This file is used to define the hostname, as needed to set
You need to restart the network service after you have done the changes/etc/inti.d/network restart
CentOS 6.5 Set Fixed IP