Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't connect to host behind NAT after change by not reporting ExternalIP #1453

Closed
3 tasks done
neatnoise opened this issue Jul 18, 2023 · 9 comments
Closed
3 tasks done
Labels
network Network issue stale

Comments

@neatnoise
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Is your issue described in the documentation?

  • I have read the documentation

Is your issue present in the nightly release?

  • This issue is present in the nightly release

Describe the Bug

Can't connect to host behind NAT after change by not reporting ExternalIP.
I have a host behind NAT and my clients can't find the host through the internet.
My setup: client->internet->vps server->vpn network->local network-> host
Please revert this change 25e0244

Expected Behavior

Client can find external internet ip and connect to it

Additional Context

No response

Host Operating System

Linux

Operating System Version

Arch Linux with all updates

Architecture

64 bit

Sunshine commit or version

nightly and master

Package

Linux - AUR (Third Party)

GPU Type

AMD

GPU Model

AMD Radeon RX 580

GPU Driver/Mesa Version

Latest mesa git from arch repo http://pkgbuild.com/~lcarlier/$repo/$arch

Capture Method (Linux Only)

Wayland

Config

file_state = /home/tomek/.config/sunshine/sunshine_state_tm.json
amd_rc = auto
encoder = vaapi
nv_preset = default
resolutions = [
    1280x720,
    1920x1080
]
cert = /home/tomek/.config/sunshine/credentials_tm/cacert.pem
pkey = /home/tomek/.config/sunshine/credentials_tm/cakey.pem
qp = 25
channels = 3
nv_rc = auto
hevc_mode = 0
fps = [60]
output_name = 0
min_log_level = 2
external_ip = ip
amd_quality = default

Apps

No response

Relevant log output

lip 18 17:18:12 tm-stc sunshine[14285]: [2023:07:18:17:18:12]: Warning: vaapi: h264 missing sps->vui parameters
lip 18 17:18:12 tm-stc sunshine[14285]: [2023:07:18:17:18:12]: Warning: vaapi: hevc missing sps->vui parameters
lip 18 17:18:12 tm-stc sunshine[14285]: [2023:07:18:17:18:12]: Info: // Testing for available encoders, this may generate errors. You can safely ignore those errors. //
lip 18 17:18:12 tm-stc sunshine[14285]: [2023:07:18:17:18:12]: Info:
lip 18 17:18:12 tm-stc sunshine[14285]: [2023:07:18:17:18:12]: Info: // Ignore any errors mentioned above, they are not relevant. //
lip 18 17:18:12 tm-stc sunshine[14285]: [2023:07:18:17:18:12]: Info:
lip 18 17:18:12 tm-stc sunshine[14285]: [2023:07:18:17:18:12]: Info: Found encoder vaapi: [h264_vaapi, hevc_vaapi]
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: CLIENT CONNECTED
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: Found display [wayland-0]
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: Found interface: zxdg_output_manager_v1(32) version 3
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: Found interface: wl_output(48) version 4
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: Offset: 0x0
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: Resolution: 1280x720
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: Name: DVI-D-1
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: Found monitor: LG Electronics 23EA63/309NDPHK7144
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: DVI-D-1: LG Electronics 23EA63/309NDPHK7144
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Warning: Mismatch on expected Resolution compared to actual resolution: 1920x1080 vs 1280x720
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: Screencasting with KMS
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: Found monitor for DRM screencasting
lip 18 17:18:13 tm-stc sunshine[14285]: Xlib:  extension "DRI2" missing on display ":0".
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: Setting default sink to: [sink-sunshine-stereo]
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: Found default monitor by name: sink-sunshine-stereo.monitor
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: SDR color coding [Rec. 601]
lip 18 17:18:13 tm-stc sunshine[14285]: [2023:07:18:17:18:13]: Info: Color range: [MPEG]
lip 18 17:18:13 tm-stc sunshine[14285]: Xlib:  extension "DRI2" missing on display ":0".
lip 18 17:18:27 tm-stc sunshine[14285]: [2023:07:18:17:18:27]: Info: CLIENT DISCONNECTED
lip 18 17:18:27 tm-stc sunshine[14285]: [2023:07:18:17:18:27]: Info: Setting default sink to: [alsa_output.pci-0000_00_14.2.iec958-stereo]
@neatnoise
Copy link
Author

Manually reverting/patching src/nvhttp.cpp fixes issue. So it is a root cause

@ReenigneArcher
Copy link
Member

Please provide the commit for reference.

@neatnoise
Copy link
Author

Please provide the commit for reference.

This is the commit 25e0244

@ReenigneArcher ReenigneArcher added the network Network issue label Jul 18, 2023
@cgutman
Copy link
Collaborator

cgutman commented Jul 19, 2023

Please provide specifics about which addresses are used by each hop between client and server and what address was being advertised by Sunshine prior to the change.

How do your clients discover your host initially? Remember that this serverinfo page is only accessible if you already know the server's IP address. If your clients can reach the server to get the updated ExternalIP value, then they don't need it because they can already talk to the server.

Moonlight will perform STUN requests on behalf of the host when you're on the same RFC1918 subnet to identify the WAN address and remember it for future use. Moonlight also remembers the address you use when adding the PC. If you're port forwarding through the VPS to you just specify the WAN address of the VPS and Moonlight remembers it

@neatnoise
Copy link
Author

neatnoise commented Jul 20, 2023

Please provide specifics about which addresses are used by each hop between client and server and what address was being advertised by Sunshine prior to the change.

How do your clients discover your host initially? Remember that this serverinfo page is only accessible if you already know the server's IP address. If your clients can reach the server to get the updated ExternalIP value, then they don't need it because they can already talk to the server.

Moonlight will perform STUN requests on behalf of the host when you're on the same RFC1918 subnet to identify the WAN address and remember it for future use. Moonlight also remembers the address you use when adding the PC. If you're port forwarding through the VPS to you just specify the WAN address of the VPS and Moonlight remembers it

I add a client when a client is in the same subnet as host. Previously it used ExternalIP value (when it was exposed) from the host to remember the internet public IP.

The communication when the client is not in the same subnet is:
client->internet->vps server->vpn network->local network-> host
VPS server is not a default gateway for the host in my setup. It just connects site-to-site local LAN networks in the different locations by using VPN software (VPS server is main VPN network router). On the VPS server i just have port forwarding configured from VPS external IP to the host in the one of the local networks through the VPN.

I think in my setup there is no other way to get WAN IP other than the exposed ExternalIP field because VPS server is not the default gateway for the my host in local network. Each local network connected site-to-site has got its own seperate local default internet gateway

@neatnoise
Copy link
Author

neatnoise commented Sep 7, 2023

Could you apply this patch please? It solves the issue

--- Sunshine/src/nvhttp.cpp	2023-07-04 18:08:31.176849000 +0200
+++ nvhttp.cpp	2023-07-18 18:07:09.587892000 +0200
@@ -632,6 +632,10 @@
       tree.put("root.ServerCodecModeSupport", "3");
     }
 
+    if (!config::nvhttp.external_ip.empty()) {
+      tree.put("root.ExternalIP", config::nvhttp.external_ip);
+    }
+
     pt::ptree display_nodes;
     for (auto &resolution : config::nvhttp.resolutions) {
       auto pred = [](auto ch) { return ch == ' ' || ch == '\t' || ch == 'x'; };

@LizardByte-bot
Copy link
Member

It seems this issue hasn't had any activity in the past 90 days. If it's still something you'd like addressed, please let us know by leaving a comment. Otherwise, to help keep our backlog tidy, we'll be closing this issue in 10 days. Thanks!

@LizardByte-bot
Copy link
Member

This issue was closed because it has been stalled for 10 days with no activity.

@LizardByte-bot LizardByte-bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 18, 2023
@neatnoise
Copy link
Author

+    }

Hello, I still apply this patch when I build sunshine. I can't access the machine without it when I connect through the internet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
network Network issue stale
Projects
None yet
Development

No branches or pull requests

4 participants