DECLARE first
the virtual machines used in this article : VMware Workstation Pro
This article uses the Ubuntu: arm Bare Metal 1-phase enhanced version of Ubuntu16.04
Special Note : If you use a virtual machine and Ubuntu is not the same, the phenomenon may not be the same, please specifically analyze the situation.
First, why do you want to let the virtual machine Ubuntu surfing the Internet?
Want to install the software online, download the git source package, or use a browser to browse the Web
second, in the virtual machine Ubuntu How many kinds of internet are there?
There are typically 2 kinds, NAT, bridging
Third, NAT How to use the Internet?
The NAT method----the fastest way to get the system online in a virtual machine. If you're just trying to get Ubuntu online in a virtual machine, this is the recommended way to do it.
NAT the premise of Internet: PC can surf the internet, even routers are not required.
NAT Settings for Internet access: VMware needs to be set up in one place:
We open the Web editor to see
The software has set up the subnet IP and so on, as long as the network in Ubuntu is set to DHCP to be able to surf the internet normally. If you need a fixed IP, you can also, below.
Another: The 192.168.47.0 network segment is assigned to Ubuntu in the virtual machine. Why is this network segment strange? Why not our usual network segment 192.168.1.0? This is because in NAT mode, the PC acts as a router's role. It must communicate with the upper router, but also with Ubuntu. The classmate who played the router knows that the router's upper and lower network segments are not allowed the same, and the network segment of our commonly used routers is 192.168.1.0, so in order to avoid the conflict, the software allocates an uncommon network segment to the lower-level devices. But it is not insurance, if your upper router network segment is exactly 192.168.47.0, then you need to change the network segment here.
NAT the advantages of the Internet: easy to set up, as long as the PC can surf the Internet, the system within the virtual machine can also surf the Internet.
NAT The disadvantage of the Internet: because of the PC's router role conversion, the virtual machine system is already a PC subnet device, it can communicate with the PC and other machines on the PC layer, but the other machines on the PC layer cannot communicate with the system in the virtual machine. For example: The Development Board access to the router, the virtual machine in the Ubuntu can ping the Development Board, in turn, but can not ping through. The topology diagram is as follows:
Four, how to use the bridge connection?
This can be said to be the most powerful way, throughout the development process, the bridge is fully able to meet the needs, strongly recommended to use.
the premise of bridging the Internet: you have to have a router, a PC using wired or wireless connection to a router that can surf the internet.
settings for bridging the Internet : VMware needs to be set at two:
After setting up the virtual machine within the Ubuntu and PC on the windows on the LAN within the equal position, such as:
At this point, Ubuntu and Windows will get the router assigned IP address, etc., here, Ubuntu will be able to surf the Internet.
If you don't want to let Ubuntu of the IP address to change, you can enter the Ubuntu network settings interface will be fixed IP, the steps are as follows:
Select Manual, Add, fill in the correct IP, mask, gateway, save. This way, Ubuntu's IP address is fixed, and it is convenient to use remote login under Windows.
Bridge The advantages of the Internet: the virtual machine within the system into a separate host network, the virtual machine system can be connected with all the devices in the whole LAN for two-way communication, if your development Board access to the router, then the three mutual ping without any problems.
The disadvantage of bridging the Internet: Bridging the selected NIC must be active. If you unplug the network cable or disconnect the WiFi, do not say that the Internet, even the windows and Ubuntu communication between, not to mention the use of SSH login.
V. Summary
If you simply want Ubuntu in your virtual machine to surf the internet, use NAT.
If you want Ubuntu in the virtual machine to surf the internet while still communicating with the development Board, then use the bridging method.
By the way, I enclose the campus network PING Problem resolution formula:
1. When you need Ubuntu to surf the internet, use NAT mode; 2. To interconnect with the Development Board, use Bridge mode
3. Ubuntu does not require Internet access when using the Ubuntu we offer
How do I get the virtual machine ubuntu online?