ubuntu16.04 Configuration static IP (NAT mode) under VM virtual machine

Source: Internet
Author: User

In the recent process of writing a project on a VM, you need to connect to MySQL on the virtual machine via navicat on Windows, and discover that the ubuntu16.04 system IP under each reboot of the virtual machine is different, causing the connection that was previously configured in Navicat to be unusable. So think of the need to configure a system in the VM will not change the IP, after the Internet to find relevant information, and according to their own practice, will now tidy up the notes.

Configuring a static IP for a VM virtual machine can use the handover, but the cluster is better because of the VAT configuration, so it is recommended to use NAT.

1. Share the network of the host network card to VMnet8

On the desktop, find "network"-"Network and Sharing Center"-"Change adapter Settings"-Right click on the network card currently used by the computer, I use wireless, so check "wireless network Connection" Right-click "Properties"-"shared"- In the selection box, select the VMNET8 network card.

2. View the IP assigned by the host to the VMnet8 NIC

Command line input: ipconfig

3. Edit the virtual network on the VM

Open the VM Software--"edit"--"virtual network editor"

4. View valid IP ranges

Open the VM Software--"edit"--"virtual network editor"

5. Modify the virtual machine's network adapter

Open the VM Software--"virtual machine" and "settings"

6. View the network card name of the virtual machine

Virtual machine terminal input: IP route Show

7. Configure static IP

Virtual machine terminal input: sudo gedit/etc/network/interfaces, then fill in the following content

Note:DNS server In addition to the configuration in the 7th step of the file, can also be configured separately in another file, as follows

    • Virtual machine terminal input: sudo gedit/etc/resolv.conf, then fill in the following content

  

Extensions : More DNS See http://dns.ip.cn/

8. Restart the network

Restart the virtual machine or restart the network card: sudo/etc/init.d/networking restart

9. Testing

Open the virtual machine terminal, Ping an address to see if you can ping, such as: Ping www.baidu.com

ubuntu16.04 Configuration static IP (NAT mode) under VM virtual machine

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.