Environment:
System hardware: VMWare vsphere (CPU: 2*4 cores, 2 GB memory)
System Version: Centos-6.5-x86_64
Router Gateway: 192.168.1.1
Steps:
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 the 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 # 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" # 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.40 # specify the local IP Address
Netmask = 255.255.255.0 # specify the subnet mask
Gateway = 192.168.1.1 # specify the Gateway
4. Modify DNS
[[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.1.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.163.com
Centos network settings modify the specified IP address DNS Gateway ()