Several network connection methods under VMWare virtual machine under Linux and file transfer with windows

Bridging method:

Need to configure an IP address (will occupy an IP) and subnet mask

The VMnet0 network card (real network card) used can communicate with other computers on the same network segment in the local area network, and can connect to the external network, which can be understood as a truly independent computer.

 

Device Status --> Connected must be checked.

 

Since the notebook generally has a wireless network card and a wired network card, even if the virtual machine network address is set correctly and the IP of the real machine is on the same network segment, it cannot communicate with the host computer. You can try to adjust the configuration according to the following methods.

Edit-->Virtual Network Editor-->VMnet0 Bridge Mode-->Bridge to Change "Automatic" to the corresponding "Wired Network Card (Plug-in Internet Access)" or "Unlimited Network Card (Unlimited Network Card Internet Access)".

 

NAT (Network Address Translation) mode:

1. In the local area network environment, the operating system IP in the virtual machine can be the same as that of others and will not conflict.

2. You can not configure an IP address (assign an IP in the virtual DHCP server), or you can define your own IP address

3. The VMnet8 virtual network card is used, which can only communicate with the host (cannot communicate with other computers on the same network segment in the LAN)

If the host can connect to the external network, the virtual machine can also connect to the external network

4. The Linux operating system in the virtual machine cannot really be understood as an independent calculator. When it accesses the external network, it accesses the Internet by converting its address to the network IP of the host machine (the operating system outside the virtual machine).

Note that you need to pay attention when customizing the IP:



 



 






 

When the IP address of the operating system in the NAT mode virtual machine is set correctly, the troubleshooting method when the Internet cannot be accessed is to ensure that the service shown in the figure below in Windows has been started.



 

Note: Modifying the address of VMNet8 after the virtual machine is installed will cause the virtual machine to fail to connect, but Windows can connect in. 20171116, it should be that when the virtual machine is installed, the relevant network configuration files will be generated according to the settings of VMNet8 obtained by selecting the bridging method. When you have time in the future, see if you can find the corresponding network configuration file.

 

 

 

Host Only mode (Host Only):

No need to configure an IP address (will not occupy an IP)

The VMnet1 virtual network card is used, which can only communicate with the host (cannot communicate with other computers on the same network segment in the LAN)

Regardless of whether the host can connect to the external network, the virtual machine cannot connect to the external network.

The virtual system and the host machine system can communicate with each other, which is equivalent to the interconnection between the two machines through twisted pair cables, without the need for network cables.

After entering the virtual machine, the available network card information cannot be queried with ifconfig.

You can set the IP address for the eth0 network card (the set IP address needs to be in the same network segment as VMnet1IP), so that the virtual machine and the main host machine can communicate with each other

 

ifconfig eth0 192.168.10.222 (This command is only valid for one time, and it will be invalid after restarting. If you want to change it permanently, you must modify its corresponding configuration file)

 

Set to modify ip:

     Modify the ip (find the information of the file setting the network through the find / -name 'ifcfg-*' command, not necessarily ifcfg-eth0, and then edit and modify)

     vi /etc/sysconfig/network-scripts/ifcfg-eth0
     Network card Ip address: IPADDR=192.168.0.178
     Gateway address: GATEWAY=192.168.0.1

     DNS: (used to resolve domain names, multiple can be configured)

     DNS1=192.168.1.1
     DNS2=192.168.0.1

     Restart the service
     service network restart
     Command to view the modified ip address: ifconfig

    Note that the modification will take effect after restarting the service.

    DNS for reference (only one DNS can be set below)

    114.114.114.114:

 

    If you cannot access the Internet according to the above configuration, configure the network on Baidu

Dual network card configuration:

    Internal network card configuration:

DEVICE=eth0

HWADDR=00:14:22:1E:86:1F

TYPE=Ethernet

UUID=e817b914-2ac0-4ac2-ab1f-9c819f955aa7

ONBOOT=yes

BOOTPROTO=none

DEFROUTE = yes

PREFIX=24

IPADDR=192.168.10.22

NETMASK=255.255.255.0

GATEWAY=192.168.10.1      

    External network card configuration:

EVICE=eth1

HWADDR=00:14:22:1E:86:20

TYPE=Ethernet

UUID=37404f91-1195-4d76-b746-4354e7897604

ONBOOT=yes

BOOTPROTO=none

DEFROUTE = yes

PREFIX=24

IPADDR=192.168.1.22

NETMASK=255.255.255.0

GATEWAY=192.168.1.1

DNS1=192.168.1.1 

 

The virtual machine can ping the host, and both the virtual machine and the host can access the Internet, but the host cannot ping the virtual machine, and the firewall of the virtual machine has been closed??

The final solution is to change the network connection method to custom, as shown in the figure below. After using it a few times, I found that this method is unstable, and I think it is not very good.

If you are using a wireless network, restart the router when you find it unstable, and see if it can be resolved.

If it still doesn't work, try the following two steps

1, setenforce 0 turns off the linux kernel policy

2, vi /etc/sysconfig/network-scripts/ifcfg-System_eth0 edit the file to set BOOTPROTO=static



 



 

 

 

 iptables command:

firewall settings command

service iptables stop turn off the firewall

 

 

 

 

The way to connect to a Linux virtual machine without a network cable under Windows is:

Method 1: This method cannot connect to the external network
      step1: Set the network connection method of the virtual machine to the host-only mode, and share the private network with the host (refer to the figure below)
     

     Step2: Refer to the above method of setting ip and set any network card (VMware Virtual Ethernet Adapter for:xxx) seen under Windows to the same network segment, and then you can connect.

 

Method 2: This method can connect to the external network
step1: Set the network connection method to bridge mode (refer to the figure below)



 

 

step2:再参考上面的设置ip的方式设置和windows下看到的任意网卡(无线网络网卡,或者插网线的网卡)设置成同一网段后就就能连接上去了.

   

可视化设置


 



 

当虚拟机里面无法看到完整的该窗口时候将虚拟机设置成全屏模式就可以看到了。



 
 

 

今天发现将所有都设置好的虚拟机出现了让主机无法ping通虚拟机但是后面又莫名其妙的ping通了的情况,没搞明白。20160303



 


 

 


 

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326757224&siteId=291194637