Network settings for virtual machine Centos-mini after installation is complete

Source: Internet
Author: User

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

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.