설치

OpenWRT, Gargoyle Router WAN접속 허용 및 포트 변경

T8.CO.KR 2026. 8. 27. 12:29

어떤 필요에 따른 SSH, HTTP, HTTPS 프로토콜의 WAN 접속을 허용한다.

기본 포트를 그대로 써서는 안 된다.

예로 든 2222, 4443, 8080 포트도 추정할 수 있으므로 안 된다.

기억하기 애매한 5자리 숫자를 꼭 쓴다.

49150 이하의 숫자이다.

 

vi change-ports-allow-wan

#!/bin/sh

uci delete uhttpd.main.listen_http
uci delete uhttpd.main.listen_https
uci add_list uhttpd.main.listen_http='0.0.0.0:8080'
uci add_list uhttpd.main.listen_http='[::]:8080'
uci add_list uhttpd.main.listen_https='0.0.0.0:4443'
uci add_list uhttpd.main.listen_https='[::]:4443'
uci commit uhttpd
/etc/init.d/uhttpd restart

uci set dropbear.global.Port='2222'
uci commit dropbear
/etc/init.d/dropbear restart

echo "
config rule
        option name 'Allow WAN Access'
        option src 'wan'
        option dest_port '2222 4443 8080'
        option proto 'tcp'
        option target 'ACCEPT'
" >> /etc/config/firewall
/etc/init.d/firewall restart

exit

 

chmod a+x change-ports-allow-wan

./change-ports-allow-wan