A NAT-PMP implementation with natmap.
-
Download nat-mapmp. Add execute permission to it.
# Download nat-mapmp curl -Lo nat-mapmp.mjs $( curl -s https://api.github.com/repos/opportunityliu/nat-mapmp/releases/latest \ | grep "browser_download_url.*mjs\"" \ | cut -d : -f 2,3 \ | tr -d \" ) # Add execute permission chmod +x ./nat-mapmp.mjs
-
Install nodeJS. Make sure node version is >= 16.0.0.
# Install nodejs on OpenWrt opkg update && opkg install node # Check node version node --version
-
Allow inbound connections to natmap binding ports. Default ports are
9000-9999
. You can change it by setting--bind
option.Navigate to
Network > Firewall > Traffic Rules
in LuCI, add a new rule. SetProtocol
toTCP+UDP
,Source zone
towan
,Destination port
to9000-9999
,Action
toACCEPT
. -
Install natmap. Make sure
natmap
is in your$PATH
, or you can set thenatmap
executable path via--exec
option. -
Run
nat-mapmp
withnodejs
../nat-mapmp.mjs
You can also use
nohup
to run it in background.nohup ./nat-mapmp.mjs &
-
For more options, run
./nat-mapmp.mjs --help
.