Created
December 7, 2019 15:34
-
-
Save wuxiangzhou2010/11c2d7848b4741b8887fc88bebe9277b to your computer and use it in GitHub Desktop.
open upnp port using miniupnc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ports=(65000 # web | |
65001 # web | |
65005 # transmission | |
32400 # plex | |
6690 #cloud station | |
) | |
protocols=(tcp udp) | |
cmd="./upnpc-static" | |
myip=$(ifconfig | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1' | grep -v "169.") | |
for port in "${ports[@]}" | |
do | |
echo $port | |
for protocol in "${protocols[@]}" | |
do | |
echo $protocol | |
$cmd -d $port $protocol | |
$cmd -a $myip $port $port $protocol | |
done | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment