PMS not advertising local IP when running under bhyve vm

server-freebsd

#1

I have been trying to wrap my head around this but here are the details:
- In most of my use cases, PlexPy shows 192.168.1.1 (my router) as client IP address when playing media from my local PMS instance.
- This happens when playing using Plex Home accounts on my Roku Sticks, Roku TV or Samsung Smart TV app (last year's generation, not the old app). This also happens when playing media from app.plex.tv using either my main plex.tv account or a Plex Home account.
- This doesn't happen when playing from my plex.tv main account on the above devices or when playing from my phone using either my main account or a Plex Home account or when playing from 192.168.1.65:32400/web/ using any account.
- DNS rebinding seems to work just fine.
- I have set 192.168.1.0/24 as my local network in PMS settings.
- I have set Secure connections to Preferred and my clients have Fallback to insecure connection on local network only.

So I have a few questions:
- Should playing from app.plex.tv be playing directly from my PMS local instance (i.e. should I be seeing my laptop's IP address in PlexPy).
- What difference is there between the main plex.tv account and Plex Home accounts that would explain a change in behavior on Roku and Samsung devices?
- What can I do to resolve this?


#2

It would normally be DNS Rebinding protection that is blocking the DNS lookup for the plex.direct url for the local IP address. When this happens, the client apps would look for another https route and that would be the remote access url which would reach the server through the public IP and public port. These can show up as coming in from the router gateway address as it turns the requests round

you can see what the routes are for your server by getting the resources.xml and then seeing what the plex .direct urls are
See https://support.plex.tv/hc/en-us/articles/206721658-Using-plex-tv-resources-information-to-troubleshoot-app-connections


#3

Hey @sa2000,

Thanks for the pointer. I had a look at the resources.xml file and there's no local='1' entry for my server, only a Connection node with my public IP address in it.

Looking at the logs, it seems to find the ethernet interface with the appropriate local IP:

Jan 09, 2018 13:37:34.716 [0x809e16000] DEBUG - Network interfaces:
Jan 09, 2018 13:37:34.716 [0x809e16000] DEBUG - * 1 vtnet0 (192.168.1.65) (loopback: 0)
Jan 09, 2018 13:37:34.716 [0x809e16000] DEBUG - * 2 lo0 (127.0.0.1) (loopback: 1)
[...]
Jan 09, 2018 13:37:38.199 [0x80aa37300] DEBUG - NAT: UPnP, found device http://192.168.1.1:5000/rootDesc.xml with private address <192.168.1.65>
Jan 09, 2018 13:37:38.202 [0x80aa37300] DEBUG - NAT: UPnP, usable device http://192.168.1.1:5000/rootDesc.xml with private address <192.168.1.65>.
Jan 09, 2018 13:37:38.203 [0x80aa37300] DEBUG - NAT: UPnP, public address is 98.207.232.xxx

These are the only references to the local IP address that I could find in Plex Media Server.log, unclear if there should be more.

I don't know if this is relevant but PMS runs in a bhyve VM on a FreeNAS server.


#4

This looks very similar to the symptoms reported here: https://forums.plex.tv/discussion/178017/cant-connect-to-pms-on-lan-but-fine-on-wan


#5

@flauran said:
Hey @sa2000,

Thanks for the pointer. I had a look at the resources.xml file and there's no local='1' entry for my server, only a Connection node with my public IP address in it.

Looking at the logs, it seems to find the ethernet interface with the appropriate local IP:

Jan 09, 2018 13:37:34.716 [0x809e16000] DEBUG - Network interfaces:
Jan 09, 2018 13:37:34.716 [0x809e16000] DEBUG - * 1 vtnet0 (192.168.1.65) (loopback: 0)
Jan 09, 2018 13:37:34.716 [0x809e16000] DEBUG - * 2 lo0 (127.0.0.1) (loopback: 1)
[...]
Jan 09, 2018 13:37:38.199 [0x80aa37300] DEBUG - NAT: UPnP, found device http://192.168.1.1:5000/rootDesc.xml with private address <192.168.1.65>
Jan 09, 2018 13:37:38.202 [0x80aa37300] DEBUG - NAT: UPnP, usable device http://192.168.1.1:5000/rootDesc.xml with private address <192.168.1.65>.
Jan 09, 2018 13:37:38.203 [0x80aa37300] DEBUG - NAT: UPnP, public address is 98.207.232.xxx

These are the only references to the local IP address that I could find in Plex Media Server.log, unclear if there should be more.

I don't know if this is relevant but PMS runs in a bhyve VM on a FreeNAS server.

I would have expected there to be a route to 192.168.1.65 as local=1
could you get the output from ifconfig -a showing all network interfaces

May be it is the way FreeBSD is configured


#6

Yes it does look like https://forums.plex.tv/discussion/comment/998946/#Comment_998946


#7

@sa2000 said:

I would have expected there to be a route to 192.168.1.65 as local=1
could you get the output from ifconfig -a showing all network interfaces

May be it is the way FreeBSD is configured

Sure, here goes:

root@plex:~ # ifconfig -a
vtnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=80028<VLAN_MTU,JUMBO_MTU,LINKSTATE>
    ether 00:a0:98:81:9f:73
    hwaddr 00:a0:98:81:9f:73
    inet 192.168.1.65 netmask 0xffffff00 broadcast 192.168.1.255
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    media: Ethernet 10Gbase-T <full-duplex>
    status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
    inet 127.0.0.1 netmask 0xff000000
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
    groups: lo

#8

Further testing, I've installed PMS in a jail instead to see if it makes any difference and it seems to work as expected.

I'm seeing a bunch of extra lines that seem relevant in the logs of that instance:

Jan 10, 2018 19:54:54.146 [0x80a900100] DEBUG - NetworkService: Browsing on interface 192.168.1.3 on broadcast address 192.168.1.255 (index: 0)
[...]
Jan 10, 2018 19:54:54.156 [0x80a900100] DEBUG - NetworkServiceBrowser: SERVER arrived: 192.168.1.3 (Vault (test))
Jan 10, 2018 19:54:54.156 [0x80a900100] DEBUG - Notifying the system bundle an update to server /system/notify/serverUpdated?host=192.168.1.3
Jan 10, 2018 19:54:54.156 [0x80a900100] DEBUG - [com.plexapp.system] Sending command over HTTP (GET): /system/notify/serverUpdated?host=192.168.1.3
Jan 10, 2018 19:54:54.157 [0x80a900100] DEBUG - HTTP requesting GET http://127.0.0.1:45320/system/notify/serverUpdated?host=192.168.1.3
[...]
Jan 10, 2018 19:54:54.273 [0x80a900100] DEBUG - HTTP 200 response from GET http://127.0.0.1:45320/system/notify/serverUpdated?host=192.168.1.3

This is the ifconfig output for that jail:

root@plex-test:~ # ifconfig
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
    inet 127.0.0.1 netmask 0xff000000
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
    groups: lo
epair0b: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=8<VLAN_MTU>
    ether a2:60:8c:84:21:5b
    inet 192.168.1.3 netmask 0xffffff00 broadcast 192.168.1.255
    nd6 options=9<PERFORMNUD,IFDISABLED>
    media: Ethernet 10Gbase-T (10Gbase-T <full-duplex>)
    status: active
    groups: epair

Can anybody familiar with that part of the PMS code take a guess at what's happening in the VM case?


#9

@flauran
I am moving this forum thread to the FreeBSD forum to help you get advice from other users

Obviously there are complexities within this environment


#10

Bueller? Anyone?


#11

I'm having this same issue. Are you guys installing this in an iocage jail on on 11.1?

plex.tv/pms/resources.xml shows no local IP address for this new server I have setup in my iocage jail.

I have the exact same setup on a 9.10 warden jail and it works fine, and resources.xml shows the local IP address as well.


#12

My chroot test was using the PMS FreeNAS plugin, so it does use warden. I haven't tried with iocage.


#13

@flauran said:

@sa2000 said:

I would have expected there to be a route to 192.168.1.65 as local=1
could you get the output from ifconfig -a showing all network interfaces

May be it is the way FreeBSD is configured

Sure, here goes:

root@plex:~ # ifconfig -a
vtnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
  options=80028<VLAN_MTU,JUMBO_MTU,LINKSTATE>
  ether 00:a0:98:81:9f:73
  hwaddr 00:a0:98:81:9f:73
  inet 192.168.1.65 netmask 0xffffff00 broadcast 192.168.1.255
  nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
  media: Ethernet 10Gbase-T <full-duplex>
  status: active
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
  options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
  inet6 ::1 prefixlen 128
  inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
  inet 127.0.0.1 netmask 0xff000000
  nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
  groups: lo

and the linked related forum topic https://forums.plex.tv/discussion/comment/998946/#Comment_998946
which confirmed getting round the problem by switching from vnet to eth

Had other reports of this issue and it does appear to be because the adapter name starts with a v and Plex Media Server does look for these and skip them - see if you can rename the adapter to eth0 or similar


#14

Hi Brandon here, iocage is my tool. Suffice to say this has had me running around with my hair on fire ;)

Is there any technical reason you guys skip this? eth0 is not a typical interface on FreeBSD. While we can work around that for users of FreeNAS, anybody using iocage on plain FreeBSD may get bit by this oddness.


#15

@skarekrow said:
Hi Brandon here, iocage is my tool. Suffice to say this has had me running around with my hair on fire ;)

Is there any technical reason you guys skip this? eth0 is not a typical interface on FreeBSD. While we can work around that for users of FreeNAS, anybody using iocage on plain FreeBSD may get bit by this oddness.

The change was done years ago to avoid picking VMware interfaces

Adapters with name starting with letter v are ignored


#16

@sa2000 said:

@skarekrow said:
Hi Brandon here, iocage is my tool. Suffice to say this has had me running around with my hair on fire ;)

Is there any technical reason you guys skip this? eth0 is not a typical interface on FreeBSD. While we can work around that for users of FreeNAS, anybody using iocage on plain FreeBSD may get bit by this oddness.

The change was done years ago to avoid picking VMware interfaces

Adapters with name starting with letter v are ignored

So this has caused myself about a week of trying everything under the sun to figure out why Plex was not getting a local IP in my iocage jail, but was fine everywhere else.

Might I suggest tightening the rules around ignoring vmware interfaces? Or at least documenting this somewhere.


#17

@sa2000 said:

The change was done years ago to avoid picking VMware interfaces

Adapters with name starting with letter v are ignored

Ok, I can confirm that renaming the interface solves the issue. I would suggest making the exclusion a bit more specific as mentioned by bwegrzyn above. Here's the /etc/rc.conf fix on my end for future reference. It's nothing complicated when you know what the issue is.

ifconfig_vtnet0_name="net0"
ifconfig_net0="192.168.1.65"