How to make a Virtual Machine present itself to my home network as if it were another physical computer

Thanks very much I get:

mike@mx:~$ ip route get default
local 0.0.0.0 dev lo src 127.0.0.1 uid 1000 
    cache <local> 
mike@mx:~$ ip route get 1
1.0.0.0 via 192.168.1.1 dev enp2s0 src 192.168.1.151 uid 1000 
    cache 
mike@mx:~$

Is my revised order of commands above correct - sorry to have to ask, but I just cannot work it out as I don’t fully understand?

OK thanks I get

mike@mx:~$ ip route show default
default via 192.168.1.1 dev enp2s0 proto dhcp src 192.168.1.151 metric 100 
default via 192.168.1.1 dev wlp1s0b1 proto dhcp src 192.168.1.129 metric 600

Thanks for that reassurance - which is very welcome. I get worried when I don’t understand but it’s good that it’s easy to fix, and just to double insure I have taken a root and home snapshot with BTRFS assistant, so should be OK :).

Does the ip route response show both are default?

OK thanks very much - I will run the bridge commands now and post the results afterwards

OK, thanks very much. I may have hit a slight problem, please see end of log below. It cannot find emp2s0 to delete it.

mike@mx:~$ sudo nmcli connection add type bridge \
    connection.id bridge ifname br0 bridge.stp no
[sudo] password for mike: 
Sorry, try again.
[sudo] password for mike: 
Connection 'bridge' (6326cc78-caab-4338-929e-e86fe8da26f2) successfully added.
mike@mx:~$ sudo nmcli connection add type ethernet \
    connection.id ether master bridge
Connection 'ether' (c7b5846f-55ba-4f61-bf14-a5e75b796921) successfully added.
mike@mx:~$ sudo nmcli connection up bridge
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/11)
mike@mx:~$ sudo nmcli connection up ether
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/12)
mike@mx:~$ nmcli connection show
NAME                UUID                                  TYPE      DEVICE   
bridge              6326cc78-caab-4338-929e-e86fe8da26f2  bridge    br0      
The Vallets Wifi    68827791-dac0-4333-a81d-b4ce0e23ff62  wifi      wlp1s0b1 
ether               c7b5846f-55ba-4f61-bf14-a5e75b796921  ethernet  enp2s0   
lo                  8fdd8aa0-9e37-4dfc-8048-dd7920e3a453  loopback  lo       
virbr0              7a7b4c4d-e417-42c4-a55d-db8e6222217a  bridge    virbr0   
Wired connection 1  d714040f-ed30-3318-a9a5-0d3a9b53fe37  ethernet  --       
mike@mx:~$ nmcli connection delete enp2s0
Error: unknown connection 'enp2s0'.
Error: cannot delete unknown connection(s): 'enp2s0'.
mike@mx:~$ sudo nmcli connection delete enp2s0
Error: unknown connection 'enp2s0'.
Error: cannot delete unknown connection(s): 'enp2s0'.
mike@mx:~$ 
mike@mx:~$ sudo nmcli connection add type bridge \
    connection.id bridge ifname br0 bridge.stp no
[sudo] password for mike: 
Sorry, try again.
[sudo] password for mike: 
Connection 'bridge' (6326cc78-caab-4338-929e-e86fe8da26f2) successfully added.
mike@mx:~$ sudo nmcli connection add type ethernet \
    connection.id ether master bridge
Connection 'ether' (c7b5846f-55ba-4f61-bf14-a5e75b796921) successfully added.
mike@mx:~$ sudo nmcli connection up bridge
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/11)
mike@mx:~$ sudo nmcli connection up ether
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/12)
mike@mx:~$ nmcli connection show
NAME                UUID                                  TYPE      DEVICE   
bridge              6326cc78-caab-4338-929e-e86fe8da26f2  bridge    br0      
The Vallets Wifi    68827791-dac0-4333-a81d-b4ce0e23ff62  wifi      wlp1s0b1 
ether               c7b5846f-55ba-4f61-bf14-a5e75b796921  ethernet  enp2s0   
lo                  8fdd8aa0-9e37-4dfc-8048-dd7920e3a453  loopback  lo       
virbr0              7a7b4c4d-e417-42c4-a55d-db8e6222217a  bridge    virbr0   
Wired connection 1  d714040f-ed30-3318-a9a5-0d3a9b53fe37  ethernet  --       
mike@mx:~$ nmcli connection delete enp2s0
Error: unknown connection 'enp2s0'.
Error: cannot delete unknown connection(s): 'enp2s0'.
mike@mx:~$ sudo nmcli connection delete enp2s0
Error: unknown connection 'enp2s0'.
Error: cannot delete unknown connection(s): 'enp2s0'.
mike@mx:~$ 

Thanks very much that gives:

mike@mx:~$ nmcli connection delete "Wired connection 1"
Connection 'Wired connection 1' (d714040f-ed30-3318-a9a5-0d3a9b53fe37) successfully deleted.
mike@mx:~$ nmcli connection show
NAME              UUID                                  TYPE      DEVICE   
bridge            6326cc78-caab-4338-929e-e86fe8da26f2  bridge    br0      
The Vallets Wifi  68827791-dac0-4333-a81d-b4ce0e23ff62  wifi      wlp1s0b1 
ether             c7b5846f-55ba-4f61-bf14-a5e75b796921  ethernet  enp2s0   
lo                8fdd8aa0-9e37-4dfc-8048-dd7920e3a453  loopback  lo       
virbr0            7a7b4c4d-e417-42c4-a55d-db8e6222217a  bridge    virbr0   

So I should continue now?

Ok I need to look out for the Blue thumb! Nearly there… some sort of permissions problem on last command. Do I need sudo?

mike@mx:~$ virsh list --all
 Id   Name   State
-----------------------
 -    win7   shut off

mike@mx:~$ virsh shutdown win7
error: Failed to shutdown domain 'win7'
error: Requested operation is not valid: domain is not running

mike@mx:~$ EDITOR="sed -i -e /bridge=/s/virbr0/br0/" virsh edit win7
Domain 'win7' XML configuration edited.

mike@mx:~$ virsh start win7
error: Failed to start domain 'win7'
error: /usr/libexec/qemu-bridge-helper --br=br0 --fd=25: failed to communicate with bridge helper: stderr=access denied by acl file
: Transport endpoint is not connected

Thanks, here is the dump:

mike@mx:~$ virsh dumpxml win7 --xpath //interface
<interface type="bridge">
  <mac address="52:54:00:27:42:7f"/>
  <source bridge="br0"/>
  <model type="rtl8139"/>
  <address type="pci" domain="0x0000" bus="0x02" slot="0x01" function="0x0"/>
</interface>

Success! Now do I try starting the VM?

mike@mx:~$ sudo tee -a /etc/qemu/bridge.conf << EOF > /dev/null
allow br0
EOF
[sudo] password for mike: 
mike@mx:~$ virsh start win7
Domain 'win7' started

mike@mx:~$ 

I’ll take the party symbol as a yes. OK here we go…

Quite a feat to do that by remote support. THank you very much indeed:

C:\Users\Mike>ipconfig

Windows IP Configuration


Ethernet adapter Local Area Connection 2:

   Connection-specific DNS Suffix  . : localdomain
   Link-local IPv6 Address . . . . . : fe80::a51b:20eb:4ab8:ce4a%14
   IPv4 Address. . . . . . . . . . . : 192.168.1.132
   Subnet Mask . . . . . . . . . . . : 255.255.255.0
   Default Gateway . . . . . . . . . : 192.168.1.1

Tunnel adapter isatap.localdomain:

   Media State . . . . . . . . . . . : Media disconnected
   Connection-specific DNS Suffix  . : localdomain

C:\Users\Mike>

And in the Network Managerment tool. That will make life much easier as I can now port forward etc… Thank you very much indeed Vladisslav!

So I make the revised commands:

sudo nmcli connection add type bridge \
    connection.id bridge ifname br0 bridge.stp no
sudo nmcli connection add type ethernet \
    connection.id ether master bridge
sudo nmcli connection up bridge
sudo nmcli connection up ether
nmcli connection show
nmcli connection delete "Wired connection 1"
virsh list --all
virsh shutdown win7
EDITOR="sed -i -e /bridge=/s/virbr0/br0/" virsh edit win7
sudo tee -a /etc/qemu/bridge.conf << EOF > /dev/null
allow br0
EOF
virsh start win7

Is that correct?

And the revised description of what we did…Is this correct?

Your shell commands…

  • create a pre-configured bridge, ‘br0’,
  • delete and replace the main current physical wired connection ‘Wired Connection 1’ by one called ‘ether’ which references the bridge ‘br0’
  • edit the virtual Win7 connection to include a reference to the bridge ‘br0’.
  • thus connecting ‘ether’ to ‘br0’ to ‘win7’

Thanks very much Barry that allowed me to work out how to enter it. And as you can see from the bottom of this thread… we got there!

Thanks very much h. Janssen. From Vladislavs tests it looks like I have been only using the wired connection any way. Need time to test, but it is working fast enough at the moment.

I guess fedora uses bandwidth much better than other OS. But I do appeciate your help, and having a viable bridged backup connection may well be worthwhile. So I will try your tests in a few days when I see how the wired connection is working out. So thanks very much for your hard work and research on this.

BTW can I easily delete the test bridge after running your test?

Just type “ip link del bridge1”. But the problem is solved by using the homeplug, which is, I just learned, ethernet protocol so is not affected by the wifi problems. But if wifi is much faster or worse, if you do not have wired available, you can try the ipvtap method. Please note that I’m not sure whether this adapter survives a sleep or hibernate, I’m not in the stage yet that it’s properly implemented.

(Edit: what definitively is wrong is change of MAC address on the wifi adapter, which is cloned into the VM’s XML)

OK thanks very much h.Janssen I will probably leave it for the moment then. Many thanks again for all your help in this respect.

Thanks very much Vladislav. All still working very well here…which is excellent. And VM is booting faster…

Just for information: tested this ipvtap with two Oracle 8 VMs. you need one ipvtap for each VM. Because the wireless interface, the ipvtaps and the VM interfaces share one MAC address, DHCP will not work. And communication from/to the host system does not work, a “ssh” into the VM address results in a ssh into the host itself.
So the VM’s should get a manually defined IPv4 address which must be set on the ipvtap adapter too.

The VM’s get an IPv6 address and route via router advertisement, because Oracles default is “stable privacy”, the auto-generated addresses are different in the VM’s. Principle is the same: the IPv6 address in the VM has to be set on the ipvtap interface on the host. My router advertizes it’s link-local fe80:: address for routing, and this works, so the VM can be considered really connected to the LAN subnet.