Sign inSign up

alozxy/trav

By alozxy

Updated over 1 year ago

A simple tool to expose a local port to public network behind full cone nat

Image
0

283

alozxy/trav repository overview

Introduction

A simple tool to expose a local port to public network behind nat1 firewall

Usage

docker-compose (recommended)

services:
  trav:
    image: alozxy/trav                            
    container_name: trav
    volumes:
      - /tmp/external.port:/tmp/external.port
    environment:
      - IPTABLES_BACKEND=<YOUR_IPTABLES_BACKEND>
    network_mode: "host"
    cap_add:
      - NET_ADMIN
      - NET_RAW
    command: "-6 -o /tmp/external.port"

docker cli

docker run -d \
  --name=trav \
  -e IPTABLES_BACKEND=<YOUR_IPTABLES_BACKEND> \
  -v /tmp/external.port:/tmp/external.port \
  --network=host \
  --cap-add NET_ADMIN \
  --cap-add NET_RAW \
  alozxy/trav \
  "-6 -o /tmp/external.port"

Then you can get the port number exposed to the public network from the /tmp/external.port file

Parameters

If you need to use additional parameters, add them after the command element in compose file, or to the end of docker command

ParameterFunction
-6whether to enable ipv6 forwarding
-i 120interval of stun request
-l 12345local port to send syn packet
-o /tmp/external.portoutput file path
-r 14885redirect port which actually expose to public network
-s stun.example.com:3478stun server, must support stun over tcp

Environment variables

You must specify the type of your host's iptables backend, with optional values of nft or legacy (iptables-nft or iptables-legacy).

Environment variableValue
IPTABLES_BACKENDnft or legacy

Tag summary

Content type

Image

Digest

sha256:b097ff0c8

Size

68.8 MB

Last updated

over 1 year ago

docker pull alozxy/trav