[Network] netsh 를 이용하여 포트포워딩하기

Computer · Posted on April 29, 2015 at 02:00 AM

netsh interface portproxy 명령어로 다른 컴퓨터의 포트를 로컬 컴퓨터의 포트로부터 접속할 수 있게 할 수 있다. 제목에 포트포워딩이라고 했지만, 더 정확한 명칭은 포트프록시 이다. 이 방법은 한 컴퓨터만 외부에서 접속할 수 있는 상황에서, 해당 컴퓨터에서만 접속할 수 있는 컴퓨터의 서비스를 접속 가능한 컴퓨터로 포워딩하기 할 때 유용하다.

netsh interface portproxy add v4tov4 listenport=[로컬 포트] connectport=[연결할 포트] connectaddress=[연결할 주소]

netsh interface portproxy 명령어:

The following commands are available:

Commands in this context:
?              – Displays a list of commands.
add            – Adds a configuration entry to a table.
delete         – Deletes a configuration entry from a table.
dump           – Displays a configuration script.
help           – Displays a list of commands.
reset          – Resets portproxy configuration state.
set            – Sets configuration information.
show           – Displays information.

To view help for a command, type the command, followed by a space, and then
 type ?.

netsh interface portproxy add v4tov4 명령어:

One or more essential parameters were not entered.
Verify the required parameters, and reenter them.
The syntax supplied for this command is not valid. Check help for the correct syntax.

Usage: add v4tov4 [listenport=]<integer>|<servicename>
             [connectaddress=]<IPv4 address>|<hostname>
            [[connectport=]<integer>|<servicename>]
            [[listenaddress=]<IPv4 address>|<hostname>]
            [[protocol=]tcp]

Parameters:

       Tag              Value
       listenport     – IPv4 port on which to listen.
       connectaddress – IPv4 address to which to connect.
       connectport    – IPv4 port to which to connect.
       listenaddress  – IPv4 address on which to listen.
       protocol       – Protocol to use.  Currently only TCP is supported.

Remarks: Adds an entry to listen on for IPv4 and proxy connect to via IPv4.

예시) 192.168.1.150의 웹서버(80번 포트)를 192.168.1.100의 8080번으로 접속할 수 있게 설정

netsh interface portproxy add v4tov4 listenport=8080 connectport=80 connectaddress=192.168.1.150

위와 같이 설정하여 http://192.168.1.100:8080 주소로 http://192.168.1.150을 접속할 수 있다. 또한, netsh interface portproxy show v4tov4로 설정이 잘 되었는지 아래와 같이 확인할 수 있다.

20150429_001_001.png

설정은 재부팅 후에도 적용되며, 설정을 삭제할 때는 아래의 명령어를 입력하여 삭제할 수 있다.

netsh interface portproxy delete v4tov4 listenport=8080

Posted by chlee

0 Comments

Post a comment

Security Code