After successful installation of CentOS 6.5, it is not connected to the Internet by default. At this time, you need to set up the network for the root user.
1. Log in to the root account first
2. Enter the following command from the command line to modify the configuration file
vim /etc/sysconfig/network-scripts/ifcfg-eth0
3. Modify or add the following configuration
BOOTPROTO=static #Enable static IP address
ONBOOT=yes #Enable automatic network connection
IPADDR=192.168.21.129 #Set IP address
NETMASK=255.255.255.0 #Set subnet mask
GATEWAY=192.168.1.1 # Set gateway
DNS1=8.8.8.8
#Set primary DNS DNS2=8.8.4.4 #Set backup DNS
IPV6INIT=no #Prohibit IPV6
4. Enter the command to exit and restart
Exit: wq!
restart reboot
5. Test whether the connection is successful
ping external network Baidu
ping internal network