How to setup the netplan for Ubuntu Server 20.04 for bridged connection running as VM?
I want to setup the netplan for a bridged network adapter in Ubuntu Server 20.04 running as a guest on a Windows 10 Desktop. The network adapter is currently not working as expected, it doesn't use an IP adress. I want to use the server as part of the network of the host machine directly connencted to the router. I want to ssh into the server with an Ubuntu Desktop 20.04 also using network bridge where everything works fine.
I want to use the server as a storage for SnipeIT and it needs to be setup on a server with internet connectivity and a static IP adress. I will also install ApacherServer on it.
Current netplan setup
How does the netplan need to be setup? Which parameters do I need to use?
Solution 1:
Generally you do not need to do anything to Netplan when working with the VM. This will be controlled through the VirtualBox settings.
Your 00-installer-config.yaml
file can be returned to its default state:
# This is the network config written by 'subiquity'
network:
ethernets:
enp0s3:
dhcp4: true
enp0s8:
dhcp4: true
version: 2
In your VirtualBox setup, you'll want to ensure your network adapter is set to "Bridged" (which you've said it is) and that the "Promiscuous Mode" (under the advanced section) is set to "Allow All". Of course you'll want to confirm that the correct host network adapter is selected and that the "Cable Connected" checkbox is properly checked.
With this, the virtual machine will be assigned an IP address from the DHCP service on the network. If you are interested in configuring a static IP address, then you can do that with reserved addresses on the DHCP server or by editing your Netplan file to look something like this:
# This is the network config written by 'subiquity'
network:
ethernets:
enp0s3:
dhcp4: true
enp0s8:
dhcp4: false
addresses: [192.168.0.111/24]
gateway4: 192.168.0.1
nameservers:
addresses: [192.168.0.2, 192.168.0.3]
version: 2
Note: Be sure to change those IP addresses to the correct values for your network.
From there you can run sudo netplan apply
followed by ip a show
to confirm that everything is configured.