For help with network configuration problems, please consult our storagenode networking basics documentation before submitting a support ticket.
Port Forwarding
To successfully connect to the outside world, the storage node software is using TCP forwarded ports. The user must manually configure TCP port forwarding as it provides the most stable configuration possible.
If your router does not support TCP port forwarding, have a look at chapter 5 of Running a V3 Storage Node with PIA (VPN) guide to obtain a forwarded port.
One of the main hurdles for setting up a good working node is the port forwarding step, which has been the cause for many bad performing farmers. In this section we will look how to configure TCP port forwarding for our 3x nodes.
Set the private IP address to static
Most consumer routers use DHCP. DHCP gives your computers on the local network a new IP address after a certain amount of time (normally 24 hours). If our computer is given a new private IP address, it creates an issue - suddenly the specified Storage Node TCP port will not match the private IP address of our system any more in the router configuration. When this happens, our computer will not be able to access the port any more and the port will thus be closed. To prevent this from happening, you have to set up a static private IP address. There are plenty of tutorials on this topic on the internet, including:
Windows
Linux based systems
When done, make sure to restart your computer and check if the private IP address is still static. If the IP address changes after a reboot, it means that the IP is not static.
Ensure your public IP address is static
To be able to use TCP port forwarding in storagenode, it is necessary that the port you will forward is linked to a public IP or hostname. Although one can use his or her public IP, most internet providers (ISPs) do not assign static public IPs, meaning that at some point in time your public IP address will change. The consequence of this is that the port that you forwarded ceases to match to the IP address specified in the Storage Node configuration file and thus the port will be inaccessible/closed. You can protect yourself against public IP address change by assigning a hostname to your own local network with a service like noip. If you are not sure if the public IP changes or not over time it is still a good idea to configure a hostname, just in case. Below we will walk through using both methods. If you plan to use a hostname please skip the "Use a public IP address below" step.
Use a Public IP address
If you are certain your public IP address is static, this is the way to go.
Open a browser and head over to Google, then type in “what’s my IP”. Google will then return your public IP address. Keep this IP address at hand as we will need it later.
Hostname configuration
Note: You should only use one hostname for your entire local network, even if you plan to configure multiple drives/nodes or run storagenode on multiple machines (which will not be possible in the first SNO alpha release anyway). This is true as long as all machines are connected to the same network and can thus be identified with the same public IP address. If you want to run one of the nodes behind a proxy or VPN on the same network, you would have to add another hostname. You will also need a new hostname if you want to run storagenode on another network.
When your public IP address is not static, your ISP will provide you with a new IP address after a certain amount of time. The consequence of this would be that when the IP address changes, the storage node would lose its connection to the network. Adding a hostname solves the issue of public IP change.
We will add a free hostname using NoIP (noip) which needs to be renewed for free every 30 days on a free account. On the NoIP website scroll down to “Create Your Free Hostname now”, then do the following (Figure 2):
- In the hostname input field select a hostname of your liking (e.g. myhomestorjfarm), it can contain letters and numbers.
- Next select a hostname provider of your liking (e.g. “.ddns.net”) in the box to the right.
- Click “Sign Up”
- On the sign-up page, enter your email, username and password. Make sure to write these details down, you will need them later (Figure 3).
-
When done, click on “Create My Free Account”. NoIP will now send you a confirmation email with an activation link to your email address. Once you click on the activation link it should take you to the NoIP website and confirm that your account is now active.
-
Now scroll down to where it says “How to remote access your device” and click “Get started with Dynamic DNS” (Figure 4).
-
Clicking on the link should take us to our NoIP dashboard.
-
Now scroll down to “Dynamic Update Client for Windows” (DUC) and click on“Download” (Figure 5). This should take you to the download page where you can download the DUC tool. On the download page click “Download Now”.
-
After the file has downloaded successfully, head over to the download folder and double click on the “DUCSetup” executable.
-
On the resulting installation window, click on “Agree” - “Install” - “Finish”.
- The Dynamic Update Client should now open. Enter the username and password from step (4) above and click on “Sign In” (Figure 7).
- Once you've logged in successfully, the “Edit groups/Hosts” menu should be displayed (Figure 8). If not already selected, choose the hostname box and click on “Save”.
- The DUC tool will now come to life (Figure 9). Next go to “File” - “Preferences” and select “Start this application automatically when the user logs on”. In case your computer reboots, DUC will automatically start in the background. This is very handy because if Storage Node starts automatically, it will not run into a closed port as DUC is also already running.
You now have a hostname and a dynamic update tool that automatically tracks and assigns the IP address to your hostname. So if your public IP changes, Storage Node will not lose access to the TCP port. Please keep your hostname at hand as we will need it later.
Note: Some routers can also act as a DUC, in that case you can use the router directly instead of having to install the No-IP DUC. Search the router menus for "hostname" or "DDNS".
Router TCP port forwarding configuration
Now that we have our public IP address or hostname (kademlia.external-address), it is necessary to link the kademlia.external-address to a specific TCP port by forwarding that port in your router. All communication to and from your node will pass through this port.
Note: Each drive/node should have its own TCP port, so in case you want to add multiple drives it would look like this:
First, before we can start our port forwarding journey, we need to know the gateway (router) private IP address so that we can gain access to the router. This can be done in the following ways;
Windows
Your router IP address can be found by typing in ipconfig
into a CMD window (Figure 10). Then scroll down to “Default gateway” and copy-paste the router’s private IP address into
a browser window (Figure 11).
We can now log into our router and configure the TCP ports. The router manufacturer and model will vary from user to user and thus the port-forwarding appearance and menu location within the router GUI will also differ.
Doing a quick Google or YouTube search for:
Port forwarding with
Should bring up enough information to successfully configure port forwarding for your router, alternatively the following website contains guides on how to port forward on most routers: https://portforward.com/.
Note: The port forwarding menu in most routers is under the “Security” menu called “Virtual server”.
Now copy the IPv4 address from the command prompt (CMD) window in which we executed the ipconfig
command. This IPv4 address is the private internal IP address of our computer and is required to set the port forwarding rule (Figure 12).
In the example below the ports for three nodes/drives were added to the
router:
- Node 1: 4000
- Node 2: 4001
- Node 3: 4002
Figure 12. Port forwarding parameters for three nodes. Each row represents the forwarding parameters for a single node.
Linux
The first thing we have to do is find our default gateway (router private IP address). This can be accomplished by typing in the following command into a terminal (Figure 13):
route -n
or
ip route show
Now copy your “Gateway” address as shown in red in the figure above (Figure 13). Paste the gateway address into a browser window (Figure 14). This should bring up the router login page.
We can now log into our router and configure the TCP ports. The router manufacturer and model will vary from user to user and thus the port-forwarding menu location within the router GUI will also differ.
Doing a quick google or YouTube search for:
Port forwarding with
Should bring up enough information to open the ports. Alternatively, the following website contains guides on how to port forward on most routers: https://portforward.com/.
The port forwarding menu in most routers is under the “Security” menu called “Virtual server”.
Next, find the private IP address of the machine on which you want to run Storage Node, by executing the following command:
hostname -I
This should return your current static private IP address.
Now copy the IP address from the terminal window in which you executed the hostname -I
command and use it to set the port forwarding rule in the router settings (Figure 15).
In the example below the ports for three nodes/drives were added to the router:
- Node 1: 4000
- Node 2: 4001
- Node 3: 4002
Figure 15. Port forwarding parameters for three nodes. Each row represents the forwarding parameters for a single node.
Note: The exact port numbers you want to forward are of your own choice. The ports in this guide are just suggestions.
After following all these steps you should have the following:
- A configured hostname or knowledge of your static Public IP address.
- A static private IP address.
- Configured port forwarding for every node/drive you want to add to Storage Node.
These are all the network tools and settings that have to be configured to successfully run Storage Node drives/nodes via TCP.
Comments
0 comments
Please sign in to leave a comment.