1. Environment
System hardware: CPU: 2x2 cores, 2 GB memory
System version: Centos-6.5-x86_64
Router Gateway: 192.168.1.1
2. View network MAC
[Root @ centos ~] # 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 & Prime ;, KERNEL = "eth *", NAME = "eth0 & Prime;
# PCI device 0x15ad: 0x07b0 (vmxnet3)
SUBSYSTEM = "net", ACTION = "add", DRIVERS = "? * ", ATTR {address} =" 00: 50: 56: 94: 53: 24 & Prime;, ATTR {type} = "1 & Prime ;, KERNEL = "eth *", NAME = "eth1 & Prime;
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)
3. Modify host name
[Root @ centos ~] # Vim/etc/sysconfig/network
Open the file, modify the following content, and save
NETWORKING = yes # use the network
HOSTNAME = centos # Set host name
4. Modify the NIC
[Root @ centos ~] # Vim/etc/sysconfig/network-scripts/ifcfg-eth0
Open the file, modify the following content, and save
DEVICE = eth0 # corresponds to the first Nic
TYPE = Ethernet
ONBOOT = yes # run at startup
NM_CONTROLLED = yes
BOOTPROTO = static # use a static IP address instead of an IP address allocated by DHCP
DEFROUTE = yes
20174_failure_fatal = yes
IPV6INIT = no
NAME = "System eth0 & Prime; # NAME
HWADDR = 00: 50: 56: 94: 04: 3C # it must correspond to the MAC address of etho (/etc/udev/rules. d/70-persistent-net.rules)
PEERDNS = yes
PEERROUTES = yes
IPADDR = 192.168.1.100 # specify the local IP address
NETMASK = 255.255.255.0 # specify the subnet mask
GATEWAY = 192.168.1.1 # specify the GATEWAY
5. Modify DNS
[Root @ centos ~] # Vim/etc/resolv. conf
Open the file, modify the following content, and save
Nameserver 8.8.8.8 # GOOGLE's DNS server
Nameserver 202.106.0.20 # specify the nearest DNS server in the current city (different cities, in Beijing)
Nameserver 192.168.1.1 # specify the DNS server specified on the router
6. Restart the network configuration.
[Root @ centos ~] # Service network restart
7. Restart
[Root @ centos ~] # Shutdown-r now
8. View current IP settings
[Root @ centos ~] # Ifconfig
9. Test whether to connect to the Internet
[Root @ centos ~] # Ping www.111cn.net