Bore is a free and open-source command-line utility written in Rust that aims to allow users to expose a local port to the internet without needing port forwarding.

The default bore.pub address will be given with a dynamic port number referring to your local port, but you can request a specific static port number only if it's available.

The best way I find to use Bore is to use the same command-line tool to self-host your own Bore instance on a VPS or server, and then assign a domain to that system. Later, you can use that domain to expose a local port to the internet with any port number you desire without worrying about port availability.

In this article, I'll show you how to use and expose localhost to the internet using Bore with a public instance of the Bore server running at bore.pub and later learn to setup your own Bore instance in one line of command.

How to Expose Localhost to the Internet Using Bore

1. The first step is to install the Bore on your system; it's written in Rust, which allows installation via Cargo (a Rust package manager) or Brew on Linux and macOS.

  • Install Bore using Cargo
  • cargo install bore-cli
  • Install Bore using Brew
  • brew install bore-cli

2. Once the installation is complete, you can export a local port to the internet with a bore.pub address. For example, the following command will port forward an 80 Apache port to the internet.

  • bore local 80 --to bore.pub

Output:

port forwarding the local 80 port to the internet using bore in ubuntu

3. In the previous command, the address with a dynamic port allocated to me is bore.pub:37702, which can be accessed anywhere using any browser as long as the bore command is running.

accessing the local exposed port using the bore via the internet in firefox browser

4. As you've seen, you're assigned to a random port number on the bore.pub instance. However, you can use the -p <port-number> flag to request a desired port number, but only if it's available.

  • bore local 80 --to bore.pub -p 8820

Output:

requesting custom port for the exposed local port on the internet in bore

How to Setup Bore Instance on VPS or Server

If the lack of port availability is annoying you while using the Bore public instance, you can set up a single self-instance for Bore on your VPS or server with a single command.

All it takes to install the Bore using the previously mentioned command and then executing the following command:

  • bore server -s my-secret-key

Output:

Setting a bore instance on ubuntu vps

Once the instance is ready, you can use the same system, another system on the network, or access it from elsewhere to expose your localhost to the internet by assigning your Bore instance a local IP or global IP (or domain), depending on the use case.

  • bore local 80 –-to <local-IP/global-IP/domain> -s my-secret-key

How to Remove Bore

To remove Bore from your system, execute one of the following commands based on the installation method you followed:

  • Remove Bore installed via Cargo
  • cargo uninstall bore-cli
  • Remove Bore installed via Brew
  • brew uninstall bore-cli