CentOS6.2 basic network configuration

Source: Internet
Author: User
The first serial device in the ppp0 system of the first Ethernet card in the eth0 system (most of which appear when ADSL is used to dial into the Internet) there are four configuration methods for configuring the network card in CentOS6. you can select the appropriate one based on your situation. here, Centos6.2 is used as an example... common network devices

Lo loopback device

The first Ethernet card in the eth0 system

The first serial device in the ppp0 system (most of which appear when ADSL is used to dial into the Internet)

There are four configuration methods for configuring NICs in CentOS 6. you can select the appropriate one based on your situation.
The following uses Centos 6.2 as an example. the network adapter uses eth0 as an example.

I. Graphic Interface Configuration
Open "system" -- "preferences" -- "network connection"
Select the network card to operate and click Edit

Select "automatic connection" in the upper left corner ",
Select IPv4 settings and select [method] as "manual ",
Click "add" and enter the address, subnet mask, Gateway, and DNS in sequence;
My configuration here is
IP: 192.168.1.122
Subnet mask: 255.255.255.0
Gateway: 192.168.1.1
DNS: 192.168.1.1
Click "application!
II. Use setup to configure
Open the terminal, enter the command setup, open the configuration tool as shown in, and select network configuration

Select "device configuration" and configure DNS later.

Select eth0

Configuration Example: click "OK" after configuration.

Then return to the DNS configuration, and save and exit.


3. directly edit the configuration file
Open the terminal and enter the command: vi/etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE = indicates the name of the physical DEVICE.
ONBOOT = yes indicates that the device is activated when the system starts, and no indicates that the device is not activated.
BOOTPROTO = the value can be static (static configuration), bootp (using the bootp protocol), dhcp (using the dhcp protocol)
BROADCAST = indicates the BROADCAST address.
IPADDR = indicates the IP address of the NIC
PREFIX = subnet mask
GATEWAY = indicates GATEWAY
DNS * = indicates DNS

IV. command line configuration
1. configure the eth0 address
Run ifconfig eth0 192.168.1.122 netmask 255.255.255.0
2. add a default route
Enter the command: route add default gw 192.168.1.1
3. configure DNS
Run vi/etc/resolv. conf.
Add nameserver 192.168.1.1 to text

Restart the network service after configuration.
Enter the command: service network restart

 

View Nic configurations
Enter the command: ifconfig eth0

If you want to view all NICs, you only need to use ifconfig.


Check NIC status
Enter the command: ethtool eth0
Link detected: yes, indicating that the NIC is connected

Check network connectivity
Enter the command: ping-c 4 baidu.com

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.