Node Tutorial: UPnP and Port Forwarding
You'll often see the Casa Node referred to as a "plug-and-play" device – and deservedly so, as users can simply plug it in and start running their Node. The most difficult part about setting up a node is usually the networking aspect. To help smooth the network setup, the Casa Node utilizes a networking protocol known as UPnP, or Universal Plug and Play. Like all technology, UPnP doesn't always work as intended. To solve for this, you can try enabling port forwarding.
This Node Tutorial will explain what port forwarding is and why it's important to know about when running a node.
Enabling Tor on your node will often solve for UPnP issues. This is because Tor assigns your device a static onion address, rather than a dynamic IP address. If you want to use Tor (this is usually easier than port forwarding), see our node tutorial on Running Your Casa Node on Tor. Otherwise, continue reading here.
Right now you're probably sitting at home (or work, you rebel) reading this tutorial on a computer or mobile device with an internet connection. However, you probably haven't thought much about how exactly that internet connection is accomplished.
In order for your device to establish an internet connection, it needs a way to communicate with your router. To set up a line of communication, your device begins searching for your router's IP address, which often looks something like this: 192.168.0.10. Once found, your router will then assign a separate IP address to that device.
This exchange of IP addresses establishes the connection, and it happens with every device you wish to connect. Together, these connected devices comprise your local-area network (LAN). Your LAN is protected by a firewall which protects your devices from external, unauthorized access.
The only reason that your devices can automatically discover each other is because of—you guessed it—UPnP. UPnP is enabled on many routers to facilitate an easy internet connection among your devices. You can think of UPnP as a doorman for your firewall or the operator of your castle gates (Game of Thrones, anybody?). When a connection is approved, UPnP tells your router to lower its firewall to let the device connect.
It's worth noting that UPnP isn't exactly renowned for its security. For example, if you were to accidentally download Trojan malware, it could install a program on your computer that opens a hole for it in your firewall, rendering it accessible from other remote internet devices at any time. Because of this insecurity, UPnP generally isn't used on enterprise networks. Casa Nodes utilize UPnP because we believe its convenience outweighs its security risks in the context of running peer-to-peer crypto asset nodes.
If UPnP doesn't properly route traffic for your Node, you can manually establish the connection using port forwarding.
Your firewall uses a system of ports as a way to filter traffic. There's no hidden meaning here – they function the same way maritime ports do. Firewalls are configured with a number of criteria that serve as guidelines for ports in deciding whether to allow or deny traffic.
Port forwarding essentially pokes a hole in your firewall to allow an external device access to your LAN, but only on the port you specify. Your firewall will allow that traffic because you're using an already trusted device to authorize the opening of the port.
The problem with port forwarding is that it's difficult for the average person to set up. Alas, anyone running a Bitcoin or Lightning node will probably have to deal with port forwarding in some capacity. On a Bitcoin node, setting up port forwarding to allow incoming connections is required if you want your node to relay data to more than a handful of peers on the network. Lightning nodes, however, require port forwarding if you want your node to accept incoming payment channels.
Your Casa Node will attempt to use UPnP with Lightning every time it's connected. If your node appears to be experiencing issues with this, setting up port forwarding is likely your solution. To make this as easy as possible, we've put together a step-by-step guide on how to set up port forwarding for your Casa Node here.