System environment: Virtual machine, centos-mini,x86-64,
1. Host name settings
Documents involved:/etc/hostname; /etc/sysconfig/network
1.1 Write your own hostname in/etc/hostname, write it with your liking
1.2 Add or change the hostname field in the/etc/sysconfig/network file to the same content in the previous file:
2. IP and its related settings
Documents involved:/etc/sysconfig/network-scripts/ifcfg-eth*
In general, the Ifcfg-eth0 file can be set statically, as well as dynamic IP.
2.1 Static IP address settings:
2.1.1 Click on the Edit menu in the virtual machine software, select the Virtual network Editor, change the network connection to NAT mode, and set the subnet and subnet mask.
2.1.2-click Nat setting to set the gateway for the virtual network:
2.1.3 Set the IP address of the virtual machine and its correlation, the IP of this host is 172.20.1.11, the gateway will be the same as the above settings, edit the/etc/sysconfig/network-scripts/ifcfg-eth0 file:
Then restart the network via the service network restart, and if the settings are OK, the status will be okay.
Next, view the set up network via Ifconfig:
2.1.4 So far, you cannot connect to the network and need to set up a DNS server
Files involved:/etc/resolv.conf.
Where 8.8.8.8 and 8.8.4.4 are Google's free DNS
We set the IP of the gateway because the routers now have DNS forwarding capabilities. So you set up the local DNS can also surf the internet, in fact, the implementation of your Internet is the local DNS, 172.20.1.254 just in the middle of the hand.
2.1.5 Test Network
You can view network connectivity directly with the ping command, which indicates that the network settings are fine if there is a response.
Network settings for virtual machine Centos-mini after installation is complete