Teach you three Linux network configuration methods

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 设置
    Insert picture description here

  • The network adapter is selected as bridge mode
    Insert picture description here

  • 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

Insert picture description here
Insert picture description here

  • View the local IP address
    Insert picture description here
  • 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

Insert picture description here
Insert picture description here

  • Then configure in the virtual machine
    Insert picture description here
    Insert picture description here
  • Set the IP address, etc., and then click Apply
    Insert picture description here
  • Turn on the network card
    Insert picture description here
  • You can see that the IP address is manually configured just now
    Insert picture description here
  • Ping each other between the virtual machine and the local machine.
    Insert picture description here
    Insert picture description here

2. NAT mode

  • Virtual Network Editor and select the virtual machine network adapters for the NATmode
    Insert picture description here
    Insert picture description here
  • Virtual machine network settings
    Insert picture description here
  • Reopen the network, then you can see the automatically obtained address
    Insert picture description here
  • 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
Insert picture description here
n’t panic, power off the virtual machine first, and then
Insert picture description here
Insert picture description here
wait for a while. Yes, then you will find VMnet1 appears
Insert picture description here

Insert picture description here

  • Find IPv4, double-click to open, set one manually, and confirm
    Insert picture description here
  • Then as above, we have to set the adapter of the virtual machine to仅主机模式
    Insert picture description here

You can also choose to customize
Insert picture description here

  • Then modify the network configuration of the virtual machine
    Insert picture description here
  • Then restart the network, ping each other, it’s ok if you can ping through
    Insert picture description here
    Insert picture description here

Guess you like

Origin blog.csdn.net/qq_29339467/article/details/108952531