Skip to content

Instantly share code, notes, and snippets.

@edgardo001
Last active March 16, 2020 20:52
Show Gist options
  • Save edgardo001/804af952ca25f859097adaec244ec4c7 to your computer and use it in GitHub Desktop.
Save edgardo001/804af952ca25f859097adaec244ec4c7 to your computer and use it in GitHub Desktop.
Redireccionar Puertos e IP en Windows Server 2008/2012

Redireccionar Puertos e IP en Windows Server 2008/2012

Genero el Port Forwarding (Salto IP):

Se redirecciona del puerto 8080 a el puerto 8080 de la maquina 192.168.1.193.

netsh interface portproxy add v4tov4 listenport=8080 connectport=8080 connectaddress=192.168.1.193

Muestra todas las redirecciones:

netsh interface portproxy show all

Elimino la redireccion creada:

netsh interface portproxy delete v4tov4 listenport=8080 listenaddress=*

NOTAS:

  • Se transfiere puerto 8080 a un puerto 3306 de mysql en otro equipo (Funcional).

  • No se logra modificar puerto de escritorio remoto, para que envés de conectarse a mi servidor, se conecte a otro (No funcional).

FUENTE:

https://social.technet.microsoft.com/Forums/windowsserver/en-US/417fcbcd-169d-4f7a-8f3a-7a00a91bad66/windows-2012-firewall-port-forwarding?forum=winservercore

Well, here's the solution:

We have to use netsh to accomplish this, although there is a tricky part. When using netsh doesn't mean that it overrides firewall rules so here's how communication works:

Remote client ----> Windows firewall (in server) ---->netsh rules

translated to ports:

Port 54321 -----> Windows firewall rule to accept 54321 ------>netsh rules forwards 54321 to 12345

So this is the sequence I did in order to accomplish:

netsh interface portproxy set mode online netsh interface portproxy add v4tov4 listenport=54321 connectport=12345 connectaddress=88.88.88.88

(listenaddress is omited since we want no restriction on the client ip so it can connect from anywhere)

netsh interface portproxy commit

In windows firewall we must create a rule that accepts all incoming traffic from port 54321, DO NOT select any program associated since that program will never listen to 54321 port, it listens to 12345

That's it, hope it helps someone

G.Waters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment