Fixing Bridge VirtualBox Ethernet Setup: Connect Two Real Ethernet Devices (Windows 10 & Ubuntu Guest System)
VirtualBox is a powerful virtualization software that allows you to run multiple operating systems on a single physical machine. In this article, we will focus on how to connect two real Ethernet devices in a Windows 10 host machine to a Ubuntu guest system using VirtualBox. This setup is useful when you want to create a bridge between two physical networks and increase the network performance of your virtual machines.
Prerequisites
- A Windows 10 host machine with at least two Ethernet devices.
- A Ubuntu guest system installed in VirtualBox.
- VirtualBox extension pack installed on the host machine.
Setting up the Bridge in Windows 10
The first step is to create a bridge between the two Ethernet devices in Windows 10. This can be done using the built-in netsh command-line tool.
netsh bridge add bridge name="My Bridge" stactic ipaddr=192.168.0.1 subnetmask=255.255.255.0
netsh bridge set interface "Ethernet" admin=disable
netsh bridge set interface "WLAN" admin=disable
netsh bridge add interface "Ethernet" bridge="My Bridge"
netsh bridge add interface "WLAN" bridge="My Bridge"
netsh interface ip set address name="My Bridge" source=static addr=192.168.0.1 mask=255.255.255.0
netsh interface ip set dns name="My Bridge" source=static addr=8.8.8.8
In the above example, we created a bridge named "My Bridge" and assigned it a static IP address of 192.168.0.1. We then disabled the original Ethernet and WLAN interfaces and added them to the bridge. Finally, we set the IP address and DNS server for the bridge.
Configuring the Ubuntu Guest System
The next step is to configure the Ubuntu guest system to use the bridge interface. This can be done by editing the /etc/network/interfaces file.
auto enp0s3
iface enp0s3 inet manual
auto enp0s8
iface enp0s8 inet static
address 192.168.0.2
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
dns-nameservers 8.8.8.8
In the above example, we configured the enp0s8 interface to use a static IP address of 192.168.0.2 and set the gateway and DNS server to the IP address of the bridge interface. We also set the network and broadcast addresses to match the subnet of the bridge interface.
Testing the Setup
To test the setup, you can ping the IP address of the Ubuntu guest system from the Windows 10 host machine.
ping 192.168.0.2
You should also be able to access the internet from the Ubuntu guest system.
References
This article was written using the following resources:
- Microsoft Docs: Overview of Network Bridging
- VirtualBox Manual: Bridged Networking
- Ubuntu Server Guide: Network Configuration