4

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: NetworkManager

And 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 br0

In the second one I changed ethernet to wifi ssid

sudo nmcli conn show --active
sudo nmcli conn up br0

Then 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)

  • The things I did from the Chritopher answer didn't help me. It is laconic and does not cover my case (laptop with WiFi connection) – Marecky Sep 2 at 10:10
  • Check link, you have to use ipvlan because your parent interface is a wireless adapter, specifically, use ipvlan L2 mode, if you don't want to change physical network's route. I don't think you can let DHCP work for such VM, you can try static IP setting. If you have a wired connection, you can use macvlan and DHCP. – alfred Sep 16 at 6:22
0

You 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).

  1. Install the bridge-utils package: sudo apt-get install bridge-utils
  2. 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 0

Note 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 0

This will create a virtual interface br0. You can have multiple bridges, and some need not have any actual network card assigned.

  1. Restart networking on the host by running the command sudo /etc/init.d/networking restart or sudo 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:

| improve this answer | |
  • Thanks, for your answer. I am trying to implement this solution but I have to take it in parts (a lot of reading, and things you just copied from documentations aren't working strait forward) – Marecky Aug 14 at 10:59
  • When I edit /etc/network/interfaces it gets cleared after reboot. I think it is caused by Network Manager – Marecky Aug 14 at 11:02
  • And my laptop gets its internet connection from wlp3s0: interface - should I exchange eth0 name with wlp3s0 in examples above? – Marecky Aug 14 at 11:04
  • To disable NetworkManager, run: sudo apt-get purge network-manager – Christopher H Aug 24 at 23:42
  • Why I have to disable it? – Marecky Aug 25 at 7:29
0

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 default

If 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:

virt-manager network selection

Check your XP for a working network driver. If the following picture is familiar... enter image description here

you need a driver disk! I recommend Red Hat's virtio driver.

  1. Download the latest virtio drivers ISO (https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.185-2/virtio-win.iso last I checked).
  2. Attach the ISO to your XP VM and boot it!
  3. At "Find new hardware"/connect to Window Update, decline (NO).
  4. Select "Install from specific location"/Next
  5. Select "Search removable media"/Next
  6. At Hardware Installation/Red Hat Virtio Ethernet Adapter", Select "Continue Anyway".
  7. 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.

| improve this answer | |
  • I need full bridge solution because my CCTV camera's default configuration has disabled DHCP. It has static IP address which is from the other subnet (or group, I don't know how to name it). I want to be able to specify IP address of Windows XP Guest from the Internet Wi-Fi router. I have a Microtik device with plenty of configuration options and I can manage everything related to DHCP server and IP leases. – Marecky Sep 14 at 13:12
  • First I will try the @raj solution. Just wait – Marecky Sep 14 at 13:13
0

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.

  1. Don't do anything special to your wlp3s0 interface - just leave it as it is configured by default.

  2. In virt-manager, change the settings of the network card on the virtual machine as shown below (install virt-manager if you don't have it).

virt-manager screenshot

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.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.