Centos Nic Configuration

Source: Internet
Author: User
Tags nameserver

1. view the network MAC address
 

 [[email protected] ~]# cat /etc/udev/rules.d/70-persistent-net.rules


The following information is displayed:
 

 # PCI device 0x15ad:0x07b0 (vmxnet3)   SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:94:04:3c", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"  # PCI device 0x15ad:0x07b0 (vmxnet3)  SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:50:56:94:53:24", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

  

Eth0: corresponds to the first Nic, and eth1: The second Nic. Currently, eth0 is used to connect to the vro, and eth1 is retained (the server is generally used to connect to other hosts)


2. Modify host name
  

[[email protected] ~]# vim /etc/sysconfig/network

Open the file, modify the following content, and save

 

Networking = yes # Use Network hostname = centos # Set Host Name

3. Modify the NIC
 

[[email protected] ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0

Open the file, modify the following content, and save

 

Device = eth0 # corresponding to the first Nic type = Ethernet onboot = yes # whether to run nm_controlled = Yes bootproto = static # use a static IP address, instead of assigning IP defroute = Yes ipv4_failure_fatal = Yes ipv6init = no name = "system eth0" # name hwaddr = 00: 50: 56: 94: 04: 3C # It must correspond to the MAC address (/etc/udev/Rules) of etho. d/70-persistent-net.rules) peerdns = Yes peerroutes = Yes ipaddr = 192.168.2.249 # specify the local IP address netmask = 255.255.255.0 # specify the subnet mask gateway = 192.168.2.1 # specify the Gateway


4. Modify DNS
 

 [r[email protected] ~]# vim /etc/resolv.conf

  

Open the file, modify the following content, and save
  

Nameserver 8.8.8.8 # Google's DNS server nameserver 61.144.56.100 # specify the nearest DNS server in the current city (different cities, online search) nameserver 192.168.2.1 # specify the DNS server specified on the router

5. Restart Network Configuration
  

[[email protected] ~]#service network restart

6. Restart

[[email protected] ~]#shutdown -r now

7. view the current IP settings

  

[[email protected] ~]# ifconfig

8. Test whether to connect to the Internet

[[email protected] ~]# ping www.baidu.com 

Note: Do not write wrong letters, ipaddr, or ipadr gateway. Do not write fewer hosts...

Centos Nic Configuration

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.