This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Documentation

1 - Overview

overview

You don’t have to deal with public IP, DDNS, SSL certificates or opening ports on your router.
lan2wan service allows you to access your local services from the internet.
You can publish your service in a single command.

Example: publishing my local web application to the internet

$ lan2wan publish http://localhost:8080 --username hello --password my_secret

Local URL         	http://localhost:8080                                         	
Remote URL / HTTP 	http://xzmjg-106-220-244-187.free-tier.in-blr1.lan2wan.online 	
Remote URL / HTTPS	https://xzmjg-106-220-244-187.free-tier.in-blr1.lan2wan.online

Features

  • Supports end-to-end encryption
  • You will get a random domain name, or you can use your custom domain
  • You can add additional authentications in front of your local services.
  • You can manage your endpoint settings via lan2wan console

Supported endpoints

  • http
  • https
  • file browser
  • tcp (via websocket)

HTTPS Certificate Management

When you publish your local services, You should add certificates to allow your connection is secure and encrypted. Here are the options available to manage your certificates.

certificate

1. Managed by lan2wan server

In this mode certificate will be managed by lan2wan server.

2. Managed by lan2wan Agent (aka end-to-end encryption)

Also called as end-to-end encryption. In this mode certificate will be managed by lan2wan agent.
You can also provide your own certificate or lan2wan agent can get certificate from letsencrypt by default.
There is an option to specify your own ACME.
Downloaded certificates will be stored under ./certs directory in the agent location.
In addition to manage certificate also manages renewals automatically.

3. Managed by your service (aka end-to-end encryption)

Also called as end-to-end encryption. In this mode you service has to manage the certificates


2 - Download

Executable

lan2wan agent is available in executable binary format. You can download for you OS architecture.

Docker Container Image

  • quay.io/lan2wan
    docker run --detach --name lan2wan-agent --volume $PWD/lan2wan.yaml:/app/lan2wan.yaml --restart unless-stopped quay.io/lan2wan/lan2wan:1.3.0
    

3 - Setup

Download the lan2wan agent and extract the tar/zip file.
Optionally you can place the lan2wan executable in your OS binary path.

Login

To get registered user benefits, you should have an account in lan2wan console server.

lan2wan login --email my@email.com --token my_token

Command Usage

lan2wan command utility has built in help documentation. Run lan2wan -h or lan2wan --help to get detailed usage options.

$ lan2wan --help
lan2wan is the agent of lan2wan console server (https://console.lan2wan.in)

Usage:
  lan2wan [command]

Available Commands:
  attach      Attaches your remote tcp port (via url) to the localhost
  completion  Generate the autocompletion script for the specified shell
  help        Help about any command
  info        Prints configured agent details
  list        List available resources
  login       Authenticate with lan2wan console server and keeps the credentials in the config file.
  logout      Log out from the server, removes the credentials from the config file
  plan        Prints your plan and balance details
  publish     Publishes a lan servers(http, https, file, tcp) into public url
  set         Set a resource value
  start       Starts the lan2wan agent, takes endpoint configuration details from the lan2wan console server
  update      Updates lan2wan agent to the latest version
  version     Prints agent version details
  zone        Prints the current zone

Flags:
  -c, --config string   config file (default is $HOME/.lan2wan/.lan2wan.yaml)
  -h, --help            help for lan2wan
  -o, --output string   output format. options: yaml, json, console (default "console")
      --pretty          JSON pretty print

Use "lan2wan [command] --help" for more information about a command.

Publish your local service

Two options available to publish your services

Publish Temporarily

This option will be useful when you want to publish your services for short time. Useful for developers to publish their application, webhooks, etc.,

Publish http service
# publish http service
$ lan2wan publish http://localhost:8080 --username hello --password my_secret

# publish files
$ lan2wan publish file:///tmp/my_share --username hello --password my_secret
Publish tcp port

Publishing tcp port works via websocket. It means you have to attach to a port on your remote host to access the tcp connection.

# publishes port localhost ssh via websocket
$ lan2wan publish tcp://127.0.0.1:22
Remote URL / HTTP http://random-domain.lan2wan.online
Remote URL / HTTPS https://random-domain.lan2wan.online

# command to attach your published tcp port on a remote host
# your tcp service will be accessible via 35913 port on a remote host
$ lan2wan attach https://random-domain.lan2wan.online
tcp service is listening on: 127.0.0.1:35913

# ssh into the localhost from remote location
$ ssh root@127.0.0.1 -p 35913
root@127.0.0.1's password:

Publish Permanently

Publish permanently is like configure once and forget :)

  • You should your agent configuration in the console server
  • on the command line login with agent name and your agent token from console server (Agents >> Agent Token)
    lan2wan login --email my@email.com --token my_token --agent-name my_agent
    
  • Start the agent
    lan2wan start
    

Thats it! Now you can update your changes on the lan2wan console server. Changes will be published automatically to your agent.

Docker container

You can start your agent as a docker container.

  • create lan2wan.yaml file with your credentials as follows in your localhost,
agent_name: my_agent
email: my@email.com
token: my_token
  • create certs director in your localhost and start lan2wan docker
mkdir -p ./certs

docker run --name lan2wan-agent \
    --env TZ="Asia/Kolkata" \
    --volume ${PWD}/certs:/app/certs \
    --volume ${PWD}/lan2wan.yaml:/app/lan2wan.yaml \
    --restart unless-stopped \
    quay.io/lan2wan/lan2wan:1.3.0

4 - Update The Agent

To update the existing lan2wan agent executable just run la2wan update

5 - Console

lan2wan console is the place to manage your agent, endpoints, domains, authentication providers

Pre Requests

Google account

lan2wan console uses Google Authentication to login. You should have either Google account or a account linked with google.

Kindly report the issue if you face difficulty on login.

5.1 - Profile

Profile displays your email, zone, and allowed domain details.

Update Zone

You can update your preferred zone in profile page. zone

5.2 - Plan Details

Displays your current plan, upcoming plans and last 7 days usage history.

plan details

5.3 - Reserved Domains

Your custom domains goes here. To add a domain click on Add and update domain name. Optionally you can share your domains with other user in lan2wan via Consumers field.

domain

Generated domain

When you first time login into lan2wan console, a domain will be generated for you. You can not modify that domain.

domain

5.4 - Agent

In this page you can update your agent and endpoint configurations.

5.4.1 - Agents

Navigate to: Agent >> Agents

You can add your endpoints and map with a public domain you can also configure headers, authentication for your endpoints.

Add an agent

To add new agent details, go to Agent >> Agents and click on Add

add_agent

  • Enter a name for the agent
  • If you plan to use different end-to-end encryption certificate, select a provider. default provider letsencrypt.
  • under the endpoint click on Add an item
  • on the Name field add a name for your reference
  • click on Update under Configuration and follow endpoint configuration

Endpoint Configuration

add_endpoint

  • Select a endpoint type. default End-to-End
  • Add a subdomain to access this endpoint
  • if you plan to add additional layer of security to your service, select a authentication provider
  • On the LAN configuration enter your endpoint/service url
  • Click on Update and click on Save

Now under the agents your newly created agent will be listed.

5.4.2 - Agent Token

Navigate to: Agent >> Agent Token

To connect your agent to the lan2wan server, you need a agent name, token and email.
Also you can regenerate your agent token on this page.

5.4.3 - Authentication Providers

Navigate to: Agent >> Authentication Providers

Authentication providers gives additional security to your endpoint. On a successful authentication allows access to your local endpoint. Different type of authentication supports are available.

  • Basic Authentication
  • Native Authentication Page
  • Token Authentication
  • OAuth2 Proxy

To add a authentication provider, Navigate to authentication provide page and click on Add

Basic Authentication

When you access your endpoint with a basic authentication, you will get a authentication popup on your browser.

basic authentication

Native Authentication Page

When you access your endpoint with a Native authentication page, you will be redirected to a login page. on successful authentication you will be landed into your endpoint.

native authentication

Token Authentication

You have to include the generated token on your url as a header or query parameter.

token authentication

OAuth2 Proxy

When you access your endpoint with OAuth2 proxy, you will be redirected to OAuth2 proxy login page. As a pre request you should have configured oauth2 proxy

oauth2 proxy

6 -

Report Issues

If you face a difficulty, You can report your issue in GitHub Repository

Issue tracker: https://github.com/lan2wan/lan2wan

Support

TBD

7 - Terms Of Service

Last updated: June 11, 2022

TBD