Virtual machine and physical host visits, two machines can exchange visits and can be accessed by other machines in the LAN, can ping and can access the site.
These days there is a time to have a virtual machine, and installed a different system, in case of different deployment environment needs. Obviously is engaged in programming, but have to learn all kinds of knowledge, to better cooperation, thanks to the company's technical support to the Force, to help solve a lot of network problems and lack of resources.
Note:
1. Here the physical machine refers to your local computer, which is the virtual machine that you installed locally.
2. I use the virtual software: VMware Workstation 9
Statement
This article is partly from network integration, not original. If similar, do not spray. Learn from each other, communicate and share with each other.
How VMware networks are linked
Take a look at VMware's four network connectivity options:
1) Bridge: This is the simplest way, directly bridge the virtual network card to a physical network card, and Linux next network card binding two different address similar, in fact, the network card is set to promiscuous mode, so as to achieve the ability to listen to multiple IPs.
In this mode, the inside of the virtual Machine network card (for example, Linux under the eth0) directly connected to the network of physical network card, you can imagine that the virtual machine and host machine in a peer position, the network relationship is equal, no one who is behind the problem. It's easy to use this way, The premise is that you can get more than 1 addresses. For friends who want to do a variety of web experiments, because you can't control the network of virtual machines, it goes straight out.
2) Nat mode: In this way the host has a virtual network card Vmnet8 (by default), if you have a NAT server experience, the VMNET8 is equivalent to connect to the intranet network card, and the virtual machine itself is equivalent to run the network of the machine, the virtual machine inside the network card ( ETH0) is independent of vmnet8.
You will find that in this way, VMware's own DHCP is loaded into the Vmnet8 interface by default, so that the virtual machine can use the DHCP service. More importantly, VMware comes with a NAT service that provides address translation from the Vmnet8 to the extranet. So this is a real NAT server running, just for virtual machines. Obviously, if you have only one extranet address, this approach is appropriate.
3) Hostonly: This should be the most flexible way to be interested in a variety of network experiments. The only difference with NAT is that, in this way, there is no address translation service, so by default the virtual machine can only be accessed by the host, which is also the meaning of the hostonly name. By default, a DHCP service is also loaded onto vmnet1. This way the virtual machines connected to the VMNET8 can still be set to DHCP for easy system configuration.
Is this way there is no way to connect to the external network, of course, it is not, in fact, this way more flexible, you can use your own way to achieve the most ideal configuration, for example: a. Use your own DHCP service: first stop the VMware-brought DHCP service to make DHCP service more unified. B. Use your own NAT to make it easy to join a firewall. Windows host can do a lot of NAT, simple as a Windows XP Internet share, complex as the NAT service in Windows Server. C. Use your own firewall. Because you have complete control over the VMNET1, you can join (or experiment) the firewall between the VMNET1 and the extranet's network card.
As can be seen from the above, hostonly this mode is similar to the normal NAT server with the whole intranet, so you can easily carry out experiments related to it, such as fire-proof strong settings and other examples
When the virtual machine is installed, open the Physical machine Control Panel-"View network status can be seen as follows:
corresponding to virtual machine, edit "View virtual machine settings"
Let's see how to set it up.
1, bridge mode (everything is the same as host, only IP cannot be the same as host)
IP 192.168.x.y
netmask:255.255.252.0
Gateway:192.168.x.y
Primary nameserve:192.168.x.y
The IP settings of the virtual machine are not used with the host network segment, the rest is the same as the host:
For example, the host IP is 192.168.2.46, and the virtual machine IP is set to 192.168.2.254. Netmask,broadcast,gateway,dns both with the host
Virtual Machines <---> Host virtual machines <----> Internet communications
2. Nat Mode
First, view the VMnet8 IP (e.g. 192.168.255.1) in the physical machine. (see 1, Dot Network right-click property)
Start VMware, click the virtual network setting to eject the Virtual Network Editor dialog box;
Review the Nat tab and log the NAT
Gateway IP address:192.168.255.2 in config, fill in:
ip:192.168.255.5 (different addresses with 192.168.255.1 on the same network segment)
netmask:255.255.255.0 (same as 192.168.255.1 's hidden code)
Gateway IP: Complete the NAT Gateway in VMware 192.168.255.2
Primary nameserver: Fill in the same gateway as the host 192.168.39.252, so you can surf the Internet.
3. Hostonly mode
(1) Check the properties of your network card, select "Advanced" tab, set to allow sharing, and set the allowed network interface to VMNET1
(2) Plug in the properties of your VMnet1 and look at the settings of the TCP/IP protocol, and you find that it has been automatically set to 192.168.0.1/255.255.255.0,
(3) The settings under Windows are completed and transferred to the virtual machine running Linux. Set the IP address of your eth0 to static (if not selected at the time of installation).
Press the Red Hat icon-> System Settings-> Network (or other method you know) ip:192.168.0.2 (or other address on this segment) netmask:255.255.255.0
Default gateway:192.168.0.1 (VMnet1 's address)
DNS: Enter your own DNS (DNS in host)
Save the settings. If you haven't set the host name yet:
Cd/etc/sysconfig VI Network editor hostname CD/ETC VI hosts join:
192.168.0.2 yourhostname Restart Service su/sbin/service Network restart
(4) Test the gateway: ping 192.168.0.1 dns:ping dnsserver
Data reference:
VMware Network Configuration detailed: http://blog.sina.com.cn/s/blog_51dc0fba0100mo7z.html
VMware Network configuration implementation and physical machine visits