Tuesday, November 13, 2012

Connecting to Mysql Server Via PPTP VPN Protocol



Connecting to mysql server through virtual private network protocol is very easy to do from the stage of setting up process until the implementation.
I am writing this article, I assume with this condition :
  • Mysql server is running up on the local computer network
  • Access the Internet using an ADSL modem router
  • Client computers that are outside the office want to connect to mysql server that is on your local computer.
Let's get started.





A. Setting up a computer for VPN Server


Vpn network can be executed with a simple home network configuration, like diagaram here :



PC User ----->make vpn connections via internet ----->PPTP VPN Server

 1. Click Start -> Control Panel -> Network Connections -> Create a New Connection    


2. Then click next - Choose "Set up an Advanced Connection"

     set-up-a-vpn-connection
3. Then click next - Choose " Accept Incoming Connections"
accept-incoming-connections
4. Please Ignore this device for connection entry page, just click Next.
devices-for-incoming-connections 
5. Select the option Allow virtual private connections and click Next
allow-virtual-private-connections
6. Select the users who should be allowed to connect to the VPN server.
    In this case, I choose a regular user ALV4RO

save-crop
7. Click Next -> Select "Internet Protocol (TCP / IP)" -> Properties , don't forget check
    "Allow callers to access my local area network" If you allow users to access the local area network
    includes share files / printers / other devices which shared) If you do not allow, please don't check it.
    untitled-2-crop
    Select "Assign TCP / IP addresses automatically using DHCP" If you use a DHCP server
    (need a special program because XP does not provide a DHCP server by default).

    Select the "Specify TCP / IP addresses' range (limits) eg 192.168.0.1 to 192.168.1.255
    then automatically connected client will get an IP within that range for available.
    Select "Allow calling computer to specify it's own IP address"
    If a user is connected may change the configuration of the TCP / IP manually yourself.

    Setting up MySQL host
    mysql_host
    Use sqlyog or others to log in your mysql server, after log in find User Manager – choose root – and the most
    important is Host = % ---> ( it means allow MySQL to be access from anywhere )
 
B. Setting Up PPTP Port Forward on your Modem Router
What is port forwarding? it is a diversion port forwarding (redirection) connections from one IP: Port to IP: Port to another. In other words, all the connections are directed to the IP: port of origin will be transferred to the IP: port destination.
In this tutorial i used TP-LINK Modem + Router.
  1. Open the admin panel of the modem by accessing http://192.168.1.1
  2. Select the tab "Advanced Setup", then select "NAT", then click "Virtual Servers"NAT
  3. Select Index Rule 1 (if there is no ports forwarded in the tables)
  4. please give application name are named according to your choice, because it's just a name only, in this example i gave it name “PPTP”
  5. Protocol selected "All"
  6. Start Port and End Port filled in 1723, because I only want to forward port 1723 only
  7. Local IP Address is filled in accordance with the IP address your laptop or computer. Make sure the IP address your laptop or computer is static, not Dynamic.
  8. Then click "Save"

C. Setting Up DDNS on your Modem Router
DDNS or Dynamic Domain Name Server is a mechanism for a machine that has a name that is easy to remember. Besides the fact that the main function is to resolve DDNS Public IP Address that is always changing.
DDNS will address a public IP address that is always changing with the host name. So regardless of the IP address to the DDNS we are going to turn it into a hostname. Example hostname: segokucing.no-ip.org
so DDNS service itself in the form of a third party in the form of hostname. There are paid and many are free.
One well-known service provider is www.no-ip.com
  • Just simply registering with an email that we have. You will get notifications to your email.
  • Choose the hostname that you want.
  • Limitations of the free domain name service is provided by the providers is very limited. For example hostname xxxx.no-ip.org,  We are only given the freedom to change the xxxx part of its course while the 2 words behind it has been fixed. Example: segokucing.no-ip.org
In this tutorial i will use www.no-ip.com, others DDNS provider you can try www.dlinkddns.com
  1. Select the tab “Access Management”, then select DDNS
  2. DDNS
  3. Dynamic DNS       : Activated
  4. Service Provider : www.no-ip.com
  5. MY host name     : fill with your registration from no-ip.com ( example : iwakpeyek.no-ip.org )
  6. Username            : fill with your username registration when you register from no-ip.com ( example : iwakpeyek )
  7. Password            : fill with your username registration when you register  from no-ip.com
  8. Then click "Save"

D. Configuring PPTP VPN Client on Windows XP
Please note if your PPTP server is behind a router with a DSL / cable internet connection and you are trying to connect to the internet, then you have to connect to your public IP DSL / cable internet connection.
  1. Go to Start and open Control Panel.
  2. then double-click the Network Connections icon then Create a New Connection
  3. Choose Connect to the network at my workplace
  4. connect-to-the-network-at-my-workplace
  5. The choose Virtual Private Network Connections option
           virtual-private-network-connection
    6.    Then give it connections  name
           vpn-connection-name
     7.   If you have a dial up connection settings on your computer, this window will appear Public Network.
          If your computer is already connected to the public network or a hotspot,
          click Do not dial the initial connection    option. If you need to call an internet connection
          and then initiate a VPN connection, then you need to choose another option,
          automatically dial the initial  connection.
          do-not-dial-the-initial-connection
    8.   Then give your hostname or IP address from your server
          vpn-server-selection
          Change default IP 178.63.24.34 to your DDNS name, example : iwakpeyek.no-ip.org
     9.  Click finish to complete connection wizard
          complete-PPTP-vpn-client-setup
   10.  Open your windows desktop and double click VPN connection icon, give your username and password
          connect-to-pptp-vpn-server
          After connected to our vpn server ,you can check connections status icon on Network Connections window
          connected-vpn-icon



















No comments:

Post a Comment

Recent Posts