Public network access to the database within the LAN

Source: Internet
Author: User
Tags java web

1, how does the external network server (such as the Java Web) connect to the database in the LAN?
2, how does the public network computer access a service in the LAN?
Scenario: One of our previous projects was to make a Web site that would have access to a SQL Server database within the client's local area network.
The public network computer accesses the database in the local area network???
At that time, we were baffled. At the end of the day, I called to consult the former company's technology Daniel, give me a description of port mapping and peanut shells
First, let's make it clear.
(a) The computer in the public network is a gateway (external network IP) that can access the local area network;
(b) The gateway's extranet IP is assigned by the operator and is not fixed (so the peanut shell is used);
(c) The extranet is not directly accessible to a computer in the local area network.

Our initial solution is as follows:
The client company must surf the internet via Tp-link because Tp-link has port mapping capabilities.
Why serve something mapping? for example, SQL Server database port number is 1433, the computer IP is 192.168.1.125 (example), then you can do port mapping in Tp-link, the effect is as long as access to the public IP port number 1433, Tp-link will be located to the IP is 192.168.1.125 (example) of the computer, that is, tp-link through this mechanism, you can use the port to locate the designated computer on the LAN.
This achieves the purpose of a public network to access a computer in a local area network.

But the customer company uses the telecommunication light cat to surf the net, moreover the telecommunication light cat does not have the port mapping function, therefore must have to connect a tp-link. After connecting Tp-link, the topology diagram is as follows:

In this case, the two-layer LAN, but port mapping can only penetrate a layer of LAN
Now there are two problems:
1, more than a tp-link, because there are two routers there are two layers of LAN, port mapping can only penetrate a layer of LAN;
2, the gateway's extranet IP is subject to change at any time. IP must not be written to death when accessing the public network.

The solution to the

Puzzle 1: Let the light cat only act as bridge, to be more popular, is to act as a network cable. So need to crack light cat, how to crack light cat?
First connect the light cat directly with the computer, get the Super administrator of the light cat, the steps are as follows:
Note: The computer must be straight to the light cat
Log in with the Useradmin account and password behind the cat 192.168.1.1
and then download http:// 192.168.1.1/backupsettings.conf
Open with Notepad and find the telecomadmin+8 number, this is your light cat telecomadmin password.
First find Url>http://devacs.edatahome.com:9090/acs-server/acs, change to Url>http://devacs.edatahome.com.disable : 9090/acs-server/acs, which makes it impossible to connect to the remote Management Server, and then find
< Totalterminalnumber >5</totalterminalnumber; Change 5 to a larger number to remove the limit on the number of optical cat access devices.
then log in to 192.168.1.1 using the Telecomadmin account and the password you just found
to open the http://192.168.1.1/updatesettings.html page and restore the newly changed configuration.
Enter the broadband Settings screen, change the Internet connection from PPPoE to Bridge ( Bridge ), similar to the following interface

set up, let the Router connect the light cat, and then put Host B (SQL Server's computer) connect the number of routers, login 192.168.1.1, first set the Internet parameters (password), and then to set the port mapping.
Note: At this time, the computer directly connected to the light cat will not be able to surf the Internet, must connect the Tplink router, because the light cat only play bridge function.
Question: Why do you want to connect to host B on the LAN, not even the public network database?
No, because the customer has previously purchased a client software, the client software installed a database, and we do the site to obtain the data in the database, so can only connect to Host B database

Port Mappings
Because the port number of the SQL Server database is 1433, we need to map the 1433 port number.
The steps are as follows:
Login to the Tp-link console,


After adding

That is, access to the gateway's 1433 port number is equivalent to direct access to LAN computer 192.168.1.125

Workaround for Puzzle 2:
Using peanut shells
Using port mapping technology, the IP of the public network can change at any time, it is necessary to use the peanut shell software to bind a domain name.
Peanut Shell: Http://pan.baidu.com/s/1pJFgLDL
Or: http://oray.net/PeanutHull/Download.asp
Registration page: https://console.oray.com/passport/register.html
Registration success:

Peanut Shell client:

Open cmd and ping the peanut shell domain name directly:

To view the domain name resolution information, double-click the domain:

Start the peanut shell client on Host B (the computer where SQL Server is located), bind the peanut shell domain name to this computer, as long as the gateway's external IP changes, the peanut shell client will immediately monitor and update the binding.
So the public network of computers as long as access to the peanut shell domain name can access Host B (SQL Server computer)

Attention:
(a) Peanut shell client must be installed on the LAN computer to be accessed by the external network;
(b) Telecom light cat must be cracked, because the normal user login is not visible to the Broadband Settings feature interface.
(c) to crack the light cat, the computer must be directly connected to the light cat, not through the tp-link between the light cat;
(d) Be sure to change the connection type of the light cat to "Bridge"

Description: Host B is a computer in the LAN
The final topology diagram:

Reference: Telecom light cat hack

Public network access to the database within the LAN

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.