rcelyte / BeatUpRcelyte

A lightweight modded Beat Saber multiplayer server
The Unlicense
17 stars 5 forks source link

Cannot start server #8

Closed geman220 closed 1 year ago

geman220 commented 1 year ago

Compiled fine on Ubuntu 22.04, but cannot start due to the following error:

~/BeatUpRcelyte$ ./beatupserver [net.c] Failed to open TCP socket: Address family not supported by protocol

Here is my beatupserver.json (Obviously my address is my public IPv4 address normally) { "instance": { "address": ["11.111.11.111", "[::]"], "count": 1 }, "master": {}, "status": { "url": "http://localhost" } }

rcelyte commented 1 year ago

Might be an IPv6 issue. Try running with ./beatupserver --ipv4

geman220 commented 1 year ago

Thanks, it was due to IPv6 being disabled on my Ubuntu install. Enabling IPv6 resolved the issue. I would assume passing --ipv4 would have resolved it as well. That being said, going to myip:5000 doesn't work (port is forwarded) and in the console I see the following on each page refresh:

[wire.c] wire_accept(9) failed

rcelyte commented 1 year ago

The website is hosted on port 80. Port 5000 is the lobby host.

geman220 commented 1 year ago

Is it possible to run the website on a different port? With localhost:port?

rcelyte commented 1 year ago

yes.

geman220 commented 1 year ago

I appreciate the help, just to validate my Beat Together.json should read as follows:

{ "SelectedServer": "SelfHost", "Servers": [ { "ServerName": "SelfHost", "HostName": "MediaServer", "Port": 5000, "StatusUri": "http://myDNS:3131/status", } ] }

rcelyte commented 1 year ago
geman220 commented 1 year ago

The HostName should be the IP or domain name of the server, where? Like the WAN side IP / Domain or the LAN side IP / Domain name.

rcelyte commented 1 year ago

The same domain you set in StatusUri

geman220 commented 1 year ago

Can't connect in Beat Saber, the server is unreachable. It could be a NAT hairpin issue potentially.

I'm assuming this json is accurate at least. If it's a hairpin issue I should be able to use my LAN IPs, and send this config to others.

{ "ServerName": "SelfHost", "HostName": "domainname.duckdns.org", "Port": 2328, "StatusUri": "http://domainname.duckdns.org:3131", "MaxPartySize": 5 } ] }

Edit: Should mention 3131 is forwarded and working, I forwarded 2328 as well.

rcelyte commented 1 year ago

Did you forward 5000 (note that 5000 and 2328 are UDP ports)?

geman220 commented 1 year ago

Yes 5000, 3131, and 2328 are all forwarded to 192.168.0.37 TCP/UDP

geman220 commented 1 year ago

So I setup the .json to use local IPs on the LAN, which I assume should work (obviously only locally and not over WAN but just to validate configuration). I see this error in the console:

[master.c] BAD MESSAGE TYPE: 0 is spammed a lot followed by:

`[master.c] BAD MESSAGE TYPE: 0 [master.c] Invalid serial length: 11864 [pool.c] 1 room open [wire.c] wire_send_local(WireRoomSpawn) [instance.c] opening room (0,0) [instance.c] state (none) -> Lobby.Idle [net.c] MTU 0 -> 445

[instance.c] player slots (1/4): [⠁] [wire.c] wire_send_local(WireRoomSpawnResp) [master.c] Sending player to room A `

rcelyte commented 1 year ago

What error (CFR-, MUR-, DCR-) specifically does Beat Saber give you? Does it work with the address field in beatupserver.json set to the server's local IP instead of public?

geman220 commented 1 year ago

domainname.duckdns.org

CFR-3 Server Unreachable

geman220 commented 1 year ago

[master.c] Invalid serial length: 11864 [pool.c] 1 room open [wire.c] wire_send_local(WireRoomSpawn) [instance.c] opening room (0,0) [instance.c] state (none) -> Lobby.Idle [net.c] MTU 0 -> 445

[instance.c] player slots (1/4): [⠁] [wire.c] wire_send_local(WireRoomSpawnResp) [master.c] Sending player to room A [wire.c] wire_accept(6) failed [instance.c] session timeout [instance.c] disconnect AF_UNSPEC [instance.c] player slots (0/4): [⠀] [instance.c] closing room (0,0) [wire.c] wire_send_local(WireRoomCloseNotify) [pool.c] 0 rooms open

Seems like I'm connecting, it's saying 1/4, trying to send me to Room A then fails.

rcelyte commented 1 year ago

CFR-3 means the instance's address is either set wrong or unreachable due to firewall issues and such.

geman220 commented 1 year ago

Do the session logs not imply that I am successfully connecting here?

[instance.c] player slots (1/4): [⠁] [wire.c] wire_send_local(WireRoomSpawnResp) [master.c] Sending player to room A

I am certain the ports are forwarded, I've also validated again here https://canyouseeme.org/

rcelyte commented 1 year ago

All those messages come from the master server connection. Your game's messages are never reaching the instance.

geman220 commented 1 year ago

Resolved, the issue was address on the beatupserver.json was set to my WAN IP. I assumed that wouldn't be an issue since it's a local file I don't care about obscuring it at all, but if you use a DNS in BeatTogether.json you also need to use DNS in beatupserver.json

Thanks for the help!