In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
There are three network modes for VMware virtual machines, namely, Bridged (bridging mode), NAT (network address translation mode) and Host-only (host mode).
After VMware workstation is installed, there will be two more network connections, VMware Network Adapter VMnet1 and VMware Network Adapter VMnet8, which can be found in the network connection of the host, and the other is VMnet0, which can be seen in virtual network editor. These three virtual networks are automatically generated after VMware is installed and do not need to be modified manually. VMnet0 is used in Bridged mode, VMnet1 is used in Host-only mode, and Vmnet8 is used in NAT mode. VMnet8 and VMnet1 provide DHCP services, while VMnet0 does not.
1. Bridged (bridging mode)
In this mode, the VMWare virtual operating system is like an independent host in the local area network. It can access any machine in the network. You need to manually configure the IP address and subnet mask for the virtual system, and be in the same network segment with the host machine, so that the virtual system can communicate with the host machine. The relationship between the virtual system and the host machine is like two computers connected to the same Hub. In terms of network technology, it is equivalent to adding a virtual switch at the front end of the host, and then the host and all virtual machines share the switch.
If you want to use VMWare to build a new virtual server in the LAN to provide network services for LAN users, you should choose the bridging mode.
1.1. Network settings in bridging mode
The following is a demonstration of the network settings in bridging mode, the virtual software VMware workstation 9, the host system win8, and the virtual machine system centos 6.4.
(1) check whether the VMwareBridge Protocol option in the local network connection attribute is checked. It is automatically checked when Vmware is installed by default, as shown in the following figure.
Figure (1)
(2) the virtual machine network is set to bridge:
Figure (2)
(3) query the network parameters of the host and enter ipconfig on the command line. The parameters are as follows:
Figure (3)
(4) modify the network configuration in the centos virtual machine mainly in the / etc/sysconfig/network-scripts/ifcfg-eth0 file, which is modified as follows:
Figure (4)
The meanings of the parameters are as follows:
DEVICE is the name of the network card
BOOTPROTO is the type of ip address obtained, static and none are static addresses, and dhcp is to dynamically obtain ip addresses.
HWADDR is the MAC address
MTU is the largest transmission unit
Whether NM_CONTROLLED enables the NetworkManager graphical interface configuration tool
ONBOOT sets whether the network card is activated when the Linux system starts. This item is generally set to yes.
IPADDR is the native ip address
NETMASK is the subnet mask
GATEWAY is used to set the gateway
DNS1 is the preferred DNS server
Secondary DNS server when DNS2
There are also several parameters that do not need to be configured in general:
BROADCAST is the broadcast address
NETWORK is the subnet address
In the above parameters, the IPADDR should be on the same IP address range as the host IP, and the GATEWAY default gateway should be the same as the host.
Restart the network service after modifying the network parameter file. The command is service network restart as follows:
Figure (5)
In general, after the above configuration, the host and the virtual machine can communicate. If the dns is configured, the virtual machine can also access the public network.
If the host cannot ping the virtual machine, you can check whether the configuration files related to the ICMP protocol are enabled in the inbound rules of the host's firewall.
2. NAT (Network address Translation Mode)
Using NAT mode is to let the virtual system access the public network through the network where the host is located with the help of the function of NAT. In this mode, the host becomes a dual network card host and participates in both the existing host local area network and the newly built virtual local area network, but due to the addition of a virtual NAT server, the virtual machines in the virtual local area network use the IP address of the host host when accessing to the outside. From the external network, only the host can be seen, but the newly built virtual local area network can not be seen at all.
The biggest advantage of using NAT mode is that the virtual system is very easy to access the Internet, you do not need to make any other configuration, only the host machine can access the Internet.
If you want to use VMWare to install a new virtual system in which you can directly access the Internet without any manual configuration, it is recommended that you use NAT mode.
2.1Network settings in NAT mode
(1) check whether the VMware DHCP Service and VMwareNAT Service services of the host are started:
Figure (6)
(2) the virtual machine network settings are as follows:
Figure (7)
(3) Virtual Network Editor setting
After VMware is installed, you can click Virtual Network Editor in Edit on the menu bar to modify the configuration of the virtual network card.
Figure (8)
You can see that there are three default virtual network cards, and the VMnet8 network card is used in NAT mode, and you can add and remove network cards on your own.
VMnet8 provides DHCP services by default, so the virtual machine does not need to set up IP manually. NAT and DHCP services can also be modified in the Virtual Network Editor interface, but in general we do not need to modify the configuration.
(4) Network configuration in virtual machine
Because NAT has a DHCP service, we just need to set the BOOTPROTO parameter to dhcp, and the dhcp server assigns the IP address. The default parameters are as follows:
Figure (9)
By default, neither the configuration of VMware nor the virtual machine needs to be modified, so the NAT mode is the simplest.
Ps: after I have configured the NAT mode, the virtual machine can ping the host, but the host cannot ping the virtual machine. I don't understand this at the moment, or can the host not access the virtual machine in NAT mode?
3. Host-only (host mode)
In some special network debugging environment, it is required to separate the real environment from the virtual environment, then you can use host-only mode, in which all virtual machines on the host can communicate with each other, but the virtual machine and the real network are isolated.
In this mode, a new local area network consisting of all virtual machines and hosts is built, but the local area network and the existing local area network where the host itself is located are independent of each other. If no additional routing settings are made, the two Lans will not be connected, so the new LAN can be regarded as a separate private network subordinate to the current host, and its members are the current host and all related virtual machines.
In terms of network technology, it is equivalent to adding a virtual network card to the host, turning the host into a dual network card host (host network card + virtual network card). At the same time, a virtual switch is added to the back end of the host, so that the host and all virtual institutions form another virtual local area network. Because of the dual network cards, the host can participate in both Lans (the existing host LAN + the new virtual LAN), but the two Lans are not connected by default.
If you want to use VMWare to create a virtual system that is isolated from other machines in the network and do some special network debugging work, you can choose host-only mode.
3.1Network settings in Host-only mode
(1) the virtual machine network settings are as follows:
Figure (10)
(2) Virtual Network Editor setting
Figure (11)
In the virtualnetwork editor interface in the figure above, we can see that the VMnet1 Nic is responsible for the Host-only mode. VMnet1 provides DHCP services, so we do not need to manually configure IP in the virtual machine.
In fact, the network configuration in Host-only mode is also very simple. In general, the network settings in the virtual machine do not need to be modified and can be obtained automatically.
After configuration, the host can ping the virtual machine, but be careful when the virtual machine ping the host. It is not the IP address generated by the host network card ping, but the IP address generated by the virtual network card VMnet1. Enter ipconfig in the host command line to see the generated IP address of VMnet1, as shown in the following figure:
Figure (12)
Virtual machine ping host:
Figure (13)
Host ping virtual machine:
Figure (14)
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.