1. Modify DNS # VI/ETC/RESOLV.CONF
NameServer 8.8.8.8 #google域名服务器
NameServer 8.8.4.4 #google域名服务器
2. Modify Host name # Vi/etc/sysconfig/network
Networking=yes (Indicates whether the system uses a network)
Hostname=centos (set host name for this machine)
3.ip Related # Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Onboot=yes #开机启动
Bootproto=static #设置网卡获得ip地址的方式, the possible options are static,dhcp or BOOTP, corresponding to statically specified IP addresses, IP addresses obtained through the DHCP protocol, IP addresses obtained through the BOOTP protocol
ipaddr=12.168.1.2 #如果设置网卡获得 IP address is statically specified, this field specifies the IP address of the NIC
netmask=255.255.255.0 #子网掩码
gateway=192.168.1.1 #网关地址
dns1=8.8.8.8 #也可以设置dns, the address of the DNS profile/etc/resolv.conf automatically matches the address added here, and does not clear after restarting the NIC
dns2=8.8.4.4
DHCP environment, after/etc/resolv.conf manually add DNS address, restart the network card, will automatically clear; The DNS address added to/etc/sysconfig/network-scripts/ifcfg-eth0 will not be cleared;
Peerdns=no #设置此项/etc/resolv.conf will not be rewritten after a system restart
Static IP environment,/etc/resolv.conf Manually add DNS address, restart will not be cleared;
Restart Network
# Service Network Restart
CentOS Network Related Settings