First, the method of acquiring IP automatically:
1,/Etc/sysconfig/network-scripts/ifcfg-eth0
[Email protected] ~]# Cat/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0//Initiated by eth0
hwaddr=00:0c:29:40:ec:61//mac Address
Type=ethernet
Uuid=9c6a7fc6-66ce-406d-993f-6ab26a730e72
Onboot=yes//Whether the network interface is valid when the system starts; default No
Nm_controlled=yes
BOOTPROTO=DHCP//Get IP mode, static is fixed ip,none is manual, DHCP is automatically acquired
2,/etc/sysconfig/network
[Email protected] ~]# cat/etc/sysconfig/network
Networking=yes
Hostname=smbserver
3,/etc/hosts
[Email protected] ~]# cat/etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
4,/etc/resolv.conf
[Email protected] ~]# cat/etc/resolv.conf
# Generated by NetworkManager
NameServer 202.96.128.86
NameServer 8.8.8.8//dns Service Address
Second, manually set IP, DNS
Manually set IP, DNS only need to modify three files on it.
1,/etc/sysconfig/network
[Email protected] network-scripts]$ cat/etc/sysconfig/network
Networking=yes
Networking_ipv6=yes
#HOSTNAME =localhost.localdomain//Why the host name is commented out, usually first resolve the hostname or domain name, and then resolve the DNS
gateway=192.168.1.1//Plus Gateway
2,/etc/sysconfig/network-scripts/ifcfg-eth0
[email protected] network-scripts]$ cat Ifcfg-eth0
# Marvell Technology Group Ltd. 88E8039 pci-e Fast Ethernet Controller
Device=eth0
Bootproto=none//Start for manual
broadcast=192.168.1.255
hwaddr=00:16:d3:a2:f6:09
ipaddr=192.168.1.108//Set of IP
netmask=255.255.255.0//Subnet mask
network=192.168.1.0
Ipv6init=yes
Ipv6_autoconf=yes
Onboot=yes
Type=ethernet//Network type
3,/etc/resolv.conf
[Email protected] network-scripts]$ cat/etc/resolv.conf
#; Generated By/sbin/dhclient-script
#nameserver 192.168.1.1
#search Localdomain
NameServer 116.228.111.118//Plus Primary DNS
NameServer 180.168.255.18//Plus secondary DNS
CentOS Network Configuration method (manual setup, automatic acquisition)