DNS, gateways, IP addresses, mostly configuration Resolv.conf\network\ifcfg-eth0

Source: Internet
Author: User
Tags nameserver

CentOS Network Configuration Example

1. Configure DNS
Vi/etc/resolv.conf
Join:

Copy CodeThe code is as follows:
nameserver 192.168.0.1
nameserver 8.8.8.8
nameserver 8.8.4.4

2. Configure the Gateway:

Vi/etc/sysconfig/network
Join:
gateway=192.168.0.1
Complete the following:

Copy CodeThe code is as follows:
Networking=yes
Hostname=localhost.localdomain
gateway=192.168.0.1

3, configure the IP address:
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
The contents are as follows:


Copy CodeThe code is as follows:
device= "Eth0"
hwaddr= "00:0c:29:6c:bb:e6"
nm_controlled= "Yes"
onboot= "No"
netmask=255.255.255.0
ipaddr=192.168.0.8
gateway=192.168.0.1
bootproto=static
Onboot=yes
Peerdns=yes



4, restart the service:

Copy CodeThe code is as follows:
/etc/init.d/network Restart
or use the command:
Service Network Restart
or:
ifdown eth0 and ifup eth0

After the configuration is complete, ping the gateway to see if it can ping or check the actual configured IP address with ifconfig eth0.

DNS, gateways, IP addresses, mostly configuration Resolv.conf\network\ifcfg-eth0

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.