Linux: CentOS7 Nic settings (P1), centos7p1

Source: Internet
Author: User
Tags dns2 nameserver

Linux: CentOS7 Nic settings (P1), centos7p1

You can set the NIC in Linux in several ways.

  • Method 1: Enter setup
  • Method 2: modify the configuration file

 

We recommend that you modify the configuration file for network configuration. The following describes the configuration process of CentOS7 in VirtualBox.

 

Configuration File Effective sequence:

 

Configuration instance:

Vi/etc/sysconfig/network-scripts/ifcfg-enp0s3 use vi to modify TYPE = EthernetBOOTPROTO = staticDEFROUTE = yesPEERDNS = yesDNS1 = protocol 255.255.0gateway = protocol = noNAME = enp0s3UUID = 08b69929-afd0-4310-baf2-fc376f251f36DEVICE = enp0s3ONBOOT = yes

 

Configuration instructions:

Parameter values are case-insensitive, single quotes and double quotation marks, or even quotation marks are not required.

  • TYPE: Ethernet, IPsec
  • DEVICE: Network Interface Name
  • BOOTPROTO: system startup address protocol

None: Do not use the startup address protocol

Bootp: Use the BOOTP protocol

Dhcp: Use the dhcp protocol.

Static: static address protocol

  • ONBOOT: whether the system is activated at startup

Yes: Activation

No: inactive

  • IPADDR: IP Address
  • NETMASK: Subnet Mask
  • GATEWAY: GATEWAY address
  • BROADCAST: BROADCAST address
  • HWADDR/MACADDR: MAC address. You only need to set one address and cannot conflict with each other.
  • PEERDNS: Specifies whether to use DNS. If DHCP protocol is used, the default value is yes.

Yes: If DNS is set, modify the DNS in/etc/resolv. confg.

No: do not modify DNS in/etc/resolv. confg

  • DNS1/DNS2: When PEERDNS is set to yes, it will be written to/etc/resolv. conf.
  • NM_CONTROLLED: whether the Network interface is controlled by Network Manager. The interface takes effect immediately after the modification is saved. We recommend that you set it to no

Yes: Controlled by Network Manager

No: not controlled by Network Manager

  • USERCTL: user permission Control

Yes: Non-root users are allowed to control this network interface.

No: Non-root users are not allowed to control this network interface.

  • IPV6INIT: whether to execute IPv6

Yes: IPv6 is supported.

No: IPv6 is not supported.

  • IPV6ADDR: IPv6 address/prefix length

 

 

Stop, start, and restart the NIC Service

  • Stop
Systemctl stop network. service or systemctl stop network

  

  • Start
Systemctl start network. service or systemctl start network

  

  • Restart
Systemctl restart network. service or systemctl restart network

  

Note: CentOS6 restart command

service network restart

  

 

DNS Configuration

Note: If the PEERDNS parameter is yes and DNS1 and DNS2 are configured in the network port information, the DNS information will be written to/etc/resolv. in conf,/etc/resolv. the DNS in conf will be invalid.

 

/Etc/resolv. conf configure the instance nameserver 202.96.128.86 nameserver 202.96.128.166nameserver 8.8.8.8

  

It is recommended to set in the network port

PEERDNS=yesDNS1=202.96.128.86DNS2=202.96.128.166

  

Common network test commands

 

Ping a domain name or ip address -- test network connectivity

Host domain name-test DNS explanation

Dig domain name-test DNS explanation

Ip route -- display route table

Traceroute www.baidu.com -- trace the network path to the target address

Mtr www.baidu.com -- use mtr for network quality testing (combined with traceroute and ping)

 

 

 

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.