Solution to restrict access to the IP address of SQL Server

Source: Internet
Author: User

We only want a computer with an IP address to connect to the SQL Server server. Other clients are not allowed to connect. How can this problem be solved?

Solution: You can set limits on the firewall to only allow 1433 communication with the specified IP address. Of course, from a more secure perspective, you should change port 1433 to another port. Other solution 1 (limited to clients connected from a specified IP address): If SQLServer2005 is used, you can also use the endpoint restriction method. This method requires a dedicated Nic, all clients that can connect to SQLServer are connected through this NIC (assuming the IP address of this Nic is 192.168.1.1): 1. in "SQLServer2005 network configuration" of "SQL Server Configuration Manager", all protocols except TCP/IP are prohibited; 2. use the following T-SQL to disable the default TCP endpoint! -- Code highlighting produced byActiproCodeHighlighter (freeware) --> alter endpoint [TSQL Default TCP] STATE = STOPPED 3. Use the following T-SQL to create new TCP endpoints and authorizations! -- Code highlighting produced byActiproCodeHighlighter (freeware) --> USE master GO -- Create a New Endpoint! -- Code highlighting produced byActiproCodeHighlighter (freeware) --> create endpoint [TSQL User TCP] STATE = started as tcp (LISTENER_PORT = 1433, LISTENER_IP = (192.168.1.1) -- network address of the listener) for tsql () GO -- Grant all logon (or specified logon) the connection permission to use this endpoint! -- Code highlighting produced byActiproCodeHighlighter (freeware) --> grant connect on endpoint: [TSQL User TCP] TO [public] After completing the preceding configuration, only clients connected by NICs configured with the network address 192.168.1.1 can access SQLServer. In addition, if only the connection permission for the specified logon to the endpoint is granted, only the specified logon can access SQLServer instance. Other solution 2 (limited to client access with the specified IP address) when SQL Server 2005 is upgraded to SP2 or a later version, new triggers can also be used for control. After the following T-SQL is executed, client connection except IP address 192.168.1.1 fails.! -- Code highlighting produced byActiproCodeHighlighter (freeware) --> USE master go create trigger tr_LoginCheck ON ALL SERVER FOR LOGON AS ROLLBACK TRAN GO

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.