I'm trying to configure my VM with SQL Server 2008 R2 Express so that I will only be able to remotely access SQL using SQL Server Management Studio from host machine.
- running Windows Web Server 2008 R2
- There are two NICs:
- Bridged so it connects to Internet
- Host only so I can communicate faster over virtual network
- SQL Engine and Browser services are both running
- I have enabled TCP/IP protocol for SQL Express but haven't configured any IP Addresses (separate tab)
- I've added incoming firewall rules for:
- 1433 TCP port
- 1434 UDP port
- If I look into network connections I see both my NICs connected to networks. I can set bridged network to Workplace but I can't change network type of the host-only network. So it's set to Public by default. I'm not sure whether this has anything to do with it but that's how it is.
The only thing I've done on my host is that I've put a name to my VM IP. And I've done so with the Host-only IP address. I've added an entry in my HOSTS file.
Then I open SSMS on my host machine and if I select Browse for more in the Connect to Server dialog window I can actually see my VM's SQL instance. But when I try to connect to it, this is what I get when I try to connect in the following three ways:
machine name (my HOSTS file will do the IP remapping)
bridged network IP address
host-only IP address
Question 1: What else can I configure so that I will be able to access my VM's SQL instance? If possible I would also like to configure it, so that I can only access it via Hots-only network and not through the bridged one. But that would just be an added bonus if I could configure it that way.
Question 2: Do I actually need SQL Browser to run because as far as I know it only takes care of the SQL instance being discoverable. If I know SQL instance is there and I know it uses port 1433, can't I simply connect using this Server name:
This is netstat's result:
I also ran portqry on the host to check for my SQL instance on my VM. If I try bridged IP address I actually get SQL Browser's response:
Starting portqry.exe -n 192.168.1.143 -e 1434 -p UDP ... Querying target system called: 192.168.1.143 Attempting to resolve IP address to a name... IP address resolved to Datavm querying... UDP port 1434 (ms-sql-m service): LISTENING or FILTERED Sending SQL Server query to UDP port 1434... Server's response: ServerName DATAVM InstanceName SQLEXPRESS IsClustered No Version 10.50.1600.1 tcp 49159
As I can see in this result my SQL instance is actually listening on TCP port 49159.
So I went in SQL configuration and changed this port to 1433.
Question 3: Is it normal that port wasn't set to 1433 by default? Should I change it back to 49159 and change my inbound firewall rule to pass through this port or shuld I now leave it on 1433?
By changing port to 1433 I can connect to VM from my host machine SSMS. But I can only do this using bridged IP address.
As I understand TCP/IP settings in SQL protocol the IP Addresses should list all machine's IP addresses. I can see 5 of them:
- bridged NIC V6 address
- bridged NIC V4 address
- localhost V6 (::1)
- localhost V4 (127.0.0.1)
- some ? V6 address that's not related to bridged nor host-only network (fe80::100:7f:fffe%12)
I'm assuming this is also the reason why I can't connect using host-only network... But how do I configure my VM so that I will be able (and possibly disable the bridged one)?