jhead / phantom

Use your own Minecraft server with your Xbox or PS4 and play with friends!
MIT License
613 stars 76 forks source link

How do you join servers with other ports than 19132 #115

Open Meloooche opened 4 years ago

Meloooche commented 4 years ago

Hi every server with the port 19132 works perfectly fine for me but as soon as i try to join my dedicated server that does not have the port 19132 it does not allow me to join it says the server is outdated yet it is running on 1.16.2

azariah001 commented 3 years ago

Hi @Meloooche

It sounds like you may have changed one too many options in your bedrock server file although TBH I don't know precisely how.

So 19132 is a port that all bedrock servers will use to broadcast stats like the number of connected players, running version etc. It should always be open, unless, the server has been set to not broadcast to LAN in which case the server simply won't show on Xbox or Playstation even when phantom is connected.

Now, something I have just noticed with my server hoster is that the port number in my actual config file, and the port we use to connect to the server are different which means that they're redirecting external incoming ports to different servers on the local network, handy because you don't have to pay for multiple public IP addresses that way. However, it means that if I try to change that port I'll just straight up break access to my server and... potentially break someone else's instance on the same server box. I imagine they have safeguards to prevent total breakage, but if you're using a hoster you may want to talk to them about how to change the port.

However, if you're self-hosting or using a VPS of some description then you'll just want to make sure that the server is set to broadcast on LAN.

JasonFPV1 commented 3 years ago

I'm self hosting a server with a port besides 19132 open on my router, so 19132 is closed. I have someone else with phantom running elsewhere with a successful connection to an xbox, but I don't think it's connected to my computer I'm hosting from. How can I get it to work with the different ports? I changed the port in server.properties.txt and it does work, I've had other people successfully connect without phantom, but I need to use phantom in this instance.

azariah001 commented 3 years ago

Hi @JasonFPV1 sounds like you need to specificy the port when you launch phantom. Your connection command should look something like.

./phantom -server example.com:25500

JasonFPV1 commented 3 years ago

Hi @JasonFPV1 sounds like you need to specificy the port when you launch phantom. Your connection command should look something like.

./phantom -server example.com:25500

Thanks for the speedy reply, I was using phantom-windows.exe NumbersForMyPcIp:port and it didn't work. Edit: everything is done on Win10 btw

azariah001 commented 3 years ago

Ah... Windows. Have you checked your firewall settings? You may need to put the phantom executable in a more permanent location, say in a folder in program files or in the root of your user folder, then go to the windows firewall and add explicit rules for Phantom to be able to make itself known on the network.

I'm utilising phantom on Linux on a Raspberry Pi so haven't had to deal with firewall shenanigans myself

JasonFPV1 commented 3 years ago

Ah... Windows. Have you checked your firewall settings? You may need to put the phantom executable in a more permanent location, say in a folder in program files or in the root of your user folder, then go to the windows firewall and add explicit rules for Phantom to be able to make itself known on the network.

I'm utilising phantom on Linux on a Raspberry Pi so haven't had to deal with firewall shenanigans myself

Yeah, we tried disabling windows firewall entirely and it didn't have any effect. I feel like that isn't the issue though, I thought it would have something to do with the ports, etc.

azariah001 commented 3 years ago

Yeah so... Windows firewall is annoying but entirely essential so please don't disable it. I find most issues I have with Windows Firewall are caused by it incorrectly detecting whether a network is Public or Private so I (very unwisely) usually end up allowing a program to do its thing on both network types.

Now I'm thinking that what is probably happening is that the "allow an app or feature through Windows Defender Firewall" area of control panel only adds permissions for outbound connection from an application on your machine to the network and internet at large. And if I had to guess "disabling" windows firewall may actually protect the user by only disabling the outbound firewall leaving the inbound firewall enabled (note this is a guess).

So to get this working you'll likely need to go to the Windows Defender Firewall section of Control Panel then on the left side select Advanced Settings (should be second from the bottom) and add an explicit inbound rule for phantom.

This is done by selecting Inbound Rules in the left sidebar, then right-clicking Inbound Rules and selecting the first option, New Rule.

The above is a simplification of this tom'sHardware article.

In this prompt, I would still select program and tie it to the phantom executable, because phantom likes to dynamically pick which port it publishes a server on each time it starts because it's written so that it's possible to run multiple server connections off the one machine. Also avoids conflicts with other software running on the machine.

However, if you're still having issues it might be worth trying to set a static inbound port to open in the firewall and tie phantom to that port with the -bind_port 12345 flag, although I note that JHead does generally advise against using the -bind_port option if possible.

JasonFPV1 commented 3 years ago

Yeah so... Windows firewall is annoying but entirely essential so please don't disable it. I find most issues I have with Windows Firewall are caused by it incorrectly detecting whether a network is Public or Private so I (very unwisely) usually end up allowing a program to do its thing on both network types.

Now I'm thinking that what is probably happening is that the "allow an app or feature through Windows Defender Firewall" area of control panel only adds permissions for outbound connection from an application on your machine to the network and internet at large. And if I had to guess "disabling" windows firewall may actually protect the user by only disabling the outbound firewall leaving the inbound firewall enabled (note this is a guess).

So to get this working you'll likely need to go to the Windows Defender Firewall section of Control Panel then on the left side select Advanced Settings (should be second from the bottom) and add an explicit inbound rule for phantom.

This is done by selecting Inbound Rules in the left sidebar, then right-clicking Inbound Rules and selecting the first option, New Rule.

The above is a simplification of this tom'sHardware article.

In this prompt, I would still select program and tie it to the phantom executable, because phantom likes to dynamically pick which port it publishes a server on each time it starts because it's written so that it's possible to run multiple server connections off the one machine. Also avoids conflicts with other software running on the machine.

However, if you're still having issues it might be worth trying to set a static inbound port to open in the firewall and tie phantom to that port with the -bind_port 12345 flag, although I note that JHead does generally advise against using the -bind_port option if possible.

Wow, lots of info here, thanks. I'll try all this tomorrow. Also, I just had the firewall disabled to see if it was the issue, then was going to create an exception. it's reenabled now.

jhead commented 3 years ago

Hey @JasonFPV1, just to confirm:

+1 on the firewall advice from @azariah001 above but please note: phantom requires port 19132 to be open on the computer running phantom, regardless of what port the server is using. Using -bind_port will not change this requirement. If you use -bind_port, you will need to open two ports in your friend's firewall (19132 and the other port). Also, these ports are UDP not TCP!

Otherwise, it's tough to diagnose what's happening without having a full view of the network in question. I'd normally suggest trying from a different game client like a phone or even the Windows 10 edition (though the latter can be finicky too).

edit: also trying a different server can be useful too.

azariah001 commented 3 years ago

Just found that JHead does provide some other information in this regard at the bottom of the readme.

Note that you almost definitely need to create a firewall rule for this to work. On macOS, you'll be prompted automatically. On Windows, you may need to go into your Windows Firewall settings and open up all UDP ports for phantom.

And I type this as JHead responds. Thank you @jhead.

JasonFPV1 commented 3 years ago

Hey @JasonFPV1, just to confirm:

  • your server is hosted on your network
  • your friend is running phantom on a Windows PC on their own network
  • your friend is trying to connect from their Xbox

+1 on the firewall advice from @azariah001 above but please note: phantom requires port 19132 to be open on the computer running phantom, regardless of what port the server is using. Using -bind_port will not change this requirement. If you use -bind_port, you will need to open two ports in your friend's firewall (19132 and the other port). Also, these ports are UDP not TCP!

Otherwise, it's tough to diagnose what's happening without having a full view of the network in question. I'd normally suggest trying from a different game client like a phone or even the Windows 10 edition (though the latter can be finicky too).

edit: also trying a different server can be useful too.

Yeah, that information is correct, thanks. So I need to open port/firewall 19132 on my friends pc, then use the standard phantom command (no other flags like bind_port) with my ip and non-19132 port?

jhead commented 3 years ago

So I need to open port/firewall 19132 on my friends pc, then use the standard phantom command (no other flags like bind_port) with my ip and non-19132 port?

Sounds correct to me! Just make sure it’s UDP (or both).

If that doesn’t work, I’m not sure off the top of my head what could be wrong but we can keep trying various troubleshooting techniques, if you want.

JasonFPV1 commented 3 years ago

So I need to open port/firewall 19132 on my friends pc, then use the standard phantom command (no other flags like bind_port) with my ip and non-19132 port?

Sounds correct to me! Just make sure it’s UDP (or both).

If that doesn’t work, I’m not sure off the top of my head what could be wrong but we can keep trying various troubleshooting techniques, if you want.

Thanks so much! I'll try it out tomorrow and report back.

JasonFPV1 commented 3 years ago

Alright, I created inbound and outbound rules to open port 19132 (UDP) on my friends pc, but it didn't solve the issue. The phantom command I'm using is just phantom-windows.exe MyIp:My(non19132)ServerPort.

I also opened the port that my server is hosted on (on my friends pc) and that didn't help either. Is there a way I can check if I'm getting a connection to my server from his laptop?

image

I'm getting this when starting phantom, then some sent and received repeated messages when Minecraft opens.

We found another solution that doesn't involve the Xbox, so unless you all recognize something that you're sure is the problem, I'm just going to leave it at that. Thanks for all the help!

azariah001 commented 3 years ago

Hi @JasonFPV1, So highlighting some lines from the output here.

Binding ping server to port 19132 This one's fine because you've opened that port. And this enables Minecraft clients on the network to discover servers proxied by phantom.

Binding proxy server to: 0.0.0.0:50191 This is likely what's causing you issues. This is the dynamic port use I described previously. Without this port open the specific server you're proxying won't be available as this is the port all of the game traffic goes through. However, as this port changes each time you launch phantom I would suggest in this case to use -bind_port 50191 to prevent phantom from using other ports on subsequent launches. Note that 19132 is still utilised even when -bind_port is used.

JasonFPV1 commented 3 years ago

Hi @JasonFPV1, So highlighting some lines from the output here.

Binding ping server to port 19132 This one's fine because you've opened that port. And this enables Minecraft clients on the network to discover servers proxied by phantom.

Binding proxy server to: 0.0.0.0:50191 This is likely what's causing you issues. This is the dynamic port use I described previously. Without this port open the specific server you're proxying won't be available as this is the port all of the game traffic goes through. However, as this port changes each time you launch phantom I would suggest in this case to use -bind_port 50191 to prevent phantom from using other ports on subsequent launches. Note that 19132 is still utilised even when -bind_port is used.

Ah, thanks. So I should be able to just use -bind_port 50191 and open that port in the firewall, and it should work?