1. Network configuration
(1) Command configuration
# ifconfig eth0 192.168.0.2 netmask 255.255.255.0 address, subnet mask
# route add default GW 192.168.0.1 dev eth0/Gateway
# hosthttp://www.aliyun.com/zixun/aggregation/11696.html ">name CentOS//Computer name
(2) file configuration
<1> Modify IP Address
Modify the configuration file for the IP address of the corresponding network card
# Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Device=eth0 (describes the device alias for the NIC, for example, it is eth0 in Ifcfg-eth0 file)
Bootproto=static (set up the network card to obtain IP address, possible options for STATIC,DHCP or BOOTP, respectively, corresponding to the static specified IP address, the IP address obtained through the DHCP protocol, the IP address obtained through the BOOTP protocol)
broadcast=192.168.0.255 (corresponding subnet broadcast address)
HWADDR=00:07:E9:05:E8:B4 (corresponding network card physical address)
ipaddr=12.168.1.2 (This field specifies the IP address of the network adapter if you set the network card to obtain an IP address as a static designation)
Ipv6init=no (turn on or off IPv6;
Ipv6_autoconf=no (turn on or off IPv6 automatic configuration;
netmask=255.255.255.0 (Network mask corresponding to network card)
network=192.168.1.0 (network address for NIC)
Onboot=yes (whether this network interface is set when the system is started, when set to Yes, activate the device when the system starts)
<2> Modify Gateway
Modify the configuration file of the gateway for the corresponding network card
# vi/etc/sysconfig/network
Networking=yes (Indicates whether the system is using the network, typically set to Yes.) If set to no, the network cannot be used, and many system services programs will not start.
Hostname=centos (sets the host name for this machine, where the host name is set to correspond to the hostname set in hosts)
gateway=192.168.1.1 the IP address of the gateway that sets the local connection. For example, the gateway is 10.0.0.2)
<3> Modify DNS
To modify the DNS profile of the corresponding network adapter
# vi/etc/resolv.conf
NameServer 202.101.224.68 (domain name server)
NameServer 202.101.224.69 (domain name server)
<4> Restart Network configuration
# Service Receptacle Restart
Or
#/etc/init.d/network Restart