Basic Network Configuration after centos 6 is installed

Source: Internet
Author: User
Tags nameserver

(1) centos 6 command configurationThe command configuration will be restored after restart. To permanently Save the configuration of the file to be used
# Ifconfig eth0 192.168.0.2 netmask 255.255.255.0 // ip address, subnet mask
# Route add default GW 192.168.0.1 Dev eth0 // Gateway
# Hostname centos // computer name

(2) centos 6 file configuration
<1> centos 6 modify IP address
modify the corresponding Nic IP Address Configuration File
# vi/etc/sysconfig/network-scripts/ifcfg-eth0
device = eth0 (describe the device alias corresponding to the NIC, for example, it is eth0 in the ifcfg-eth0 file)
bootproto = static (set the way the NIC gets the IP address, the possible option is static, DHCP or BOOTP, respectively corresponding to the static specified IP address, IP addresses obtained through the DHCP protocol, IP addresses obtained through the BOOTP protocol) required
broadcast = 192.168.0.255 (corresponding subnet broadcast address)
hwaddr = 00: 07: E9: 05: E8: b4 (the physical address of the corresponding Nic)
ipaddr = 12.168.1.2 (if the IP address obtained by the NIC is set to static, this field specifies the IP address of the NIC) required, if it is a static IP address
ipv6init = No (enable or disable IPv6; Disable No, enable yes)
ipv6_autoconf = No (enable or disable automatic IPv6 Configuration; disable No, enable yes)
netmask = 255.255.255.0 (network mask corresponding to the NIC)
network = 192.168.1.0 (network address corresponding to the NIC)
onboot = Yes (whether to set this network interface when the system starts, and activate this device when the system starts) preferably set to Yes

<2> modify gateway in centos 6
Modify the gateway configuration file of the corresponding Nic
# Vi/etc/sysconfig/Network
Networking = Yes (indicates whether the system uses the network, which is generally set to yes. If it is set to no, the network cannot be used, and many system servicesProgramCannot be started)
Hostname = centos (set the Host Name of the local machine. The host name set here must correspond to the host name set in/etc/hosts)
Gateway = 192.168.1.1 (set the IP address of the gateway connected to the local machine. For example, the gateway is 10.0.0.2)

<3> modify DNS in centos 6
Modify the DNS configuration file of the corresponding Nic
# Vi/etc/resolv. conf
Nameserver 202.101.224.68 (Domain Name Server)
Nameserver 202.101.224.69 (Domain Name Server)

<4> centos 6 restarts Network Configuration
# Service network restart
Or
#/Etc/init. d/network restart

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.