nfsuserver icon indicating copy to clipboard operation
nfsuserver copied to clipboard

Port Forwarding

Open MrPalloncini opened this issue 4 years ago • 16 comments

Hi, i'm trying to host a server on a linux VPS, the client connects but the server doesn't log the connection even if i'm using verbose and nfs says that "there was a communication issue with the isp". The ports i opened are 10800, 10900, 10901 and 10980 and i can "connect" to the server with netcat. What can i do to make this work?

MrPalloncini avatar Jan 09 '21 01:01 MrPalloncini

How it works.

When you add new server in nfsuclient.exe it's status should be shown there:

изображение

If you click Use server button a new text line should be added to the file C:\Windows\System32\drivers\etc\hosts (and delete when de-select server)

127.0.0.1	ps2nfs04.ea.com

Actually nfsuclient creates a proxy on localhost which redirects all traffic to a server ip. This program is a launcher, so you can exclude it from the chain and just replace 127.0.0.1 to your server ip in hosts file.

Why it does not work for you? May be hosts file is not modified or firewall blocking NFSU game or wrong port forwarding (make sure UDP is included).

Ports used by the server

10900 TCP
10901 TCP
10980 TCP
10800 TCP/UDP

HarpyWar avatar Jan 09 '21 13:01 HarpyWar

By analyzing the packets i noticed that the server gives to NFS the local IP address for the session and not the public one (the server is under NAT), i've got those results by bypassing the redirect client by adding the server IP to the hosts file as you said. I've also checked the ports by connecting to them via netcat and the port forwarding works both on tcp and udp. I suspect that the problem is that the server returns the local ip to nfs and it doesn't know what to do with it.

photo_2021-01-09_18-20-12

MrPalloncini avatar Jan 09 '21 17:01 MrPalloncini

Try replace this line https://github.com/HarpyWar/nfsuserver/blob/90052b7b4e1f5262b8434377237efab013ca536b/nfsuserver/nfsuserver2.cpp#L334 directly to your server external IP address

sprintf(arr2[0], "ADDR=94.36.179.230");

If it will work we can add a new option for external ip in config.

HarpyWar avatar Jan 09 '21 18:01 HarpyWar

it works just fine now thank you

MrPalloncini avatar Jan 09 '21 18:01 MrPalloncini

I made some changes in server, including option serverexternalip for that purpose. Please, try it and tell does NAT work properly. https://github.com/HarpyWar/nfsuserver/releases

Note about new config file names in new version nfsu.ini -> nfsu.conf and news -> news.txt.

Also I updated nfsuclient. Global server list is working now and there is a button to download ready to play NFSU game v1.4 with noCD and Widescreen with HD resolution https://github.com/HarpyWar/nfsuserver/releases/download/client/nfsuclient.exe

HarpyWar avatar Jan 11 '21 18:01 HarpyWar

compiling the server with make says: nfsuserver2.cpp:1716:25: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if (Server.ServerIP == '\0') adding -fpermissive to CFLAGS in Makefile fix this.

After some testing with friends i've found that the server only accepts connections for max two players and most of the times it says that there is a firewall issue, i've checked and disabled all firewalls but the issue persists. I've gathered some data that shows me that nfs tries to ping and connect to the port 3658 UDP and the server refuses the packet

MrPalloncini avatar Jan 11 '21 21:01 MrPalloncini

if (Server.ServerIP == '\0')

Miss it, fixed.

After some testing with friends i've found that the server only accepts connections for max two players and most of the times it says that there is a firewall issue, i've checked and disabled all firewalls but the issue persists. I've gathered some data that shows me that nfs tries to ping and connect to the port 3658 UDP and the server refuses the packet

Does it happen in the current version or un the previous too?

HarpyWar avatar Jan 11 '21 21:01 HarpyWar

Also try with my test server 78.47.164.88 to check the problem with NAT or not only.

HarpyWar avatar Jan 12 '21 08:01 HarpyWar

so me and my friends tested your server, we connected to it using nfsuclient and we found the following: -the connection to the server works great we are able to create rooms -when we try to play a game most of the times the client says that there is a firewall issue, but there is no firewall preventing us to connect to each others -sometimes the firewall issue disappears but we don't know what causes it

we logged nfs u connections and we found that the clients connect to each other and exchange udp packets by the port 3658 but like i said most of the times the client send a packet and it recives no response from the other client and vice versa. When the connection goes through if there are 3 or more clients only two (the host and the lucky one that gets the port to respond) are able to play while the rest are kicked out of the lobby with the firewall message.

here is a wireshark and a procmon log of nfsu when the firewall kicks, the same messages are present on the other client that is playing with me

image_2021-01-13_22-06-12

i also have an issue with the client that antivirus is blocking the file, this might be caused by the "Get Game" feature

MrPalloncini avatar Jan 13 '21 21:01 MrPalloncini

I 'm not author of the server and I don't know how the NFSU protocol works. Judging by your description it should work like Starcraft, when a server is just a lobby and all game traffic is transferred between players, like p2p connections or one is host and others are clients. May be router is the issue, not only a computer's firewall.

To understand this better, you can try different scenarios. For example, create a game by each player, and try to connect to the host and play by each others. Start with 2 players in a game then increase by 1 to detect a player (or players) with bad connectivity.

i also have an issue with the client that antivirus is blocking the file, this might be caused by the "Get Game" feature

That button should not be a reason. The new version was compiled to run force with Administrator rights, unlike the previous. It can be detected as Malicious because it modifies hosts file, I don't see much differences on Virustotal analysing: Old https://www.virustotal.com/gui/file/7d44fd5caf8c78974d62ff8d0d0a933a232339447928aa4be3400219fb50ac9d/detection New https://www.virustotal.com/gui/file/0df5e57ae1651c67235c612264adffc13a321cab41d03c8dab9de2053fbea20f/detection

Which antivirus do you use?

HarpyWar avatar Jan 13 '21 22:01 HarpyWar

windows defender as the antivirus

we already tried to do as you said but it doesn't change anything, we only know that with a vpn the server works, anyway thank you very much for your support, if you need more testing and info we will look into it

MrPalloncini avatar Jan 13 '21 22:01 MrPalloncini

I very thank you . you update this server. I really love this game. But I cant play online . I cant open nfsuserver_svc.exe. I really really want play online . Can you help me . By the way . I am Taiwan. Eng no good . If you want tecah me . May you use vedio teach . I thank you very murch.

yesorno1227 avatar Sep 18 '22 15:09 yesorno1227

@yesorno1227 nfsuserver_svc.exe is special build which can not be started as regular application, but it can be installed as Windows service. Run nfsuserver_svc.exe -i to install the service. It's mentioned in readme of the repository.

HarpyWar avatar Sep 19 '22 10:09 HarpyWar

I cant play online First I need Dowdlow which ? and second how to do Can you teach me please. I want play online.

yesorno1227 avatar Oct 06 '22 03:10 yesorno1227

Hi, I can Confirm that the version 1.0.5 server it's working OK. Take in mind the next things

In the PC that have the server (no the race/game) must have the ports open: 10900-10901 TCP 10980 TCP 10800 TCP/UDP

The PC that create the game (race) must have open: 3658 UDP

The rest of the client that connect to that game, don't need any port open. And finally IMPORTANT The PC that create the game CAN'T BE in the same network where the Server is running (same public IP) because it's not going to work.

Then the Client like HarpyWar say, it's just a server list that put the public IP (of the server) in the Hosts file, you can do it manually:

XXX.XXX.XXX.XXX ps2nfs04.ea.com

And thats all, the game runs OK, in all terms. We try different game styles, with 2 3 or 4 players, all different public IPs then two in the same public IP, and different combinations, and in all cases the performance and races where OK.

Best Regards.

geckotdf avatar Feb 28 '23 20:02 geckotdf

Can you teach with youtube? i really want to play please

yesorno1227 avatar Aug 12 '23 09:08 yesorno1227