The configuration of centos6 network

Recommended for you: Get network issues from WhatsUp Gold. Not end users.
1 network configuration

Modify the corresponding cardIP address configuration file
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
Modify the following contents
DEVICE=eth0 (describing device aliases, corresponding network card such as ifcfg-eth0 file for eth0)
BOOTPROTO=static (set the card to obtain IP address, the possible options for the static, DHCP or BOOTP, respectively, the corresponding static IP address specified is obtained through the DHCP protocol, IP address, IP address through BOOTP protocol)
BROADCAST=192.168.0.255 (subnet broadcast address of the corresponding)
HWADDR=00:07:E9:05:E8:B4 (the corresponding physical address)
IPADDR=12.168.1.2 (if set the card to get the IP address of the method for statically assigned, this field specifies the corresponding network card IP address)
IPV6INIT=no
IPV6_AUTOCONF=no
NETMASK=255.255.255.0 (Ethernet correspondence network mask)
NETWORK=192.168.1.0 (network corresponding to the network address)
ONBOOT=yes (set this network interface, whether the system startup is set to yes, the system starts to activate this equipment)

The 2 Revised gateway

Gateway to amend the corresponding network card configuration file
# vi /etc/sysconfig/network
Modify the following contents
NETWORKING=yes (system whether the use of network, the general settings for yes. If set to no, we cannot use the network, and a lot of system service program will not start)
HOSTNAME=centos (host name, set the machine here host set host name and /etc/hosts name)
GATEWAY=192.168.1.1 (gateway settings of this machine is connected to the IP. For example, the gateway to the 10.0.0.2)

The 3 amendment DNS

Modify the corresponding card of the DNS configuration file
# vi /etc/resolv.conf
Modify the following contents
Nameserver 202.101.224.68 (domain name server)
Nameserver 202.101.224.69 (domain name server)

4 restart network configuration

# service network restart
Or
# /etc/init.d/network restart


5 to change the IP address

Immediate effect:
# ifconfig eth0 192.168.0.2 netmask 255.255.255.0
Start date:
Modify/etc/sysconfig/network-scripts/ifcfg-eth0
Modify the default gateway gateway
Immediate effect:
# route add default gw 192.168.0.1 dev eth0
Start date:
Modify/etc/sysconfig/network
Modify the DNS
Modify/etc/resolv.conf
Modify host name
Can be modified with immediate effect, start with the same effective immediately:
# hostname centos1
Start date:
Modify/etc/sysconfig/network

6 network command

Ifdown eth0 closed network
Ifconfig eth0 down closed network
Ifup eth0 open network
Ifconfig eth0 up open network

service network start //Start the network service
service network stop //Stop the network service
service network restart //Service network restart
service network status //Check the status of network services
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download

Posted by Tony at December 27, 2013 - 10:15 PM