Static Ports Setup

Introduction

As a BTFS Host, you may need to set up a static port to a port number other than the default 4001, for example, to connect to renters for storage contracts. This guide walks Hosts through the setups needed to set up the ports on different operating systems.

BTFS Configuration Settings

To change the random swarm port, update the config file located under the .btfs directory. Update the port number under Swarm to your desired port. For example, to update to port 1234:

"Addresses": {
    "API": "/ip4/127.0.0.1/tcp/5001",
    "Announce": [],
    "Gateway": "/ip4/127.0.0.1/tcp/8080",
    "NoAnnounce": [],
    "RemoteAPI": "/ip4/127.0.0.1/tcp/5101",
    "Swarm": [
      "/ip4/0.0.0.0/tcp/1234",
      "/ip6/::/tcp/1234"
    ]
  }

After updating the port value, be sure to restart your daemon:

btfs shutdown

btfs daemon

Machine Configuration

Users should also configure the machine settings to allow for the opening of specific ports.

Linux/MacOS

Open firewall manually:

ufw allow 1234/tcp

Windows

  1. Navigate to Control Panel, System and Security, and Windows Firewall.
1800
  1. Select Advanced settings and highlight Inbound Rules in the left pane. Click Inbound Rules and select New Rule.
1690
  1. Select the Port radio button and click Next. Select the TCP protocol and add the port number in the Specific local ports text box. Then click Next.
1690
  1. Select Allow the connection in the next window and hit Next.
1690
  1. Select the profiles where you would like to apply this rule, and click Next.
1690
  1. Give the rule a name and click Finish.
1690