-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcineast_vm_forwarding.bat
41 lines (35 loc) · 1.65 KB
/
cineast_vm_forwarding.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
:START
@ECHO OFF
echo Helper script for setting up port forwarding to the cineast VM so it is accessible outside this machine.
echo Needs to be run with administrator rights.
set /p addOrRemove="Add (1) or remove (2) rules, or exit (3): "
if %addOrRemove%==3 exit /B 0
if not %addOrRemove%==1 (
if not %addOrRemove%==2 (
goto START
)
)
set /p localAddr="Enter local address: "
set /p vmAddr="Enter VM address: "
set /p fileServerPort="Enter cineast file server port: "
if /i %addOrRemove%==1 (
netsh interface portproxy add v4tov4 listenport=%fileServerPort% listenaddress=%localAddr% connectport=%fileServerPort% connectaddress=%vmAddr%
netsh advfirewall firewall add rule name="cineast_file_server_vm_forward" protocol=TCP dir=in localip=%localAddr% localport=%fileServerPort% action=allow
) else (
netsh interface portproxy delete v4tov4 listenport=%fileServerPort% listenaddress=%localAddr%
netsh advfirewall firewall delete rule name="cineast_file_server_vm_forward"
)
set /p cineastPort="Enter cineast api server port: "
if /i %addOrRemove%==1 (
netsh interface portproxy add v4tov4 listenport=%cineastPort% listenaddress=%localAddr% connectport=%cineastPort% connectaddress=%vmAddr%
netsh advfirewall firewall add rule name="cineast_api_server_vm_forward" protocol=TCP dir=in localip=%localAddr% localport=%cineastPort% action=allow
) else (
netsh interface portproxy delete v4tov4 listenport=%cineastPort% listenaddress=%localAddr%
netsh advfirewall firewall delete rule name="cineast_api_server_vm_forward"
)
if /i %addOrRemove%==1 (
echo Forwarded addresses:
netstat -ano | findstr :%fileServerPort%
netstat -ano | findstr :%cineastPort%
)
pause