VMware Linux NAT mode setting static IP

Source: Internet
Author: User

a lot of information on the Internet, but not very practical, here for everyone to summarize. Nat mode online. Because NAT itself will be able to surf the Internet why also set IP. This is a bit of trouble. But this is necessary in the cluster. Either you build a pseudo-distribution or at least three physical machines. To save costs, pseudo-distributions are typically selected. pseudo-Distribution also has a choice, three modes that way more appropriate.
1. Bridging, this approach is relatively simple for most people. As long as you set the Ip,dns, gateway, etc., the relationship between the host and the virtual machine is not very large. But if it is a PC dial-up Internet, I'm afraid this way is not suitable.
2.nat mode, but the automatic acquisition of IP, do not need to set up to achieve the Internet, the shortcomings can not communicate with the host. Because of his shortcomings, there is room for us to play. This is also the focus of this article.
2.host mode, the virtual machine can communicate with each other, but it cannot communicate with the host. In fact, he can also surf the internet, which is supplemented later.

NAT Mode Internet
NAT mode Internet, need to pay attention to a few problems. Nat if the Internet first needs to see the physical machine (PC) This server has been started. The principle of Internet: traffic is the physical network card, but its IP, but it is not related to the physical machine. In other words, no matter how you change the network environment, your virtual machine does not need to change. That's the advantage.

first, after the installation, we will see two more network cards


If the network configuration of the torture, you should be able to find two network cards: Vmnet1 and Vmnet8, here is vmnet8.


focus on the right third picture you will see the IP address, this IP address, because of personal differences, that is, different networks, different environments, the probability of this IP change is very large. It could be 192.168.0.1 and so on. Here is also the equivalent of a variable of our programming, here you need to be based on your environment to assign values.
----------------------------------------------------------------------------------------------------------- --------------------------------
above we see the virtual machine NIC IP, in order to avoid mixing, the above virtual network card and the local network adapter in the same interface. As



The following is the menu popup after the virtual machine is opened



after the popup, we are looking at the virtual machine's (switch) vmnet8.




You can see that the VMNET8 subnet IP and the virtual machine Nic are for the same network segment.
At the same time on the right-hand net setup interface, we can see that the gateway is: 192.168.106.2, which is important because we use the virtual machine settings in the back.
--------------------------------------------------------------------------------------------------------------- ----------------------------
We have a general understanding of the above, we should set up the Linux network:
First, the server version of the network configuration

First you need to set the IP, gateway, subnet mask
First we pass

Open interfaces, then set IP, gateway, subnet mask

After the setup is complete, we are setting up DNS.
There are two ways to set up DNS, here you can refer to the Ubuntu Common commands summary and modify the DNS of a number of methods summary
Because setting the

    1. /etc/resolv.conf
Copy Code

After setting, restart the computer and the configuration will be restored. Finally set in the head and base of/ETC/RESOLVCONF/RESOLV.CONG.D.


Once setup is complete, execute

    1. Resolvconf-u
Copy Code

And then view

    1. Cat/etc/resolv.conf
Copy Code

The content is what was set up in the head just now (it needs to be explained in the head setting, or in base settings).

Once set up, we can see the content.
--------------------------------------------------------------------------------------------------------------- --------------------------
It's basically done, but you need to restart the NIC.

    1. sudo/etc/init.d/networking restart
Copy Code




    1. Ping www.baidu.com
Copy Code

See below, you can connect to the Internet.



--------------------------------------------------------------------------------------------------------------- ---------------------------------

Second, the desktop version of the configuration:Some of the above students in the set up, not yet the Internet, if used when the desktop version of Ubuntu, we can set up a bit:First step: If you see click the up and DOWN arrow-"Edit connetctions, will pop up figure 2Figure 1Second step: After the popup we select the network card-"EditFigure 2The third step: We select IPv Settings, method in the choice of manual, ( when you choose to encounter problems when you see here , remember to drag the mouse do not put, the cursor placed after, and then let go of the selected), select after we set the network card and gateway, DNS. Remember this must be consistent with the above network card information.   Note: For the desktop version of Ubuntu only through the interface configuration can not need to re-configure through the command

VMware Linux NAT mode setting static IP

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.