Skip to content

Instantly share code, notes, and snippets.

@AnotherDroog
Created January 6, 2019 08:13
Show Gist options
  • Save AnotherDroog/0401676f593f2db4453d1d9189f2d1ed to your computer and use it in GitHub Desktop.
Save AnotherDroog/0401676f593f2db4453d1d9189f2d1ed to your computer and use it in GitHub Desktop.
lnd upnp script
#!/bin/sh
LN_PORT=9739
INVOICER_PORT=1666
ROUTER_UPNP=http://192.168.0.1:1900/gatedesc.xml
IP="$(ip route get 1 | awk '{print $NF;exit}')"
SSH_PORT="22$(echo ${IP} | cut -d '.' -f4)"
# ssh
upnpc -u "${ROUTER_UPNP}" -e "$(hostname): ssh" -a ${IP} 22 ${SSH_PORT} TCP
# lnd
upnpc -u "${ROUTER_UPNP}" -e "$(hostname): lnd" -a ${IP} ${LN_PORT} ${LN_PORT} TCP
# invoicer
upnpc -u "${ROUTER_UPNP}" -e "$(hostname): invoicer" -a ${IP} ${INVOICER_PORT} 2048 TCP
# Note: passing -u "${ROUTER_UPNP}" is optional.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment