domingo, 7 de noviembre de 2010

SQL Sever Express 2005 (Remote connection)

Configuración de conecciones remotas con SQL SERVER EXPRESS 2005.

De este tema hay mucha información en la red por lo cual no voy a redundar en el, en futuro describire paso a paso lo que realice para que funcionara correctamente ahora solo los puntos relevantes.

  1. Configuración del router del servicio de internet, activar el puerto para escuche la aplicación en el firewall correspondiente.
  2. Confiuración del Sql Sourface de SQL (TCP/IP), habilitar el Servicio Browser.
  3. Configurar el Sql server Configuration Manager, y establecer el protocolo de conección a estatico, por default lo maneja dinámico, cada que reinicias el servicio de SQL este le asigna un puerto diferente, en este caso yo utilice el puerto 1433 como ESTATICO y creo que es buena prantica.
  4. Apagar los servicios y verificar que estos escuchen, en la entrega anterior coloque un software que me parece muy bueno y que les ayuda a comprar que los puertos esten listos tanto en la pc como el router, aqui les dejo la liga de nuevo PortFoward
  5. Algo que fue importante es como llamar la instancia desde afuera y creo que con lo anterior y si todo sale bien no deberian tener bronca..
dominio, puerto\SQLEXPRESS

Espero poner las imagenes y ser un poco mas detallado en lo que realice pero por el momento no tengo mucho tiempo, de cualquier forma les agrego esta información.

Saludos y nos leemos en la siguiente.


Configure Microsoft SQL Server to allow remote connection and remote SQL Management Studio access

To get straight to the point. I have been trying to setup Microsoft SQL Server 2008 to allow remote connection and specifically I wanted the SQL server to allow SQL Server Management Studio on a different computer completely outside the network to be able to access this remote SQL Server and manage it fully without having to login on the remote Dedicated standalone SQL server. I also wanted to be able to access this server remotely from visual studio .net on the client machine. Please be aware that I am trying the extreme settings here of getting client (management studio or visual studio) to connect to the host server (SQL Server) where the client is on a completely different network from the host. i.e. This is a 100% Internet only remote connection not within the same network, lan, or even trusted domains, forests, etc..

There are a lot of setup steps that you need to do but remember there are two main parts of this setup:

  1. configure SQL Server to accept remote connection and,
  2. Setup and Configure the firewall running on this server machine to allow inbound incoming connections.

Step 1 is straightforward and there are a lot of MSDN and Technet articles that explain it. But anyway, to make this post informative here are the main steps:

  • Go to Programs -> SQL Server -> SQL Server Configuration tools -> SQL Server Configuration Manager.
  • Make sure that the SQL Server Browser service is running under (SQL Server Services).
  • Go to SQL Server Network Configuration, open the SQL Server instance that you want to use. Make sure that the TCP IP Protocol is enabled.
  • right click on this TCP/IP protocol node and click properties. Go to IP Addresses tab. Make sure that the server IP Address is: 1) on the list of IPs, 2) is Active, 3) is enabled.
  • You can either: a) let your SQL server to listen on all server ports for any incoming SQL server connection OR b) you can specify which exact port to listen to. For a) set TCP dynamic Port to “0″ and leave the TCP port value blank. To achieve b) set dynamic value to blank and the TCP port to the port number that you want the server to listen to.
  • Restart the SQL Server instance service from SQL server Services node (All this configuration is still done from within the SQL Server Configuration Manager).
  • Go to the SQL server instant in management studio ->right click -> properties -> connections -> Allow remote connections to this server.
  • Also, Go to the SQL server instant in management studio ->right click -> properties -> Security -> Allow SQL Server and Windows authentication mode.
  • Look at this article for more details: http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/ec77d275-99c7-4cc0-b60d-707bde6f8c67/

Step 2 is the step I struggled with. Basically, I was unable to connect and didn’t know whether it is a Firewall problem or a problem with my configuration of the SQL server (step 1). Best way to troubleshoot that, allow ALL incoming inbound connections on your firewall. Try to connect remotely to the server (using the SQL Server management studio or Visual Studio .NET), if it works, then your issue was the Firewall. If it doesn’t, then it is an issue with SQL server configuration. PLEASE REMEMBER to disallow incoming inbound connections after you did this test!!!

For step 2, you need to do the following to setup and configure your windows server Firewall to accept and allow incoming connections to the host server on which you got SQL Server. So, Host Server Firewall configuration is as follows:

  • Allow incoming TCP port number 1433
  • Allow incoming UDP port number 1433
  • Allow incoming UDP port number 1434
  • Allow incoming TCP port number 135
  • Add the program sqlservr.exe to the exceptions list. By default, sqlservr.exe is installed in C:\Program Files\Microsoft SQL Server\MSSQL10.InstanceName\MSSQL\Binn, where InstanceName is MSSQLSERVER for the default instance, and the instance name for any named instance.

Once I have added all these ports to my exception list, i.e. opening all these ports for incoming traffic allowing access to my server, once I have done that, all my problems were solved and I managed to connect to the SQL server remotely via the Internet (not an internal network) where the client and host have no direct connections what so ever.

Some articles and useful resources related to step 2 (Firewall setup):

One final note: The format to input the server name in the SQL Management Studio connect to server object box is as follows:

,\InstanceName

for example: 92.37.54.28,2345\InstanceName

If you selected the all ports option. i.e. dynamic port = 0 and TCP Port is blank (as in step 1 above), then the format will be something like that:

server name box should have: 92.37.54.28\InstanceName or just the IP address for the default instance (haven’t tried to setup a default instance though.. I have used named instances for added security.

That’s all for now. Hope this helps. Please write a comment if you have anything to add, correct me or if you have any related question. Please let me know if you need any help or support on this.

Thanks,

Mohamed Mostafa


sábado, 6 de noviembre de 2010

Configuración Firewall

Copiado del post, el cual esta muy claro: http://taironcave.com/abrir-puertos-en-el-modem-huawei-echolife-hg520c/

1.- Una vez dentro del panel de control del modem (si no saben entrar aquí está la guía para entrar al Modem Huawei EchoLife HG520c) nos seguimos la ruta Avanzado > Firewall donde veremos una pantalla como esta tendremos que entrar a donde dice “Permitir aplicación(es) individual).

2.- En “Firewall – Permitir aplicación(es) individual(es)” nos mostrara las opciones o mejor dicho una pantalla como esta:

Y esta se tiene que llenar de la siguiente forma:

  • Índice de la regla: Lugar que ocupara nuestro puerto en el listado de firewall.
  • Aplicación: En este caso solo tiene pocas aplicaciones en el menú desplegable lo mejor es agregar un nombre en el primer cuadro yo usare como ejemplo “Utor1”.
  • Protocolo: Para que no tengas problemas con la entrada de datos déjalo de esta manera.
  • Número de puerto de inicio: Aquí es donde iniciaran los puertos abiertos en este caso solo queremos uno tomaremos como ejemplo “36681”.
  • Número de puerto de finalización: Aquí es donde terminan los puertos abiertos como ya dije usaremos “36681” pero si necesitarías digamos 10 puertos abiertos aquí pondrías “36691”.
  • Dirección IP local: Aquí tenemos que colocar la IP que nos da el modem a nuestro equipo recuerden que los puertos solo se abre a un PC, ahora si no sabemos nuestra IP tranquilos solo desplieguen el menú de la derecha y verán todos los equipos disponibles (por seguridad no diré el nombre del mío).
  • Puerto de inicio (local): Tiene que tener el mismo número de puerto que colocaron en “Número de puerto de inicio” de otra manera no se abrirá.
  • Puerto de finalización (local): Tiene que tener el mismo número de puerto que colocaron en “Número de puerto de finalización” de otra manera no se abrirá.

Una vez lleno tiene que lucir de esta manera y si esta correcto solo le dan guardar:

3.- Una vez que ya esté listo aparecerá en su Listado de Firewall lo que agregaron:

Si por alguna razón o mejor dicho por seguridad quiere borrar esta configuración solo tendrán que seleccionar “Índice de la regla” darle borrar y listo abran restringido de nuevo el puerto.

Configuración WebServer con DynDns

Requirimientos:
1.- Internet Information Services (IIS)
2.- IP pública, en este caso dinámica.
3.- Configuración Router.
3.- Configuración DynDns.

Configuración Inicial. (IP LOCAL)

El default gateway por DHCP te asigna una IP dinamicamente para los equipos que se conectar a la red es necesario(bueno no se si lo sea o no pero a mi me funciono) confirar una IP estática a la pc que funcionara como servidor, generalmente te dan los siguientes octetos por default:

192.168.1.xxx
255.255.255.0
192.168.1.xxx [default gateway, que este caso es tu router]


en el DNS configuras para que tu ip publica que la puedes consultar en la pagina del DYNDNS que de como el primario.

182.xxx.xxx.xxx

Con esto creo que seria suficiente para arrancar.

Pruebas:
  1. Que la conexión a internet este disponible.
  2. Que puedas resolver si le das ping al gateway.


Configuración IIS

Primeramente instalar IIS en windowsxp o windows services, cualquier cantidad de información es posible encontrar en la web respecto a como hacer la instalación.

Pruebas:
1.- Ejecutar en el Internet Explorer 192.168.1.xxx [esta seria la ip de tu server]
Validar que el IIS te despliegue la información de inicio.

Nota: si consideras necesario crea una index.htm, con cualquier cosa en el body y haces la prueba.

Configuración DynDns

Es necesario crear una cuenta DynDns, reciberas un email para confirmar y despues de eso todo tuyo a configurar.

  1. Creas un Dynamic Dns Free.
  2. Colocas el nombre de tu hostname.
  3. Refrescas tu IP publica dinamica.
Hasta ese momento todo parecerira jalar pero no. aun hacen falta algunos pasos.


Configuración Router

De acuerdo al modem que tengas es la configuración en este caso estoy utilizando el siguiente modelo:

EchoLife HG520c




Después de un rato al final de cuenta es pura configuración, suerte y espero aporte algo esta información que en resumidas son los pasos muy generales.

Saludos.


Información y herramientas

Configurar Router

Configurando DynDNS, necesito entrar al router que da telmex, busque en la red y encontre los siquiente.

Usuario: TELMEX (todo en mayusculas)
Password: web key (viene en la etiqueta trae el aparato en la parte de atras)

yo voy a seguir configurando, por que necesito abrir un puerto.

Espero esta información les sirva.

Saludos.