A simple tool to expose a local port to public network behind full cone nat
283
A simple tool to expose a local port to public network behind nat1 firewall
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
If you need to use additional parameters, add them after the command element in compose file, or to the end of docker command
| Parameter | Function |
|---|---|
| -6 | whether to enable ipv6 forwarding |
| -i 120 | interval of stun request |
| -l 12345 | local port to send syn packet |
| -o /tmp/external.port | output file path |
| -r 14885 | redirect port which actually expose to public network |
| -s stun.example.com:3478 | stun server, must support stun over tcp |
You must specify the type of your host's iptables backend, with optional values of nft or legacy (iptables-nft or iptables-legacy).
| Environment variable | Value |
|---|---|
| IPTABLES_BACKEND | nft or legacy |
Content type
Image
Digest
sha256:b097ff0c8…
Size
68.8 MB
Last updated
over 1 year ago
docker pull alozxy/trav