본문 바로가기
AndroidOverLinux

UPNP 포트 포워딩하기

by ㅋㅋ잠자 2018. 3. 28.
반응형

안녕하세요?


공유기에 들어가서 포트포워딩 하는것이 너무 귀찮아서 만들어 보았습니다.


(단점 : 공유기를 재부팅하면 설정이 날아갑니다.)


물론 데비안 기본 패키지로 miniupnpc 가 있습니다만, 호환성이 떨어져서 java 기반의 upnp port mapper 를 사용합니다.





설치


root@AOL-Debian:~# wget http://u5pvr.djjproject.com/u5pvr-upnp-port-forward.deb

--2018-03-28 02:45:07--  http://u5pvr.djjproject.com/u5pvr-upnp-port-forward.deb

Resolving u5pvr.djjproject.com (u5pvr.djjproject.com)... 1.255.218.203

Connecting to u5pvr.djjproject.com (u5pvr.djjproject.com)|1.255.218.203|:80... connected.

HTTP request sent, awaiting response... 200 OK

Length: 68328174 (65M) [application/x-debian-package]

Saving to: ‘u5pvr-upnp-port-forward.deb


u5pvr-upnp-port-forward. 100%[====================================>]  65.16M  2.45MB/s   in 34s


2018-03-28 02:45:42 (1.94 MB/s) - ‘u5pvr-upnp-port-forward.deb’ saved [68328174/68328174]


root@AOL-Debian:~# dpkg -i u5pvr-upnp-port-forward.deb

(Reading database ... 26304 files and directories currently installed.)

Preparing to unpack u5pvr-upnp-port-forward.deb ...

Unpacking u5pvr-upnp-port-forward (1.0-android7) over (1.0-android7) ...

Setting up u5pvr-upnp-port-forward (1.0-android7) ...

root@AOL-Debian:~#


사용


SSH 를 쓰기 위해서 22 번 포트를 22222 번 포트로 포워딩 할때, 


TCP / UDP 사용 가능합니다.


root@AOL-Debian:~# port 22 22222 TCP

02:47:12.497 [main] INFO  org.chris.portmapper.PortMapperCli - Creating router factory for class org.chris.portmapper.router.cling.ClingRouterFactory

02:47:12.514 [main] DEBUG org.chris.portmapper.PortMapperCli - Creating a new instance of the router factory class class org.chris.portmapper.router.cling.ClingRouterFactory

02:47:12.587 [main] INFO  org.chris.portmapper.PortMapperCli - Searching for routers...

02:47:12.588 [main] DEBUG o.c.p.r.cling.ClingRouterFactory - System property 'portmapper.locationUrl' not defined: discover routers automatically.

02:47:12.681 [main] INFO  org.fourthline.cling.UpnpServiceImpl - >>> Starting UPnP service...

02:47:12.681 [main] INFO  org.fourthline.cling.UpnpServiceImpl - Using configuration: org.fourthline.cling.DefaultUpnpServiceConfiguration

02:47:12.730 [main] INFO  o.fourthline.cling.transport.Router - Creating Router: org.fourthline.cling.transport.RouterImpl

02:47:12.755 [main] INFO  o.f.c.t.spi.MulticastReceiver - Creating wildcard socket (for receiving multicast datagrams) on port: 1900

02:47:12.762 [main] INFO  o.f.c.t.spi.MulticastReceiver - Joining multicast group: /239.255.255.250:1900 on network interface: wlan0

--------------------------------중략

TCP :10668 -> 192.168.0.18:8195 enabled PiXel

TCP :12000 -> 192.168.0.8:12000 enabled n604pi_474EC9(DaumNPP)

TCP :22335 -> 192.168.0.101:22 enabled PortMapper TCP/192.168.0.101:22

TCP :22222 -> 192.168.0.101:22 enabled PortMapper TCP/192.168.0.101:22

02:47:17.157 [main] DEBUG o.c.p.router.cling.ClingRouter - Shutdown registry

root@AOL-Debian:~#


포워딩을 제거할때 외부 포트 기준으로 기입합니다.


root@AOL-Debian:~# dport 22222 TCP

02:48:22.686 [main] INFO  org.chris.portmapper.PortMapperCli - Creating router factory for class org.chris.portmapper.router.cling.ClingRouterFactory

02:48:22.703 [main] DEBUG org.chris.portmapper.PortMapperCli - Creating a new instance of the router factory class class org.chris.portmapper.router.cling.ClingRouterFactory

02:48:22.774 [main] INFO  org.chris.portmapper.PortMapperCli - Searching for routers...

02:48:22.774 [main] DEBUG o.c.p.r.cling.ClingRouterFactory - System property 'portmapper.locationUrl' not defined: discover routers automatically.

02:48:22.859 [main] INFO  org.fourthline.cling.UpnpServiceImpl - >>> Starting UPnP service...

02:48:22.860 [main] INFO  org.fourthline.cling.UpnpServiceImpl - Using configuration: org.fourthline.cling.DefaultUpnpServiceConfiguration

02:48:22.906 [main] INFO  o.fourthline.cling.transport.Router - Creating Router: org.fourthline.cling.transport.RouterImpl

----------------------중략

UDP :54026 -> 192.168.0.100:54025 enabled Resilio Sync (UDP)

TCP :47772 -> 192.168.0.23:47772 enabled uTorrent (TCP)

UDP :47772 -> 192.168.0.23:47772 enabled uTorrent (UDP)

TCP :10668 -> 192.168.0.18:8195 enabled PiXel

TCP :12000 -> 192.168.0.8:12000 enabled n604pi_474EC9(DaumNPP)

TCP :22335 -> 192.168.0.101:22 enabled PortMapper TCP/192.168.0.101:22

02:48:25.256 [main] DEBUG o.c.p.router.cling.ClingRouter - Shutdown registry

root@AOL-Debian:~#


감사합니다.




반응형

댓글