Pocketmine-mp: Unable to detect the IP properly if there's more than one adapter

Created on 28 Jan 2019  路  3Comments  路  Source: pmmp/PocketMine-MP

Issue description

  • Expected result: The server was supposed to be able to port-forward with UPnP without any problems
  • Actual result: The server fails to detect its proper internal IP, failing to UPnP port-forward while the process was successful.

As mentioned on Discord, this also happens with install wizard ip detection.

Steps to reproduce the issue

  1. Have more than one IP (network adapter) on the machine
  2. Enable UPnP port-forwarding on pocketmine.yml
  3. Run server
  4. The server says the port-forwarding was successful but you can't join nor see MOTD
  5. Disable other network adapters except the main one
  6. Run server again
  7. The UPnP works like a charm

OS and versions

  • PocketMine-MP: 3.5.7
  • PHP: 7.2.14
  • Server OS: Windows 10
  • Game version: PE/Win10 (delete as appropriate)

Plugins

  • If you remove all plugins, does the issue still occur? Yes
  • If the issue is not reproducible without plugins:

    • Have you asked for help on our forums before creating an issue?

    • Can you provide sample, minimal reproducing code for the issue? If so, paste it in the bottom section

Crashdump, backtrace or other files


Network Fixed

Most helpful comment

Apparently there's a nice function gethostbynamel() which returns a list of internal IP addresses. Unfortunately, it seems that trying to portforward to one wacky IP address breaks UPnP forwarding for all the other addresses. I'm experiencing this currently with VirtualBox net adapter in the way. I'm still trying to get to the bottom of that.

All 3 comments

To clarify, this problem only occurs when your desired network adapter does not have the highest priority on the list. I personally experienced this with a VirtualBox adapter that jumped to the top of a list of several adapters, and UPnP would not work as expected until that adapter was disabled.

Apparently there's a nice function gethostbynamel() which returns a list of internal IP addresses. Unfortunately, it seems that trying to portforward to one wacky IP address breaks UPnP forwarding for all the other addresses. I'm experiencing this currently with VirtualBox net adapter in the way. I'm still trying to get to the bottom of that.

Turns out the cause is pretty obvious... you can't map a port to more than 1 IP at a time. This means it's necessary to find some other way to identify the correct internal IP address.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VCraftMCPE picture VCraftMCPE  路  20Comments

zKoz210 picture zKoz210  路  23Comments

MisteFr picture MisteFr  路  18Comments

L3ice picture L3ice  路  21Comments

Sandertv picture Sandertv  路  37Comments