Detailed explanation of three Linux network configuration methods
1. Bridge Mode
The network card of the virtual machine is bridged to the network card of the real machine.
The network address of the virtual machine must be the same as the network address of the real machine [in the same network segment]
-
Right-click the current virtual machine and click
设置
-
The network adapter is selected as bridge mode
-
Virtual network editing
This should automatically be in bridge mode, but if the modified one needs to be changed back to bridge mode, one
下面的报错信息极有可能就是这里没修改造成的!!!
more point, in bridge mode, it is best to choose the corresponding network name by yourself. The automatic I chose before is not easy to use. .
In the last ping, an error is reported: From 192.168.1.xxx icmp_seq=1 Destination Host Unreachable
- View the local IP address
- Select the network you are locally connected to, right-click
状态
>详细信息
, and you can see the local IP address. For example, my IP address is192.168.1.111
The name under the network here is the bridge to xxx selected in the previous step
- Then configure in the virtual machine
- Set the IP address, etc., and then click
Apply
- Turn on the network card
- You can see that the IP address is manually configured just now
- Ping each other between the virtual machine and the local machine.
2. NAT mode
- Virtual Network Editor and select the virtual machine network adapters for the
NAT
mode
- Virtual machine network settings
- Reopen the network, then you can see the automatically obtained address
- Ping the external network, it will be fine if you can ping
There may be a display of ping failure, it may be a problem with the graphical interface, the response of the graphical interface is too slow, reconfiguration should be no problem
3. Host only mode
- When the vm software is installed, two network cards will be installed locally by default [VMnet1] (local mode only) [VMnet8] (for NAT), we find VMnet1, right-click
属性
, and then manually set the IP address
When you turn on the adapter option on this machine, you may find that there is only VMnet8, no VMnet1, or neither, just like mine, as shown in the figure below. Do
n’t panic, power off the virtual machine first, and then
wait for a while. Yes, then you will find VMnet1 appears
- Find IPv4, double-click to open, set one manually, and confirm
- Then as above, we have to set the adapter of the virtual machine to
仅主机模式
You can also choose to customize
- Then modify the network configuration of the virtual machine
- Then restart the network, ping each other, it’s ok if you can ping through