Centos Nic configuration under VPS Server

Source: Internet
Author: User
Tags vps server

Detailed description of centos Nic configuration under the VPS server automatically activates the NIC and installs CENTOS 6. after X, you need to manually activate the NIC every time you start the system. The following methods can be used to automatically activate the NIC after the system starts. Cat/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE = "eth0" HWADDR = "00: 0C: 29: FC: 1C: 72 & quot; NM_CONTROLLED = & quot; yes & quot; ONBOOT = & quot; no & quot; change ONBOOT to yesvi/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE = & quot; eth0 & quot; HWADDR = & quot; 00: 0C: 29: FC: 1C: 72 "NM_CONTROLLED =" yes "ONBOOT =" yes "# basic configuration after service network restart CentOS 6 installation 1. network configuration (1) command configuration # ifconfig eth0 192.168.0.2 netmask 255.255.255.0 // ip address, subnet mask # route add default gw 192.168.0.1 dev et H0 // gateway # hostname centos // computer name (2) file configuration modify IP address modify the configuration file of the corresponding Nic IP address (the following gateway address, IP address, subnet mask are network addresses not local LAN addresses) # vi/etc/sysconfig/network-scripts/ifcfg-eth0DEVICE = eth0 (describe the device alias for the NIC, such as eth0 in the ifcfg-eth0 file) BOOTPROTO = static, IP address obtained through the bootp protocol) BROADCAST = 192.168.0.255 (corresponding subnet BROADCAST address) HWADDR = 00: 07: E9: 05: E8: B4 (corresponding Nic physical address) IPADDR = 12.168.1.2 This field specifies the IP address of the Network Adapter.) 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 NETWORK adapter) NETWORK = 192.168.1.0 (NETWORK address corresponding to the NETWORK adapter) ONBOOT = yes (whether to set this NETWORK interface when the system starts, if yes is set, the device is activated when the system starts.) modify the gateway configuration file # vi/etc/sysconfig/networkNETWORKING = yes (indicates whether the system uses the network, it is generally set to yes. If it is set to no, the network cannot be used, and many system service programs cannot start) HOSTNAME = centos (set the Host Name of the local machine, the host name set here corresponds 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) modify the DNS configuration file of the corresponding Nic # vi/etc/resolv. confnameserver 202.101.224.68 (Domain Name Server) nameserver 202.101.224.69 (Domain Name Server) restart network configuration # service network restart or #/etc/init. d/network restart server uses Sun's VirtualBox to install Centos. when accessing the internet, the 'connect: Network is unreachable error' problem occurs. VirtualBox uses the Bridged Adapter method to connect. By modifying the/etc/sysconfig/network-scripts/ifcfg-eth0, the IP address of the virtual machine is already network and netmask. Ping the same network and netmask is found, so it is determined that it should be the routing configuration problem of the virtual machine operating system, try directly modifying the system file/etc/sysconfig/network-scripts/route-eth0 to add 'defult via 192.168.0.1 '(192.168.0.1 is the gateway address of my vro and can be modified as needed ). I ran to the/etc/sysconfig/network-scripts/directory and found that the root node didn't have the route-eth0 file, so I created a file and added 'defult via 192.168.0.1 'to the file. Run '/etc/init. d/network restart' to restart the network. Everything is OK! It turns out that the problem lies in the routing. In fact, I have already used the "following" route add command to configure the routing gateway, but it becomes invalid after the restart, which is a little careless. # Route add default gw 192.168.0.1 dev eth0 // gateway here is the network address in front of the route Gateway

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.