Você pode fazer isso usando o firewall interno do Windows Server 2012 e emitindo Netsh AdvFirewall Firewall Commands de um prompt de comando (ou script em lotes) executado como administrador .
Veja "Scripts e Comandos" abaixo de "Explicação". . .
Explicação
Essencialmente, você permitiria conexões de entrada assim:
-
Pelo número da porta TCP , a instância do SQL Server está escutando no servidor
[ localport = { any | Integer | rpc | rpc-epmap | teredo | [ ,... ] } ]
-
Specifies that network packets with matching IP port numbers matched by this rule. localport is compared to the Source Port field of an outbound network packet. It is compared to the Destination Port field of an inbound network packet.
- Integer. Specifies the exact port number that must be present for the packet to match the rule. The port values can be individual numbers from 0 through 65535, a range, such as 5000-5020, or a comma-separated list of numbers and ranges.
Multiple entries can be specified for localport by separating them with a comma. Do not include any spaces.
If localport is not specified, the default is any.
-
-
Permitindo conexões nesta porta TCP somente de um endereço IP específico (ou conjunto de)
[ localip = { Addresses } ]
-
Specifies that network packets with matching IP addresses match this rule. localip is compared to the Destination IP address field of an inbound network packet. It is compared to the Source IP address field of an outbound network packet.
- IPAddress. Matches only the exact IPv4 or IPv6 address.
Multiple entries can be specified for localip by separating them with a comma. Do not include any spaces.
If localip is not specified, the default is any.
-
Scripts e comandos
Linha de comando
netsh advfirewall firewall add rule name="Inbound 1433 Access Per IP Address" dir=in protocol=tcp action=allow localip=192.168.1.10,192.168.1.20,192.168.1.30
Permitir script em lote
ECHO ON
SET name="Inbound 1433 Access Per IP Address"
SET dir=in
SET protocol=tcp
SET action=allow
SET localport=1433
SET localip=192.168.1.1,192.168.1.2,192.168.1.1
netsh advfirewall firewall add rule name=%name% dir=%dir% protocol=%protocol% action=%action% localip=%localip%
Como remover a regra
netsh advfirewall firewall delete rule name="Inbound 1433 Access Per IP Address"