I am running Windows XP as a guest on Ubuntu 18.04 LTS with qemu/kvm.
I want to use this Windows instance to manage my CCTV IP camera which uses ActiveX applets.
I need this Windows XP to get IP from the same subnetwork as IP camera is.
How can I configure this Virtual Machine using Virtual Machine Manager?
I use a laptop, so my main connection is WiFi (inteface name wlp2s0).
In the /etc/netplan/01-network-manager-all.yaml I have
# Let NetworkManager manage all devices on this system
network: version: 2 renderer: NetworkManagerAnd if I edit the content of my /etc/network/interfaces I get no connection to the internet (laptop does not bring up the WiFi connection)
I tried this tutorial without any success
Then I tried this one. Here is said "Then add the Ethernet interface as a port in the bridge..." and I noticed that nmcli command can be passed type argument. I read help about that argument and I managed to pass wifi ssid MYSSID arguments to configure that bridge with my WiFi connection.
So I managed to pull these commands:
sudo nmcli conn add type bridge con-name br0 ifname br0
sudo nmcli conn add type wifi ssid MYSSID slave-type bridge con-name bridge-br0 ifname enp1s0 master br0In the second one I changed ethernet to wifi ssid
sudo nmcli conn show --active
sudo nmcli conn up br0Then the tutorial says I need to put down the ethernet connection - so I thought that in my case I need to put down wifi connection.
How come this should work? I want my laptop to have a connection and my bridged virtual guest operating system to have one.
When I issue ip a the br0 connection does not have an IP address from DHCP.
If I bring up WiFi connection no new IP address shows up on the bridge interface (ip a)
3 Answers
There is a native bridge (virbr0) that is installed with the QEMU/KVM environment. It is used for NAT (Network Address Translation) connections to your local subnet.
This should be sufficient for managing your IP camera. Your XP VM would only need its own IP on the net if other systems will be contacting it.
But in either case you should start with the NAT bridge to keep things simple until you are certain your XP VM is configured correctly. It almost certainly is not!
You can test for the presence of the Virtual Bridge on your host system by:
virsh net-dumpxml defaultIf it is present, you should be able to select it for use by your XP VM in virt-manager by setting Network source to "Virtual Network 'default':NAT" as shown:
Check your XP for a working network driver. If the following picture is familiar...
you need a driver disk! I recommend Red Hat's virtio driver.
- Download the latest virtio drivers ISO ( last I checked).
- Attach the ISO to your XP VM and boot it!
- At "Find new hardware"/connect to Window Update, decline (NO).
- Select "Install from specific location"/Next
- Select "Search removable media"/Next
- At Hardware Installation/Red Hat Virtio Ethernet Adapter", Select "Continue Anyway".
- Open a command prompt window and ping your IP camera (it may take a few seconds for the adapter to come up).
Add a comment if you still want the full bridge. I use networkd/Netplan exclusively in my environment but I could pound out a Network-Manager solution, I think.
4You need to create a network bridge on the host PC. This answer is based on the understanding that your IP cameras, Ubuntu host OS and Windows XP VM will all be on the same network (with no advanced VLAN configuration).
- Install the bridge-utils package:
sudo apt-get install bridge-utils - Edit /etc/network/interfaces to configure the networking for the br0 interface created, using the details below (substituting IP information relevant to your network).
Host Static IP Configuration
auto lo
iface lo inet loopback
auto br0
iface br0 inet static address 192.168.0.10 network 192.168.0.0 netmask 255.255.255.0 broadcast 192.168.0.255 gateway 192.168.0.1 dns-nameservers 192.168.0.5 8.8.8.8 dns-search example.com bridge_ports eth0 bridge_stp off bridge_fd 0 bridge_maxwait 0Note that the lines auto eth0 and iface eth0 inet manual are not in the file. This is because br0 will bring up the components assigned to it.
bridge_stp off is a setting for spanning tree. If you have a possibility for network looks, you may want to turn this on.
bridge_fd 0 turns off all forwarding delay. If you do not know what this is, you probably do not need it.
bridge_maxwait 0 is how long the system will wait for the Ethernet ports to come up. Zero is no wait.
Host DHCP Configuration
auto lo
iface lo inet loopback
auto br0
iface br0 inet dhcp bridge_ports eth0 bridge_stp off bridge_fd 0 bridge_maxwait 0This will create a virtual interface br0. You can have multiple bridges, and some need not have any actual network card assigned.
- Restart networking on the host by running the command
sudo /etc/init.d/networking restartorsudo reboot.
If the host freezes for a few seconds when stopping or starting a guest VM, it is because a Linux bridge is taking the hardware address (MAC address) of the lowest number interface of all connected interfaces. To resolve this, add the line post-up ip link set br0 address 00:00:00:00:00:00 to the bridge interface configuration, replacing the MAC address with the one of the physical interface connected.
Links:
- - KVM/Networking (Ubuntu Documentation)
- - NetworkConnectionBridge (Ubuntu Documentation)
I suggest you try the following. It has worked for me many times, however the host OS was CentOS, not Ubuntu, and the VMs were Linux-based and not Windows-based. However, I don't think the OS will make a big difference here.
Don't do anything special to your
wlp3s0interface - just leave it as it is configured by default.In
virt-manager, change the settings of the network card on the virtual machine as shown below (installvirt-managerif you don't have it).
Set "source device" to "wlp3s0 : macvtap" (I hope you should have this choice in the selection menu) and "Source mode" to "Bridge". The virtual machine needs to be shut down and restarted for the setting to take effect.
By doing this you are directly connecting the virtual network card on your VM to the wlp3s0 device on your host OS. It should see exactly the same network as your wpl3s0 sees and behave just like another device connected to that network.
It works for me, I hope it will work for you too.