CentOS Network Related Settings

Source: Internet
Author: User
Tags nameserver

1. Modify DNS # VI/ETC/RESOLV.CONF
NameServer 8.8.8.8 #google域名服务器
NameServer 8.8.4.4 #google域名服务器
2. Modify Host name # Vi/etc/sysconfig/network
Networking=yes (Indicates whether the system uses a network)
Hostname=centos (set host name for this machine)
3.ip Related # Vi/etc/sysconfig/network-scripts/ifcfg-eth0
Onboot=yes #开机启动
Bootproto=static #设置网卡获得ip地址的方式, the possible options are static,dhcp or BOOTP, corresponding to statically specified IP addresses, IP addresses obtained through the DHCP protocol, IP addresses obtained through the BOOTP protocol
ipaddr=12.168.1.2 #如果设置网卡获得 IP address is statically specified, this field specifies the IP address of the NIC
netmask=255.255.255.0 #子网掩码
gateway=192.168.1.1 #网关地址

dns1=8.8.8.8 #也可以设置dns, the address of the DNS profile/etc/resolv.conf automatically matches the address added here, and does not clear after restarting the NIC
dns2=8.8.4.4

DHCP environment, after/etc/resolv.conf manually add DNS address, restart the network card, will automatically clear; The DNS address added to/etc/sysconfig/network-scripts/ifcfg-eth0 will not be cleared;
Peerdns=no #设置此项/etc/resolv.conf will not be rewritten after a system restart

Static IP environment,/etc/resolv.conf Manually add DNS address, restart will not be cleared;

Restart Network
# Service Network Restart

CentOS Network Related Settings

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.