Basic principle
There are three ways to communicate in a virtual machine, such as the one you see
1. Bridged (bridging mode)
In bridging mode, VMware Virtual operating system is like a LAN in a separate host, it can access the network, no matter what a machine only you need more than one IP address, and need to manually configure the virtual system IP address subnet mask, and the host machine is in the same network segment, So the virtual system talent communicates with the host machine
Suppose you want to use VMware to create a new virtual server within your LAN to provide network services to LAN users. You should choose Bridging mode
2. NAT (network address translation mode)
Use NAT mode. is to let the virtual system use NAT (Network address translation) function, through the host machine on the network to access the public network in other words, using NAT mode can be real today virtual system in the Internet NAT mode of the virtual system of the TCP/IP configuration information is by VMnet8 (NAT) Provided by the dhcpserver of the virtual network. Cannot be changed manually, so the virtual system will not be able to communicate with the other real hosts in this LAN, the most advantage of using NAT mode is that virtual system access to the Internet is very easy. You don't need to do any other configuration, only the host machine can access the Internet
Suppose you want to use VMware to install a new virtual system. You can access the Internet directly without any manual configuration in the virtual system. We recommend that you use NAT mode
3. Host-only (host mode)
In some special network debugging environment, it is required to isolate the real environment and virtual environment, then you can use Host-only mode in host-only mode. All virtual systems are able to communicate with each other, but virtual systems and real networks are isolated and able to take advantage of the Internet Connection Sharing that comes with Windows XP (actually a simple routing NAT) to allow virtual machines to access the virtual system via the host's real network card tcp/ IP configuration information (such as IP address gateway address DNSServer, etc.) is dynamically allocated by the dhcpserver of the VMnet1 (host-only) virtual network.
Suppose you want to use VMware to create a virtual system that is isolated from other machines in the network, perform some special network debugging work, and be able to choose Host-only mode
Nat Mode Configuration
How to configure NAT (static IP)
1 Ensure that the network adapter for the virtual machine is healthy. Select Edit-virtunal Network Editor
2 Check the NIC properties to ensure that the status of VMnet8 host Connection (host connection) is connected. Suppose there is no connection on the bottom left corner that can be clicked to restore the default settings of Restore DefaultButton.
3 Click NAT Settingsbutton to be able to view the gateway as 192.168.84.2.
Make a note of the gateway at this point and prepare for the subsequent configuration.
4 Enter the virtual machine. Change configuration information for eth0
[Email protected]=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 that the following parameters such as the following settings
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 (any) Gateway=192.168.84.2<span style= " White-space:pre "></span>//Gateway (consistent with the previously seen Gateway)
5 Restart the Network service after saving. Ensure that it is enabled normally.
[Email protected]=192 ~]# service network restartshutting down interface eth0: [ OK ]shutting Loopback Interface: [ OK ]bringing up loopback interface: [ OK] ]bringing up interface eth0: [ OK ]
6 See if the IP address at this point is set as configured above
[[Email protected]=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 on the Host View Network card information (WIN7 Environment) Control Panel \ Network and internet\ network connection find the "VMware network Adapter VMnet8" This network card
8 View IPV4 Properties change the default gateway to match the gateway in the virtual machine 192.168.84.2
9 Ping the virtual machine address in the command prompt line 192.168.84.101
C:\users\administrator>ping 192.168.84.101 is pinging 192.168.84.101 with 32 bytes of data: Reply from 192.168.84.101: bytes =32 time =3ms ttl=6 4 Replies from 192.168.84.101: Byte =32 time =1ms ttl=64 reply from 192.168.84.101: bytes =32 time <1ms ttl=64 reply from 192.168.84.101: bytes =32 time < Ping statistics for 1ms ttl=64192.168.84.101: packet: Sent = 4, received = 4, lost = 0 (0% missing). Estimated time of round trip (in milliseconds): shortest = 0ms, maximum = 3ms, average = 1ms
10 You can ping through now
After pinging, you can use the SSH protocol, such as Xshell, to connect the virtual machine and simplify the operation.
Virtual Machine Internet Settings
1 in the current mode, check if you can ping the extranet. The following results indicate the ability to ping the
[[Email protected]=192 ~]# Ping baidu.comping baidu.com (220.181.111.86)] 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 statist ICS---8 packets transmitted, 8 received, 0% packet loss, time 7194msrtt Min/avg/max/mdev = 7.163/23.834/91.244/29.166 ms
2 assume that the following results indicate that the ping does not pass the extranet. Returns the unknown host name.
[[Email protected]=192 ~]# Ping Baidu.comping:unknown host baidu.com
3 If the virtual machine wants to sisu the network, it needs to change the network card configuration information.
Add a DNS address to the file. And the gateway is also available.
[Email protected]=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 outside network again. It is possible to ping the outside network at this time.
[Email protected]=192 ~]# service network restartshutting down interface eth0: [ OK ]shutting Loopback Interface: [ OK ]bringing up loopback interface: [ OK] ]bringing up interface eth0: [ OK ] [[Email protected]=192 ~]# Ping baidu.comping baidu.com (220.181.111.86)] 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
VmWare communicates with host hosts step by step (for people who have just started learning)