Virtual machine network bridging
Article directory
- Virtual machine network bridging
-
- 1. First check the gateway through which the host connects to the network.
- 2. Open the worksation service of the virtual machine
- 3. Modify the IPV4 attributes of the host’s VMnet8
- 4. Modify the virtual network of the virtual machine’s workstation
- 5. Modify the IP and gateway of VMnet8
- 6. Set the virtual machine to bridge mode
- 7. Modify the static IP of the virtual machine and the corresponding gateway
- 8. Ping test
- 9. Tool connection
I want the virtual machine to set a fixed static IP and allow the host to connect to the virtual machine through the connection tool, so I am going to set up the network bridge of the virtual machine to achieve this. Here are the detailed steps!!!
1. First check the gateway through which the host connects to the network.
- This 172.20.10.1 is the gateway corresponding to the bridge to be set up later.
2. Open the worksation service of the virtual machine
3. Modify the IPV4 attributes of the host’s VMnet8
- In the corresponding control panel->Network and Internet->Network Connections
- Select VMnet8, right click on Properties
- Then check the IPV4 selection properties, set the above gateway and corresponding subnet mask 255.255.255.0, DNS server 8.8.8.8
4. Modify the virtual network of the virtual machine’s workstation
- Click Edit, then click Virtual Network Editor
5. Modify the IP and gateway of VMnet8
- Select VMnet8 and click Change Settings. Check the corresponding nat settings as follows:
- Then click NAT settings to modify the corresponding IP gateway.
- The gateway in this column is also the gateway mentioned at the beginning, and the subnet IP ends with .0. For example, if the gateway is 172.20.10.1, the subnet IP above is set to 172.20.10.0; after all modifications, click Apply ->OK.
6. Set the virtual machine to bridge mode
7. Modify the static IP of the virtual machine and the corresponding gateway
First enter the virtual machine and open the corresponding network configuration file
vim /etc/sysconfig/network-scripts/ifcfg-ens33
- Enter "i" to enter edit mode, modify BOOTPROTO=static static ip mode, ONBOOT=yes
- Then add the gateway and ip at the end, and the proxy ip information
IPADDR=173.20.10.11
NETMASK=255.255.255.0
GATEWAY=172.20.10.1
DNS1=8.8.8.8
DNS2=114.114.114.114
- IPADDR is the proxy IP of the virtual machine, which just starts with 172.20.10. corresponding to the gateway. The gateway is still the gateway mentioned before, and NETMASK is the subnet mask 255.255.255.0. The following two are server configurations, just enter them.
- After modification, ESC+:+wq save and exit.
- Refresh and restart network services
service network restart
You can turn off the firewall again
systemctl stop firewalld.service
8. Ping test
Now the bridge is complete and you can ping.
9. Tool connection
Use the visual connection tool to connect. Here, secureCRT is used to connect and test, and Xshell will work the same.
The host name is the corresponding IP. The 172.20.10.11 I filled in here is the proxy IP configured on the virtual machine above. Then enter the user name to log in.