Step-by-Step communication between VmWare and the host (for beginners)

Source: Internet
Author: User

Step-by-Step communication between VmWare and the host (for beginners)

Basic Principles

There are three communication methods in the virtual machine, as shown in

1. Bridged (Bridging Mode)

In the bridge mode, the Virtual Operating System of VMware is like an independent host in the LAN. It can access any machine in the network, but you need more than one IP address, you also need to manually configure the IP address subnet mask for the virtual system, and also need to be in the same network segment as the host machine, so that the virtual system can communicate with the host machine

If you want to use VMware to create a virtual server in the LAN to provide network services for LAN users, you should select the bridge mode.

2. NAT (network address translation mode)

The NAT mode enables the virtual system to use the NAT (Network Address Translation) function to access the public network through the network where the host machine is located. That is to say, in NAT mode, you can access the TCP/IP configuration information of the Virtual System in Internet-based NAT mode. It is provided by the DHCP server of the VMnet8 (NAT) virtual network, as the virtual system cannot be manually modified, it cannot communicate with other real hosts in the Local Area Network. The biggest advantage of using NAT mode is that it is very easy to connect the virtual system to the Internet, you do not need to perform any other configuration. You only need the host machine to access the Internet.

If you want to use VMware to install a new virtual system, you can directly access the Internet without manual configuration in the virtual system. We recommend that you use the NAT mode.

3. Host-only (Host Mode)

In some special network debugging environments, you must isolate the real environment from the virtual environment. In this case, you can use the Host-only mode in the Host-only mode, all virtual systems can communicate with each other, however, the virtual system and the real network are isolated and can be shared using the Internet connection provided in Windows XP (in fact, it is a simple route NAT) to allow virtual machines to access the virtual system through the Host's real network card TCP/IP configuration information (such as the IP address gateway address DNS server), all by VMnet1 (Host-only) DHCP servers in the virtual network for Dynamic Allocation
 

If you want to use VMware to create a virtual system isolated from other machines in the network and perform some special network debugging, you can select the Host-only mode.

NAT configuration

NAT (static IP) configuration method

1. Ensure that the NIC of the VM is normal. Select Edit-Modify unal Network Editor

2. Check the NIC properties to make sure that the VMnet8 Host Connection status is Connected. If there is no connection, click the Restore Default button in the lower left corner to Restore the Default settings.

3. Click the NAT Settings button to check that the gateway is 192.168.84.2. Write down the gateway at this time to prepare for the subsequent configuration.

4. log on to the VM and modify the eth0 configuration.

[root@TESTATEWAY=192 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0BDEVICE=eth0HWADDR=00:0C:29:7F:EF:4CTYPE=EthernetUUID=34adef05-91e5-4f4a-9776-df983b2a8787ONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=staticNETMASK=255.255.255.0IPADDR=192.168.84.101GATEWAY=192.168.84.2DNS1=192.168.84.2IPV6INIT=noARPCHECK=no
Make sure the following parameters are set as follows:
ONBOOT=yesNM_CONTROLLED=yes
BOOTPROTO = static <span style = "white-space: pre"> </span> // static address NETMASK = 255.255.255.0IPADDR = 192.168.84.101 <span style = "white-space: pre "> </span> // Virtual Machine IP address (random) GATEWAY = 192.168.84.2 <span style =" white-space: pre "> </span> // Gateway (consistent with the gateway shown earlier)
5. Restart the network service after saving and ensure that the service is enabled properly.
[root@TESTATEWAY=192 ~]# service network restartShutting down interface eth0:                              [  OK  ]Shutting down loopback interface:                          [  OK  ]Bringing up loopback interface:                            [  OK  ]Bringing up interface eth0:                                [  OK  ]
6. Check whether the IP address is set as configured above.
[root@TESTATEWAY=192 ~]# ifconfigeth0      Link encap:Ethernet  HWaddr 00:0C:29:7F:EF:4C            inet addr:192.168.84.101  Bcast:192.168.84.255  Mask:255.255.255.0          inet6 addr: fe80::20c:29ff:fe7f:ef4c/64 Scope:Link          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1          RX packets:448 errors:0 dropped:0 overruns:0 frame:0          TX packets:223 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:1000           RX bytes:39552 (38.6 KiB)  TX bytes:19385 (18.9 KiB)          Interrupt:19 Base address:0x2000 lo        Link encap:Local Loopback            inet addr:127.0.0.1  Mask:255.0.0.0          inet6 addr: ::1/128 Scope:Host          UP LOOPBACK RUNNING  MTU:65536  Metric:1          RX packets:0 errors:0 dropped:0 overruns:0 frame:0          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:0           RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
7. Check the NIC information on the host machine (WIN7 Environment). Find the [VMware Network Adapter VMnet8] Nic Under Control Panel \ Network and Internet \ Network connection.



8. Check the IPv4 attribute and change the default gateway to 192.168.84.2 consistent with the gateway in the virtual machine.

9. ping the VM address 192.168.84.101 in the command prompt line.

C: \ Users \ Administrator> ping 192.168.84.101 pinging 192.168.84.101 with 32 bytes of data: reply from 192.168.84.101: byte = 32 time = 3 ms TTL = 64 reply from 192.168.84.101: byte = 32 time = 1 ms TTL = 64 replies from 192.168.84.101: byte = 32 time <1 ms TTL = 64 replies from 192.168.84.101: bytes = 32 time <1 ms TTL = 64192.168.84.101 Ping statistics: Packet: Sent = 4, received = 4, lost = 0 (0% lost ), estimated round-trip time (in milliseconds): Minimum = 0 ms, maximum = 3 ms, average = 1 ms
10 In this case, the ping command is successful.

After ping, you can use tools such as Xshell that support the SSH protocol to connect to the virtual machine to simplify the operation.


VM Internet access settings

1. In current mode, check whether the ping operation can be performed on the Internet. The following results indicate that ping is successful.

[root@TESTATEWAY=192 ~]# ping baidu.comPING baidu.com (220.181.111.86) 56(84) bytes of data.64 bytes from 220.181.111.86: icmp_seq=1 ttl=128 time=7.75 ms64 bytes from 220.181.111.86: icmp_seq=2 ttl=128 time=51.3 ms64 bytes from 220.181.111.86: icmp_seq=3 ttl=128 time=9.57 ms64 bytes from 220.181.111.86: icmp_seq=4 ttl=128 time=8.38 ms64 bytes from 220.181.111.86: icmp_seq=5 ttl=128 time=7.39 ms64 bytes from 220.181.111.86: icmp_seq=6 ttl=128 time=7.83 ms64 bytes from 220.181.111.86: icmp_seq=7 ttl=128 time=7.16 ms64 bytes from 220.181.111.86: icmp_seq=8 ttl=128 time=91.2 ms^C--- baidu.com ping statistics ---8 packets transmitted, 8 received, 0% packet loss, time 7194msrtt min/avg/max/mdev = 7.163/23.834/91.244/29.166 ms
2. If the following result is returned, the ping to the Internet fails. Returns an unknown host name.
[root@TESTATEWAY=192 ~]# ping baidu.comping: unknown host baidu.com
3. If the VM wants to access the Internet, you need to modify the NIC configuration information. Add the DNS address to the file, which is the same as that of the gateway.
[root@TESTATEWAY=192 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0BDEVICE=eth0HWADDR=00:0C:29:7F:EF:4CTYPE=EthernetUUID=34adef05-91e5-4f4a-9776-df983b2a8787ONBOOT=yesNM_CONTROLLED=yesBOOTPROTO=staticNETMASK=255.255.255.0IPADDR=192.168.84.101GATEWAY=192.168.84.2<span style="color:#ff0000;">DNS1=192.168.84.2</span>IPV6INIT=noARPCHECK=no
4. Restart the network service and ping the Internet again. You can ping the internet.
[root@TESTATEWAY=192 ~]# service network restartShutting down interface eth0:                              [  OK  ]Shutting down loopback interface:                          [  OK  ]Bringing up loopback interface:                            [  OK  ]Bringing up interface eth0:                                [  OK  ][root@TESTATEWAY=192 ~]# ping baidu.comPING baidu.com (220.181.111.86) 56(84) bytes of data.64 bytes from 220.181.111.86: icmp_seq=1 ttl=128 time=7.64 ms64 bytes from 220.181.111.86: icmp_seq=2 ttl=128 time=8.44 ms64 bytes from 220.181.111.86: icmp_seq=3 ttl=128 time=8.43 ms

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.