Network Configuration method under CentOS (Gateway, DNS, IP address configuration)
Source: Internet anonymous time: 07-13 00:32:07 "Big Small"
This article introduced the CentOS network configuration method, the CentOS network configuration mainly includes the DNS, the gateway, the IP address, mainly configures Resolv.conf\network\ifcfg-eth0 these network configuration files, needs the friend may refer to the next
CentOS Network Configuration Example
1. Configure DNS
Vi/etc/resolv.conf
Join:
Copy CodeThe code is as follows:
NameServer 192.168.0.1
NameServer 8.8.8.8
NameServer 8.8.4.4
2. Configure the Gateway:
Vi/etc/sysconfig/network
Join:
gateway=192.168.0.1
Complete the following:
Copy CodeThe code is as follows:
Networking=yes
Hostname=localhost.localdomain
gateway=192.168.0.1
3, configure the IP address:
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
The contents are as follows:
Copy CodeThe code is as follows:
Device= "Eth0"
Hwaddr= "00:0c:29:6c:bb:e6"
Nm_controlled= "Yes"
Onboot= "No"
netmask=255.255.255.0
ipaddr=192.168.0.8
gateway=192.168.0.1
Bootproto=static
Onboot=yes
Peerdns=yes
4, restart the service:
Copy CodeThe code is as follows:
/etc/init.d/network restart
or use the command:
Service Network restart
Or:
Ifdown eth0 and Ifup eth0
After the configuration is complete, ping the gateway to see if it can ping or check the actual configured IP address with ifconfig eth0.
CentOS Configuration Fixed IP