Sign inSign up

ragingbull232/natmap

By ragingbull232

•Updated 8 months ago

Alpine-based natmap Docker image with curl and openssh-client for TCP/UDP Full Cone NAT mapping

Image
Networking
0

557

ragingbull232/natmap repository overview

⁠Natmap Multi-Instance Docker (Alpine Edition)

这是一个基于 Alpine Linux 构建的多实例 natmap 管理镜像。它允许通过一个简单的配置文件同时管理多个 NAT 打洞任务,并自动为不同实例的日志添加标签,极大地方便了运维与监控。


⁠核心特性

  • 多实例支持:通过 /etc/natmap.config 集中管理,一个容器启动多个 natmap 进程。
  • 智能日志标签:自动解析配置,在输出中注入 [TAG],清晰分辨各实例运行状态。
  • 环境完备:预装 bash、curl 和 openssh-client。
    • 支持调用 HTTP Webhook(微信、钉钉、飞书等)。
    • 支持通过 SSH 触发远程服务器的配置更新。
  • 极致精简:基于 Alpine,尽管内置了完整工具链,镜像体积依然极小。

⁠快速开始

⁠1. 编写配置文件 natmap.config

在宿主机创建文件(例如 /etc/natmap.config),格式为 标签: 参数:

# 格式 -> 标签: natmap运行参数 (不含natmap命令本身)
SSH: -s turn.cloudflare.com -h 223.5.5.5 -b 2222 -e /root/natmap/notify.sh
FRP: -u -s turn.cloudflare.com -h www,baidu.com -b 7000 -e /root/natmap/update-frp.sh
WEB: -s turn.cloudflare.com -h qq.com -b 8080

⁠启动容器

建议使用 host 网络模式 以获得最佳的 NAT 类型穿透效果:

docker run -d \
  --name natmap-dx \
  --network host \
  --restart unless-stopped \
  -v /etc/natmap.config:/etc/natmap.config \
  -v /root/natmap/scripts:/root/natmap \
  ragingbull232/natmap:20260214

⁠Usage

natmap [options]

Options:
 -4                  use IPv4
 -6                  use IPv6
 -u                  UDP mode
 -d                  run as daemon
 -i <interface>      network interface or IP address
 -k <interval>       seconds between each keep-alive
 -c <count>          UDP STUN check cycle (every <count> intervals)
 -s <addr>[:port]    domain name or address of STUN server
 -h <addr>[:port]    domain name or address of HTTP server
 -e <path>           script path for notify mapped address
 -f <mark>           fwmark value (hex: 0x1, dec: 1, oct: 01)

Bind options:
 -b                  port number range for binding
                     - <0>: random allocation
                     - <port>: specified
                     - <port>~<port>: random allocation within the range
                     - <port>-<port>: sequential allocation within the range

Forward options:
 -C <congestion>     TCP congestion control algorithm
 -T <timeout>        port forwarding timeout in seconds
 -t <address>        domain name or address of forward target
 -p <port>           port number of forward target (0: use public port)

Tag summary

Content type

Image

Digest

sha256:e319c10da…

Size

9 MB

Last updated

8 months ago

docker pull ragingbull232/natmap:20260214