Virtual MS4H on Hyper-V

Einklappen
X
 
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge
  • J V
    LoxBus Spammer
    • 28.08.2015
    • 366

    Virtual MS4H on Hyper-V

    Hello,

    I'm in the process of installing MS4H on a Debian on a VM. I know this is not common and may not even be supported, but I wanted to post my progress; that is why I use the showcase forum rather than the general forum. The main point of the thread is to help me to remember the steps I did but at the same time it may help other people.

    The situation: I have a Windows machine which doubles as HTPC and media server. It is configured to work with wakeonlan, and currently is my LMS to serve my 4 (original) Squeezeboxes. I did not want to have an always on computer with Debian for MS4H, but would like some of the functionality it offers (mainly the Loxone integration). As I have Squeezeboxes, I do not need the extensive MS4H functionality with soundcards, but I would like to use the music server gateway and to have MS4H switch on when I power on a squeezebox.

    The idea: Run MS4H on a Debian-VM on the Windows computer, on an external switch (hyper-v terminology).
    The problem: The use of an external switch (hyper-v terminology) makes the VM part of my LAN and thus reachable, but then the squeezeboxes would connect directly its IP, which makes them lose the ability to wake the server on lan (they would try to wake the guest OS, but not the host).
    The workaround: Run MS4H on a Debian-VM that is connected via a private nat network (hyper-v terminology), forward all the necessary ports from the host to that VM.

    I'm using Hyper-V, as my Windows computer also runs Docker, which prevents me from using VirtualBox. But I assume the concepts to be similar. In Hyper-V there is no possibility for soundcards; as I gather, VirtualBox has that possibility but honestly don't know as I don't need it.

    Setting up a NAT network on Hyper-V:
    https://docs.microsoft.com/en-us/vir...up-nat-network
    Important issue: you can only have one NAT address range, and there is no DHCP server (so the guests will need fixed IP addresses)
    Powershell commands: New-VMSwitch , Get-NetAdapter , New-NetIPAddress , New-NetNat

    The virtual network is classified in the network and sharing center as "unidentified" and "public". The public aspect is problematic, as the Windows firewall blocks DNS lookups. While it is possible to allow this through the firewall, I preferred to set the virtual network as private (I prefer to keep the public firewall settings as tight as possible, and I trust my own private network). This change is easily done with PowerShell:
    home-network-help.com ist die beste Quelle für alle Informationen die Sie suchen. Von allgemeinen Themen bis hin zu speziellen Sachverhalten, finden Sie auf home-network-help.com alles. Wir hoffen, dass Sie hier das Gesuchte finden!

    Powershell command: Set-NetConnectionProfile

    Setting up a fixed IP on Debian:
    https://www.snel.com/support/how-to-...-on-debian-10/
    (for some reason, MS4H changed /etc/network/interfaces, so I used manually changed the network configuration)
    (this change is possible from the MS4H web interface, if you first connect the VM to an external switch, install MS4H, reconfigure its network and then connect the VM to the nat swtich)

    Port forwarding in Hyper-V:
    https://tewarid.github.io/2019/06/26...n-hyper-v.html
    Second link with more examples
    https://petri.com/create-nat-rules-h...virtual-switch
    Powershell command: Add-NetNatStaticMapping


    So far, I have access to MS4H through a port-forwarded webinterface. I haven't yet configured either LMS or Loxone and I'm unable to continue in the next few days due to renovations (my patchpanel is disconnected, half my devices don't have network ), but will post progress here.


    Jörg
    Zuletzt geändert von J V; 03.05.2021, 14:09.
  • J V
    LoxBus Spammer
    • 28.08.2015
    • 366

    #2
    Just to (finally) get back to this. It seems to work: Loxone Config sees the MusicServer (it lights up as green). As for the location of the music files, which I don't want in this virtual machine, LMS has the interesting function of looking for files on another LMS installation, so that is an alternative to using the NetShare.

    One weird note: the LMS webinterface does not work from the virtual IP address, but it does work from the host IP address if port-forwarding is properly set. It seems to only be an issue with the first wizard page, which throws an error 403 (forbidden), but it is something to be aware of. MS4H thinks it is on the virtual IP address, the configuration puts LMS on that same IP and thus it tries to open the LMS interface on that IP address.


    (This type of installation is completely unsupported, but I'm documenting my steps here for whoever may want to try something similar)

    Kommentar

    • J V
      LoxBus Spammer
      • 28.08.2015
      • 366

      #3
      Still working on this...

      I'm seeing a weird behaviour of my Squeezeboxes... I have set static routes to the virtual server for ports 80, 7091, 9000, 9090, 3483 (tcp and udp). The Squeezebox sees the server (shows a standby display) and I can switch it on. The Squeezebox also shows up in LMS. However, after switching on, it almost immediately switches off again (most I had was 5s or so). Trying to figure out what the problem is here... Maybe something from the Loxone / musicserver forces it of again... Looking further...

      Kommentar

      • J V
        LoxBus Spammer
        • 28.08.2015
        • 366

        #4
        Still working on this (not a priority), and I came across something weird.

        If I have MS4H as a VM in Hyper-V, connected to an external switch (hyper-v terminology: takes part on the normal network), then there is a weird behaviour of the Squeezeboxes: one of my Squeezeboxes works fine, the other shows the standby display but when I switch it on it immediately goes back to standby. This is the behaviour I saw on the other Squeezebox when I used the port forwarding setup. So I tried that one again, and it also works for one Squeezebox but not for the other one.
        All settings of the Squeezeboxes are the same, the only difference is that one is connected via a simple TP-Link switch, whereas the other is connected via a D-Link DGS1210. On my previous experiment, the one I checked with was also connected via the D-Link... This is a smartswitch... any chance it blocks something?
        edit: it depends... I tried again and now neither SB could connect... So it is not dependent on the switch. So close but it seems one thing is missing... I guess I'll need to start sniffing the network...
        Zuletzt geändert von J V; 26.12.2022, 21:48.

        Kommentar

        • J V
          LoxBus Spammer
          • 28.08.2015
          • 366

          #5
          The problem with the Squeezeboxes going immediately to standby was that I was using an empty library to test. In combination with the default-enabled powermanager, this triggered the players to switch off as it considers that playback has stopped.

          It partly works. These were my installation steps:
          1. Connect MusicServer to external network, configure LMS
          2. Define NATNetwork
          3. Connect MusicServer to NATSwitch, give it a fixed IP (I gave it 192.168.3.10)
          4. forward ports

          Code:
          New-VMSwitch -SwitchName "NATSwitch" -SwitchType Internal
          Get-NetAdapter
          The internal switch will have a name like vEthernet (SwitchName) and an Interface Description of Hyper-V Virtual Ethernet Adapter. Take note of its ifIndex to use in the next step.
          Code:
          New-NetIPAddress -IPAddress 192.168.3.1 -PrefixLength 24 -InterfaceIndex <ifIndex>
          New-NetNat -Name NATNetwork -InternalIPInterfaceAddressPrefix 192.168.3.0/24
          Set-NetConnectionProfile -InterfaceIndex <ifIndex> -NetworkCategory Private
          Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 81 -Protocol TCP -InternalIPAddress "192.168.3.10" -InternalPort 80 -NatName NATNetwork
          Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 7091 -Protocol TCP -InternalIPAddress "192.168.3.10" -InternalPort 7091 -NatName NATNetwork
          Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 9000 -Protocol TCP -InternalIPAddress "192.168.3.10" -InternalPort 9000 -NatName NATNetwork
          Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 9090 -Protocol TCP -InternalIPAddress "192.168.3.10" -InternalPort 9090 -NatName NATNetwork
          Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 3483 -Protocol TCP -InternalIPAddress "192.168.3.10" -InternalPort 3483 -NatName NATNetwork
          Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 7091 -Protocol UDP -InternalIPAddress "192.168.3.10" -InternalPort 7091 -NatName NATNetwork
          Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 9000 -Protocol UDP -InternalIPAddress "192.168.3.10" -InternalPort 9000 -NatName NATNetwork
          Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 9090 -Protocol UDP -InternalIPAddress "192.168.3.10" -InternalPort 9090 -NatName NATNetwork
          Add-NetNatStaticMapping -ExternalIPAddress "0.0.0.0/24" -ExternalPort 3483 -Protocol UDP -InternalIPAddress "192.168.3.10" -InternalPort 3483 -NatName NATNetwork
          The Squeezeboxes are now capable of waking up the host, even though they list the host as being on address 192.168.3.10 (with the hostname of the vm). However, there are some issues.
          1. They don't wake up upon powerup, but rather fail and offer the option to wake up the server. On this second attempt it works.
          2. After powerup, they keep displaying "Free your music". It seems that the virtual installation of the MusicServer has a problem coming out of standby with the host. The MusicServer returns, but the LMS WebUI and LMS Telnet services are no longer running. Still checking if this is something I can fix... some checkpoint setting or so...

          Edit: for some reason, the services LMS WebUI and LMS Telnet take a long time to return after the host (and vm) are back online - we are talking about 2 minutes or so. It seems better when using "production checkpoints" (and enabling "guest services"), but it is still much longer than it was natively on my windows host... Not perfect but it will do for now...
          Zuletzt geändert von J V; 02.01.2023, 10:16.

          Kommentar

          Lädt...