Before introducing network mode, the use of several simple commands about the network
Ifup eth0//start NIC Eth0
Ifdown eth0//Turn off the NIC Eth0
/etc/network/interfaces//Network configuration file
/etc/init.d/networking//Network service location
/etc/init.d/networking Restart//Restart Network
/etc/resolv.conf//dns configuration file
Ifconfig eth0 192.168.5.111//Reconfigure IP for NIC Eth0
Simple introduction to one or three modes
VMware offers three modes of operation, which are bridged (bridging mode), NAT (network address translation mode), and host-only (host mode). To properly apply them in network management and maintenance, you should first look at these three modes of work.
1, bridged (bridge mode)
In this mode, the VMware virtual operating system is like a separate host in the LAN, which can access any machine in the network. In bridging mode, you need to manually configure the virtual system with an IP address, subnet mask, and a host machine in the same network segment so that the virtual system can communicate with the host machine. At the same time, because this virtual system is a separate host system in the LAN, it is possible to manually configure its TCP/IP configuration information to enable access to the Internet through a LAN gateway or router.
The relationship between a virtual system using bridging mode and a host machine is like two computers connected to the same hub. To make them communicate with each other, you need to configure the IP address and subnet mask for the virtual system, or you will not be able to communicate.
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.
2, Host-only (host mode)
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.
Note: In host-only mode, the virtual system and the host machine system can communicate with each other, which is equivalent to the two machines connected by twisted pair wires.
In host-only mode, 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.
3. NAT (network address translation mode)
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 VMware The network Adapter VMNET8 virtual network card is used only for communication with the VMNET8 segment and does not provide routing for the VMnet8 segment, and guest under the virtual NAT network is connected to the Internet using a 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.
Hint: The above mentioned NAT mode VMnet8 virtual network, VMNET1 virtual network in host-only mode, and VMnet0 virtual network in bridged mode are all generated by the automatic configuration of VMware virtual machine and do not need to be set by the user. VMnet8 and VMNET1 provide DHCP services, and VMNET0 virtual networks do not provide
Essential differences between the two or three models
Network mode
Let's start by talking about several VMware virtual devices
VMNET0: Virtual Switch for virtual bridging network
VMNET1: Virtual Switch for Virtual Host-only network
VMNET8: Virtual Switch for virtual NAT network
VMware Network adepter vmnet1:host Virtual network card for communication with host-only virtual networks
VMware Network adepter vmnet8:host Virtual network card for communication with NAT virtual networks
When a VMware virtual machine is installed, two more virtual network cards are created in the Network Connections dialog box.
1) Bridging network mode
Bridging network refers to the local physical network card and the virtual network card through the VMNET0 Virtual switch for bridging, physical network cards and virtual network cards on the topological map on the same status (virtual network card is neither Adepter VMnet1 nor Adepter VMnet8).
The VMnet0 here is the equivalent of a switch, which ends up in a network segment through this virtual switch.
Then the physical network card and the virtual network card are equivalent to the same network segment, the virtual switch is the equivalent of a real-world switch. Therefore, the IP address of the two network card should also be set to the same network segment.
If you make the virtual machine connect to the network using bridging mode, you can see that the IPV4 IP and virtual machine are in a network segment after you run the cmd command to look at two IPs.
The IP addresses of the physical and virtual network cards are in the same network segment, with the same parameters as subnet masks, gateways, and DNS. Two network cards are relatively independent in the topology.
Bridged network mode is the simplest and most straightforward mode in VMware virtual machines. It is the default option when you install a virtual machine.
In bridged mode, the virtual machine is in the same position as the host computer, and the virtual machine is like a real host in a local area network. So in bridging mode, we're going to configure IP, gateways, subnet masks, and so on, just like other real computers. When we can freely allocate the LAN IP, the bridge mode can be used to virtual a real host.
2) Nat mode
In a NAT network, VMware is used Network adepter VMnet8 Virtual network card, the VMware network adepter VMnet8 virtual network card on the host is connected directly to the VMNET8 virtual Switch to communicate with the virtual network card.
the VMware network adepter VMnet8 Virtual network card is limited to communicating with the VMNET8 segment, and it does not provide routing capabilities to the VMNET8 segment, so the virtual machine is virtual to a NAT server so that the virtual network card can connect to the Internet. In this case, we can use the port mapping feature to have the request to access the host port map to the virtual machine on port 80.
The IP address of the VMware network adepter VMnet8 Virtual network card is specified by the system when installing VMware, we do not modify this value, otherwise the host and the virtual machine will not be able to communicate.
Virtual network segment and NAT mode virtual network card network segment is the same, both 192.168.111.X, including the NAT server IP address is also this network segment. A virtual DHCP server is also generated after VMware is installed, assigning an IP address to the NAT server.
The VMware Network adepter VMnet8 Virtual network card is called when the host and the virtual machine are communicating, because they are in a network segment, so communication is not a problem.
In fact, the role of the VMware network adepter VMnet8 Virtual network card is to provide an interface for the communication between the host and the virtual machine, even if the host's physical network card is turned off, the virtual machine can still connect to the Internet, but the host and the virtual machine cannot exchange visits.
In NAT mode, the host computer is the equivalent of a DHCP-enabled router, and the virtual machine is a real host in the intranet, which dynamically obtains network parameters through the router (host computer) DHCP. Therefore, in NAT mode, the virtual machine can access the external network, and vice versa, because the virtual machine belongs to the intranet. The convenience of using NAT mode is that we do not need to make any network settings, as long as the host computer can connect to the external network and the virtual machine can. Nat mode is often the most common connection mode for the university campus network VMware, because we generally only have one external IP. Obviously, in this case, it is well suited to use NAT mode.
3) host-only mode
in host-only mode, the virtual network is a fully enclosed network, and the only access to it is the host. In fact, Host-only Network and NAT network is very similar, the difference is that the Host-only network does not have NAT service, so the virtual network can not connect to the Internet. Communication between the host and the virtual machine is achieved through the VMware network adepter VMnet1 virtual network card.
As with NAT, the IP address of the VMware network adepter VMNET1 Virtual network card is also specified by the VMware system, and the IP address of the virtual DHCP server and virtual network card generated is located in the same segment, but the IP address of the physical network card is not the same network segment.
Host-only's aim is to create an internal network that is isolated from the outside world to improve the security of the intranet. This feature may not make much sense to ordinary users, but large service chambers often take advantage of this feature. If you want to provide routing for the VMnet1 network segment, you will 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 will not assign this address to the VMNET1 virtual network card. Then there is no communication between the host and the virtual machine.
In host-only mode, the virtual machine is connected directly to the host computer through the twisted pair and the host computer does not provide any routing services. Therefore, in host-only mode, virtual machines can access each other from the host computer, but the virtual machine cannot access the external network. When we want to form a virtual network that is isolated from the physical network, it is definitely a good fit to use Host-only mode
(go) The difference between the Linux virtual machine and the host three kinds of network connection mode