Host: Win10;
VM version: Vmware®workstation Pro;
Virtual machine system: CentOS Linux Release 7.4.1708
The host system automatically creates two new network adapters after the VM is installed: Vmnet0,vmnet8
Vmnet0, in fact, is a virtual network bridge.
Vmnet0, in fact, is a virtual network bridge, which has a number of ports, a port used to connect your host, a port to connect your virtual machine, their location is Peer-to-peer, who is not who's gateway. So in bridged mode, you can make a virtual machine the same status as your host machine.
Vmnet1, this is a host-only network model
Vmnet1, this is a host-only network model, which is used to build an isolated network environment, where Vmnet1 is also a virtual switch, one port of the switch is connected to your host, The other port is connected to the virtual DHCP server (which is actually a component of VMware), and the remaining port is the virtual machine. The virtual NIC "VMWare virtual Ethernet Adapter for VMnet1" serves the virtual machine as a gateway interface to the virtual machine. After the virtual machine is started, if you use the ipconfig command, you will clearly see that your default gateway is the address of the "VMWare Virtual Ethernet Adapter for VMnet1" network card. (It doesn't actually provide a route, it's a VMware design, it's doing something other than providing a route-actually I don't know what it does), and there's no routing here that doesn't provide NAT service, Allows a virtual machine to access an address other than the network segment specified in the host-only mode.
Vmnet8, this is a NAT way, the simplest way of networking
Vmnet8, this is a NAT way, the simplest way of networking, from the host "VMWare virtual Ethernet Adapter for VMnet8" virtual network card, connected to the VMNET8 virtual switch, The other port of the virtual switch is connected to the Virtual NAT server (this is also a VMware component), and one port is connected to the virtual DHCP server, the other is the virtual machine, the virtual machine gateway is "VMWare virtual Ethernet Adapter for VMnet8 "The machine where the network card resides, nonsense, this must be your host machine." Also, as you can see with ipconfig, your virtual machine's default gateway also points to your "VMWare virtual Ethernet Adapter for VMnet8" virtual network card address. In contrast, it can be seen that NAT networking and host-only way, the difference is whether a more NAT service.
One of the VMnet1 automatically hidden reasons, mainly used is VMnet8;
Steps:
1, view the VM Host network configuration:
Edit-> Virtual Network editor->nat settings
2, configure host VMNET8 IP:
The IP address and the virtual machine must be the same IP segment;
3, configure the virtual machine IP:
The CentOS I installed has no eth0, so I need to create a new file
Configuration content:
Device=eth0
bootproto=static
hwaddr=00:0c:29:bb:11:ae
nm_controlled=yes
onboot=yes
TYPE= Ethernet
ipaddr=192.168.36.22
netmask=255.255.255.0
gateway=192.168.36.2
# If you have Problems with gated making 127.0.0.0/8 a Martian, # your can change this to
something else (255.255.255.255, for Exampl e)
broadcast=127.255.255.255
name=loopback
dns1=192.168.36.2
Mainly configuration gateway, IP address (ipaddr), DNS (DNS1)
4, start eth0 network card:
Ifup eth0
5. Tests
Ping a gateway, host machine, www.baidu.com on a virtual machine
[root@localhost network-scripts]# ping 192.168.36.2
ping 192.168.36.2 (192.168.36.2) bytes of data.
Bytes from 192.168.36.2:icmp_seq=1 ttl=128 time=0.112 ms bytes from
192.168.36.2:icmp_seq=2 ttl=128 Ms
bytes from 192.168.36.2:icmp_seq=3 ttl=128 time=0.208 ms-bytes from
192.168.36.2:icmp_seq=4 ttl=128 ti me=0.269 ms
bytes from 192.168.36.2:icmp_seq=5 ttl=128 time=0.252 ms
[root@localhost network-scripts]# ping www.baidu.com
ping www.a.shifen.com (14.215.177.38) bytes of data.
Bytes from 14.215.177.38 (14.215.177.38): icmp_seq=1 ttl=128 time=9.71 ms-bytes from
14.215.177.38 (14.215.177.3 8): icmp_seq=2 ttl=128 time=10.8 ms
bytes from 14.215.177.38 (14.215.177.38): icmp_seq=3 ttl=128-time=12.2 Ms
Bytes from 14.215.177.38 (14.215.177.38): icmp_seq=4 ttl=128 time=8.72 ms
This LAN configuration was successful