Virtual machine three network mode & Bridging mode Setup steps

Source: Internet
Author: User
Tags get ip

Virtual Machine Network mode

Whether it is VMware, virtual box,virtual pc and other VM software, generally speaking, virtual machine has three kinds of network mode:

Bridging NAT host-only which network is suitable for its own virtual machine.



Bridge Connection

Bridging network refers to the local physical network card and virtual network card through the VMnet0 Virtual Switch Bridge, physical network card and virtual network card in the same position on the topology map, then the physical network card and virtual network card is equivalent to the same network segment, the virtual switch is equivalent to a real network of switches, Therefore, the IP address of two network adapters should also be set to the same network segment.

So when we want to use virtual machines on the local area network to provide services to other PCs on the LAN, such as providing FTP, providing SSH, and providing HTTP services, we have to choose the bridging mode.

For example, the university dormitory has a router, dormitory four people connect this router, router wanip, this IP is dynamically acquired, and Lanip default is 192.168.1.1 (gateway), subnet mask is 255.255.255.0. And the other four people are automatically get IP, suppose four people's IP is:

a:192.168.1.100/255.255.255.0, b:192.168.1.101/255.255.255.0, c:192.168.1.102/255.255.255.0, D:192.168.1.103/ 255.255.255.0

Then the IP address of the virtual machine can be set is 192.168.1.2-192.168.1.99,192.168.1.104-192.168.1.254 (except for all 0 and 1 of the network address, and then remove the IP address of ABCD four).

Then the virtual machine IP address can be set to 192.168.1.98/255.255.255.0, set this IP address, ABCD These four people can access the virtual machine via 192.168.1.98, if the virtual machine needs the external network, then also need to configure the virtual machine routing address, that is, 192.168.1.1, so that the virtual machine can be outside the network, but, the internet we are generally through the domain name to access the extranet, so we also need to match the virtual machine To set up a DNS server, we can simply point to configure the DNS server address as Google's DNS server: 8.8.8.8, so that the virtual machine can be online.


NAT

In NAT mode, the virtual machine uses the NAT (network address translation) function to access the public network through the network where the host machine resides.

In NAT mode, the network of the virtual machine's NIC and the physical NIC is not in the same network, and the network card of the virtual machine is a virtual network provided by VMware.

Nat and Bridging comparisons:

(1) NAT mode and bridging mode virtual machine can be on the network.

(2) Since Nat's network is in a virtual network provided by VMware, so other local area network host is unable to access the virtual machine, and the host can access the virtual machine, virtual machine can access all the hosts of the LAN, because the real LAN relative to the NAT virtual network, is NAT virtual network extranet, People who don't understand can look up the knowledge of Nat.

(3) in bridging mode, multiple virtual machines can be accessed from one another, and in NAT mode, multiple virtual machines can be accessed from one another.

If you build a virtual machine, just for yourself, do not need to use for other local area network, then you can choose NAT, after all, the virtual system in NAT mode TCP/IP configuration information is provided by the DHCP server of VMnet8 (NAT) virtual network, as long as the network configuration of the virtual machine is DHCP, Then you do not need to do any other configuration, just need the host machine to access the Internet, you can make the virtual machine network.

For example, you want to build multiple virtual machine clusters, used as testing, and the host may be a notebook, IP is not fixed. This application scenario, we need to use the NAT mode, but we have to consider a problem, the virtual machine is the need to exchange visits, the default DHCP, virtual machine IP Restart every time, IP is not fixed, so we need to manually set the virtual machine IP address.

But we know nothing about the virtual network of virtual machine cards, such as the routing address of the virtual machine network, the subnet mask, so we need to look up the information of the NAT virtual network first.

Using VMware, after configuring the virtual network information in Edit->virtual network editor, see the following image, note that Vmnet8,vmnet8 is equivalent to a local route, the virtual machine set NAT after the route to the Internet, You can view its network address, routing address, subnet mask.

Select Vmnet8->nat settings, you can see the subnet IP display of 192.168.233.0, subnet mask is 255.255.255.0, that routing address, in fact, is the gateway IP, is the same thing, here is 192.168.233.2.

Next good to do, in the corresponding virtual machine set IP, subnet mask, routing address can be on the network, as for DNS can be set to 8.8.8.8



host-only

In host-only mode, the virtual network is a completely closed network, it is the only access to the host. In fact, Host-only Network and NAT network is very similar, different place is host-only network without NAT service, so the virtual network cannot connect to the Internet. Communication between the host and the virtual machine is achieved through the VMware Network adepter VMnet1 virtual network card.

The purpose of Host-only is to establish an internal network which is isolated from the outside world to improve the security of intranet. This feature may not make much sense to average users, but large service chambers often take advantage of this feature. If you want to provide routing functionality for VMNET1 segments, you need to use RRAS instead of XP or 2000 ICS. Because ICS will change the IP address of the intranet to 192.168.0.1, but the virtual machine does not assign this address to the VMNET1 virtual network card, then the host and the virtual machine cannot communicate.



Summary

In VMware's 3 network mode, NAT mode is the simplest, and basically does not need to manually configure the relevant parameters such as IP addresses. As for the bridging mode requires additional IP address, if it is in the intranet environment is also very easy, if ADSL broadband is more troublesome, ISP is generally not generous to provide a public network IP.





Bridging Settings

Reference steps:

(1) Set up the primary system "local connection" to ensure that the "VMware Bridge Protocol" in front of the tick

(2) Set up virtual machine, menu bar--vm-settings-hardware-networkadapter-Select bridged

(3) Under the VM, enter the Edit-virtual net editor of the virtual machine, set the VMnet0 to bridge mode, and connect to the Ethernet.

(4) Set Ubuntu Pv4 Settings,ip address and PC address in the same network segment, Netmask,dns,gateway and the same as the host.

(5) Restart network services. Disconnect the network before reconnecting. Confirm the modification with ifconfig.

The individual only operates the first 3 steps, the latter two steps are not configured by default, that is, the bridge configuration is completed.

The IP address of the virtual machine is the same network segment as the host's IP address when the modification is complete. Example host: 10.109.23.46 virtual machine is: 10.109.23.22

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.