wiki/Headset-and-ALVR-streamer-on-separate-networks.md
Here are explained two methods to connect PC and headset remotely, port-forwarding and ZeroTier. The primary purpose of this is connecting the headset to a Cloud PC (like ShadowPC).
LICENSE in this GitHub repository for legal text/definition). You are on your own (especially if you run ALVR over the Internet without VPN).Port-forwarding allows to connect devices that are behind different NATs, i.e. local networks. You need to have administrator access to your router. This method has the best streaming performance.
IMPORTANT: ALVR does not use end-to-end encryption of the stream data. By using this method you need to be aware that the connection is vulnerable to "Man In The Middle" attacks.
Add device manually. Fill in the fields with a name for your headset (you can use the name you want), the hostname (you can read it in the welcome screen in your headset when you open the ALVR app), the remote IP of the headset (that is the IP you got on step 1.) and then press Save.You can now use ALVR to connect to your remote PC.
Note: The public IP can change often. Every time you want to use ALVR you need to check that your current public IP is the same as the last time. If the IP changed, you can update it using the "Edit connection" interface, accessed with the Edit button next to your headset name on the streamer.
ZeroTier is a tunneling software that makes remote devices connect to each other as if they are in the same local network.
Comparing this to the port-forwarding method:
Pros:
Cons:
Use the "Install APK" function of SideQuest to install the ZeroTier APK to your Quest, and also download and install ZeroTier on your PC. After you've installed ZeroTier, follow Zerotier's official Getting Started guide to setup a network for ALVR. Join the network on both the Quest and the PC. On the Quest, make sure that the network is enabled by switching on the slider on the network in the list in the ZeroTier app (you may be prompted to allow ZeroTier to create a VPN connection).
After both your PC and your Quest are connected to the same ZeroTier network, we'll need to manually add your quest to the ALVR dashboard. To do so, we'll need to find your Quest's ZeroTier IP. There are two ways to do this.
The IP should look something like this 192.168.143.195. If there's a / at the end with a couple numbers following it, remove them along with the slash.
Next, we'll need to add the Quest to the ALVR dashboard. On your headset, launch ALVR. The on the ALVR dashboard on your PC, click the "Add device manually" button, provide a name and hostname (You can get this from the "trust" screen of ALVR on your Quest), then put in the IP address that we got from ZeroTier.
At this point, you should be ready to go. Have fun in VR!
An alternative to ZeroTier with practically the same setup procedure. This could have better latency, depending on your distance to the datacenter. https://tailscale.com/
n2n is another P2P VPN solution, just like ZeroTier. You need to run supernode on a server with an IP and port publicly accessible on internet (or at least your PC and Quest can access to it), and run edge node on your PC and Quest.
Its pros and cons are similar to ZeroTier, but it's self-hosted and open-source if you care about privacy, though instead you need some knowledge about networking and server deploying.
We're going to use n2n v3, and set the port of supernode to 1234 as the example. You can change 1234 to any port, but below 1024 requires root.
1234 on your server's firewall (usually iptables, if you don't know what to do, ask Google)../supernode -p 1234../edge -c [network-name] -k [secret-password] -a 192.168.100.1 -l [your-server-ip]:1234 to connect to the supernode, assign the IP 192.168.100.1 to the PC, and use the password you provided for data encryption.[OK] edge <<< ================ >>> supernode, your PC is done, or you need to follow the error logs to see what's wrong.192.168.100.2 to your Quest:
[your-server-ip]:1234[network-name][secret-password]192.168.100.2255.255.255.0[OK] edge <<< ================ >>> supernode, your Quest is done.192.168.100.2 which is assigned to Quest just now.192.168.100.123 to reassign a new IP to the device.