Host-only mode, between the host and the virtual machine, through the first set, you can ping each other, can be connected to each other.
Today learn how to set Host-only mode, how to let the virtual machine can also access the external network.
Due to the host-only mode, there are two gateways that are completely independent of the host.
1, the Host network connection right-click the –> property –> settings Share, as shown below
2. View VirtualBox host-only Network
3, on the host, view Ipconfig
4. On the virtual machine, set the IP address of the gateway address to the virtual machine on the host computer
5. Set the domain name address
6. Restart Network Service restart
7. Ping www.baidu.com
Success..
The following basic information about the three types of network models on a virtual machine draws on the HTTP://LIBLOG.LITTLEYUAN.COM/ARCHIVES/9 address information to understand the next.
Before you talk about VMware's network model, let's talk about several VMware virtual devices:
VMnet0: This is the virtual switch used by VMware for virtual bridging networks;
VMnet1: This is the virtual switch used by VMware for virtual host-only networks;
VMnet8: This is the virtual switch that VMware uses for virtual NAT networks;
VMware Network Adapter VMnet1: This is the virtual network card that host uses to communicate with host-only virtual networks;
VMware Network Adapter VMnet8: This is the virtual NIC that host uses to communicate with the NAT virtual network;
One, bridge network:
In bridging mode, VMware's virtual operating system is like a separate host in a local area network that can access any machine in the network. However, you need more than one IP address, and you need to manually configure the virtual system IP address, subnet mask, and the host machine in the same network segment, so that the virtual system can communicate with the host machine. If you want to use VMware to create a new virtual server within the LAN, to provide network services for LAN users, you should choose bridging mode.
Virtual machines can be emulated to the local area network where the host is located.
Second, NAT network:
In a NAT network, a VMnet8 Virtual switch is used, and the VMware network Adapter VMnet8 virtual network card on host is connected to the VMNET8 switch to communicate with the guest, but the VMware network Adapter VMnet8 Virtual network card is only used for communication with the VMNET8 network segment, it does not provide the routing function for the VMNET8 network segment, the guest under the virtual NAT network is connected to the Internet using Virtual NAT server.
At this point, your guest and host will be able to exchange visits, and if your host is connected to the Internet at this time, your guest will be able to connect to the Internet. So what role does the VMware network Adapter VMnet8 virtual network card play here? It simply provides an interface for guest communication under the host and NAT virtual networks, so even if the disable off the virtual network card, guest is still able to surf the internet, but host can no longer access the VMNET8 network segment.
This way, the host needs to turn on the VMDHCP and Vmnat services.
Using NAT mode, the virtual system uses the NAT (network address translation) function to access the public network through the network where the host machine resides. In other words, the use of NAT mode enables access to the Internet in virtual systems. The TCP/IP configuration information for a virtual system in NAT mode is provided by the DHCP server of the VMNET8 (NAT) virtual network and cannot be modified manually, so the virtual system cannot communicate with other real hosts on the local area network. The biggest advantage of using NAT mode is that virtual system access to the Internet is very simple, you do not need to do any other configuration, only the host machine can access the Internet. If you want to use VMware to install a new virtual system, you can directly access the Internet without any manual configuration in the virtual system, it is recommended that you use NAT mode.
Third, host-only
In some special network debugging environments, it is required to isolate the real environment from the virtual environment, then you can use the host-only mode. In host-only mode, all virtual systems can communicate with each other, but virtual systems and real networks are isolated. You can take advantage of the Internet Connection Sharing that comes with Windows XP (which is actually a simple routing nat) to allow the virtual machine to access the network through the host's real network card. The TCP/IP configuration information (such as IP address, gateway address, DNS server, etc.) of the virtual system is dynamically allocated by the DHCP server of the VMNET1 (host-only) virtual network. If you want to use VMware to create a virtual system that is isolated from other machines in the network, you can choose Host-only mode for some special network debugging work.
In the Host-only network, the Host-only network is designed to be a network isolated from the outside world, in fact Host-only Network and NAT network very similar, the only difference is in the Host-only network, no use of NAT service, There is no server for VMnet1 to route, of course, there is no way to access the Internet, but if my host to communicate with guest. What to do. That's right. Of course, the VMware network Adapter VMnet1 This virtual network card is used.
As you can see, under the Host-only network, the default gateway of guest is set to NULL, because the virtual NAT server is not used, but even if you use the route add command to add an address to make its route, It still does not have access to the Internet (in fact there is no address to add). In this way, my guest has no way to access the Internet, but can still communicate with my host:
Implementation, if we are enough BT, can also be on the host for the VMware Network Adapter VMnet1 virtual network card to do the route, for example, we can use the Windows 2000 RRAS to do so, Guest on the Host-only network will be able to surf the internet again, they only need to use the route add command to change their default gateway to the VMware Network Adapter VMNET1 network card, but it is not recommended, there is no need
If you just want the virtual machine to access the Internet, the NAT method is the simplest, basically do not need to do anything, you can automatically connect. This is also the default setting parameter.
As developers, we usually need hosts, virtual machines, boards with separate addresses and access to each other. Then we can use the following two kinds of network configuration method,
Bridge and Host-only.
Bridging is the simplest way, generally you have a gateway, your Windows host and your VMware's various unix/linux systems, all through this gateway to communicate.
In the case of hosts, the Windows host operating system can communicate properly with the guest operating system on VMware virtual machines without a network. As we can see from VMware's Virtual Network edit, Vnet0 is used to implement bridging mode, and Vnet1 is used to implement host mode. The host and client are communicating directly through VNET1.
In the host mode, the Windows host operating system does not need to configure what, we open cmd.exe, enter ipconfig, we know VMNET1 IP address is what, because this IP is the VMware virtual machine on the client operating system gateway IP address. My VMware virtual machine is generally loaded with Redhat, because the Linux family Redhat is the most common, the company with SuSE, Slaceware,unix use Solaris,freebsd. Then we configure the network on the guest operating system, the main note is that the IP of the gateway is the IP address of the VMNET1 that you see in the Windows host operating system with the ipconfig command.
For example: I windowsxp under the host with ipconfig see VMNET1 IP address is 192.168.159.1, that I in Redhat in the gateway IP configuration For 192.168.159.1, configure the IP of the Redhat to 192.168.159.2. We ping 192.168.159.2 from the windowsxp host Cmd.exe, if Redhat start the sshd server, we can telnet 192.168.159.2 22, if the connection is successful all installation OK, Indicates that we have no problem connecting the Redhat system from the WindowsXP host. Conversely, how we connect the windowsxp host from the Redhat system, from the Redhat system point of view, VMnet1 IP address is the address of the WindowsXP host, Ping Redhat in the 192.168.159.1 system, and then Telnet 192.168.159.1 139, if the connection is successful, everything is installed OK, indicating that we have no problem connecting the WindowsXP host from the Redhat system.
A good way to learn about Unix/linux on C/D + + development or something else is to install VMware on a Windows system, and then mount a variety of unix/linux systems in the WMware to connect unix/through shell tools such as CRT, WINSCP, etc. Linux system, so that it is not easy to do other things without Windows system, but also to install a variety of unix/linux systems on a single PC machine.