Step One: Create a New Bridged Network Interface
Without the VM running, create a virtual bridged interface. Create a file named "br0" in /etc/networking/interfaces.d, with the following contents:
auto br0 iface br0 inet dhcp pre-up ip tuntap add dev tap0 mode tap user <username who will run virtual machine> pre-up ip link set tap0 up bridge_ports all tap0 bridge_stp off bridge_maxwait 0 bridge_fd 0 post-down ip link set tap0 down post-down ip tuntap del dev tap0 mode tap
Step Two: Restart networking.
Before you restart networking, and then again after you restart networking, you can run:
ip link show type bridge
and
ip link show master br0
to see some before-and-after stats on what you're accomplishing.
sudo systemctrl restart networking
or
sudo /etc/init.d/networking restart
Start Virtual Machine Manager and configure the VM to use the new bridged interface.
Once the Virtual Machine Manager is running, Open the desired VM, and then in the View menu, select Details. Select the NIC... item in the left-hand pane, and then in the right-hand pane, change the Network Source from "Virtual network 'default' : NAT" to "Bridged device...", and then in the Device name: field, enter "br0" to match the name of the interface defined in Step One above.
Now power-on your VM, and it should connect via bridged networking instead of being NAT-ted.
CAVEAT: As I discovered later, this does not work with a wi-fi host; the host needs to be wired to Ethernet. I think it can be made to work (at least in some cases), but it looks to be complicated.
No comments:
Post a Comment