Fundamentals
There are three modes of communication in the virtual machine, as shown in the following illustration
1. Bridged (bridging mode)
In bridging mode, VMware Virtual operating system is like a stand-alone host in the LAN, it can access any machine in the network but you need more than one IP address, and you need to manually configure the virtual system IP address subnet mask, but also with the host machine in the same network segment, So that the virtual system can communicate with the host machine.
If you want to use VMware to create a new virtual server in your local area network, you should choose the bridge mode to provide Internet service for LAN users.
2. NAT (network address translation mode)
Using NAT mode, the virtual system uses NAT (network address translation) to access the public network through the network where the host machine is located. That is to say, using NAT mode can implement TCP/IP configuration information for virtual systems accessing Internet NAT mode in virtual systems by VMnet8 (NAT) Provided by the DHCP server of the virtual network, can not be manually modified, so the virtual system will not be able to communicate with the other real host in the local area network, using NAT mode the biggest advantage is that the virtual system access to the Internet is very simple, you do not need any other configuration, only the host machine to access the Internet can be
If you want to use VMware to install a new virtual system, in the virtual system without any manual configuration can directly access the Internet, we recommend that you use NAT mode
3. Host-only (host mode)
In some special network debugging environments, the need to isolate the real environment and the virtual environment, you can use the Host-only mode in the host-only mode, all the virtual systems can communicate with each other, but the virtual system and the real network is isolated can use Windows XP has its own Internet connection share (actually a simple route NAT) to allow the virtual machine to access the virtual system's TCP/IP configuration information (such as IP address gateway address DNS server, etc.) through the real network card of the host, all by VMnet1 (host-only) The DHCP server for the virtual network to dynamically allocate
If 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, you can choose Host-only mode
NAT Mode Configuration
The configuration method of NAT (static IP)
1 Ensure that the network card of the virtual machine is normal. Select Edit-virtunal Network Editor
2 Check the network card properties to ensure that the status of the VMNET8 host Connection (host connection) is connected. If you do not have a connection, you can click the Restore Default button in the lower left corner to restore the defaults.
3 Click the NAT Settings button to view the gateway to 192.168.84.2. Write down the gateway at this time and prepare for the configuration that follows.
4 Enter the virtual machine, modify the eth0 configuration information
[root@testateway=192 ~]# vi/etc/sysconfig/network-scripts/ifcfg-eth0
bdevice=eth0
HWADDR=00:0C:29:7F:EF : 4C
type=ethernet
uuid=34adef05-91e5-4f4a-9776-df983b2a8787
onboot=yes
nm_controlled=yes
Bootproto=static
netmask=255.255.255.0
ipaddr=192.168.84.101
gateway=192.168.84.2
DNS1= 192.168.84.2
ipv6init=no
arpcheck=no
Make sure the following parameters are set
Onboot=yes
Nm_controlled=yes
Bootproto=static<span style= "White-space:pre" > </span>//static address
netmask=255.255.255.0
Ipaddr=192.168.84.101<span style= "White-space:pre" > </span>//Virtual machine IP address (optional)
gateway= 192.168.84.2<span style= "White-space:pre" > </span>//Gateway (consistent with previously seen gateways)
5 Restart Network Service after saving to ensure normal operation.
[root@testateway=192 ~]# Service network restart
shutting down interface eth0: [ OK ]
shutting Down 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 above
[root@testateway=192 ~]# ifconfig
eth0 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 network card information on host (WIN7 environment) Control Panel \ Network and internet\ network connection find "VMware network Adapter VMnet8" This network card
8 View the IPv4 property to change the default gateway to the same gateway as the virtual machine 192.168.84.2
9 Ping the address of the virtual machine in the command prompt line 192.168.84.101
C:\users\administrator>ping 192.168.84.101
is pinging 192.168.84.101 has 32 bytes of data:
reply from 192.168.84.101: Byte =32 Time =3ms ttl=64
reply from 192.168.84.101: bytes =32 time =1ms ttl=64
reply from 192.168.84.101: bytes =32 time <1ms
from 192. 168.84.101 reply: bytes =32 time <1ms ttl=64
192.168.84.101 Ping Statistics:
packet: Sent = 4, received = 4, lost = 0 (0% lost),
round trip estimate Count time (in milliseconds):
shortest = 0ms, longest = 3ms, average = 1ms
10 You can ping it now
After ping, you can use a tool such as Xshell to support the SSH protocol to connect the virtual machine, simplifying the operation.
virtual machine Internet Settings
1 in the current mode, check if you can ping the extranet. The following results show that you can ping
[root@testateway=192 ~]# ping baidu.com
ping baidu.com (220.181.111.86) bytes of data.
Bytes from 220.181.111.86:icmp_seq=1 ttl=128 time=7.75 ms bytes from
220.181.111.86:icmp_seq=2 ttl=128 .3 ms
bytes from 220.181.111.86:icmp_seq=3 ttl=128 time=9.57 ms-
bytes from 220.181.111.86:icmp_seq=4 ttl=1 time=8.38 ms
bytes from 220.181.111.86:icmp_seq=5 ttl=128 time=7.39, ms-bytes from
220.181.111.86:icmp_s eq=6 ttl=128 time=7.83 ms bytes from 220.181.111.86:icmp_seq=7 ttl=128, Ms time=7.16 from bytes
. 86:icmp_seq=8 ttl=128 time=91.2 ms
^c
---baidu.com ping statistics---
8 packets transmitted, 8 received, 0% packet loss, time 7194ms
RTT Min/avg/max/mdev = 7.163/23.834/91.244/29.166 ms
2 If it is the following result, Ping does not pass the extranet. Returns an unknown host name.
[root@testateway=192 ~]# Ping baidu.com
ping:unknown host baidu.com
3 If the virtual machine wants to be on the net, you need to modify the configuration information of the network card. Add a DNS address to the file, which is the same as the gateway.
[root@testateway=192 ~]# vi/etc/sysconfig/network-scripts/ifcfg-eth0
bdevice=eth0
HWADDR=00:0C:29:7F:EF : 4C
type=ethernet
uuid=34adef05-91e5-4f4a-9776-df983b2a8787
onboot=yes
nm_controlled=yes
Bootproto=static
netmask=255.255.255.0
ipaddr=192.168.84.101
gateway=192.168.84.2
<span style= "COLOR: #ff0000;" >DNS1=192.168.84.2</span>
ipv6init=no
arpcheck=no
4 Restart the Network service and ping the Extranet again. Find that you can ping the outside network at this time.
[root@testateway=192 ~]# Service network restart
shutting down interface eth0: [ OK ]
shutting Down loopback interface: [ OK ]
bringing up loopback interface: [ OK ]
bringing Up interface eth0: [ OK ]
[root@testateway=192 ~]# ping baidu.com
Ping baidu.com ( 220.181.111.86) bytes of data.
Bytes from 220.181.111.86:icmp_seq=1 ttl=128 time=7.64 ms bytes from
220.181.111.86:icmp_seq=2 ttl=128 . Ms
bytes from 220.181.111.86:icmp_seq=3 ttl=128 time=8.43 ms