I can't connect (using JDBC) to a MySQL database hosted on my home computer(windows 8.1), from a laptop(Windows 7) connected to another network. As a connection url i use "jdbc:mysql://192.168.0.102:3306/.." and I've granted all privileges to the user i'm trying to connect with. I have commented #skip-networking and #bind-address (I also tried with bind-address=0.0.0.0).
The thing is, if I bring the laptop to my home (on the same network as the computer hosting the database), it works just fine, but it doesn't connect anymore when the laptop it's connected to external networks.
Thank you!!
IP addresses 192.168.XXX.XXX are local addresses, which means they can't be reached from beyond the boundary of the router, Unless you set up port-forwarding on the router.
When you connect from outside the network on a particular port on your WAN address the connection will be forwarded to the pc/port you set up in the router.
There are some very good online tools that help you with the configuration like http://portforward.com/.
Be advised that forwarding / opening ports on your router might make your network more vulnerable to hacking.
2 Problems.
*1
U Try to connect to the Database using the localNetworkIP.
open https://www.whatismyip.com/ on the Host, then u get the Internet IP of the Computer.
CAREFULL, most likely ur Internet IP Changes over time ( every 24hours) or u have a static IP. if not u have to use a DynDNS Provider to connect ur changing ip addresses to a DNS Domain.
*2
The PORT 3306 has to be open in the router of the HOST.
Related
I have absolutely no idea what I am doing wrong. About a month ago, I set up my router to work with a server/socket connection in Java. I just moved back to my apartment, and am using a different router with a different ip in a different area.
Connecting to localhost (as the default) with my ServerSocket, and then connecting to the ip I get from whatsmyip.org as the hostname for the client socket, shouldn't I be able to connect?
The server and client are running on the same computer, and if I switch the hostname of the client to localhost, the connection works perfectly. I have a port forwarding set up to my computer's ip address that the router gets for me (not from whatsmyip.org) to port 1640, which is what I was using back at my old place where it was working. What am I doing wrong here?
EDIT 1: I am using DynDNS.com to set up a hostname URL that links to my computer's IP, which I then have all of the clients connect to. The client program can be on any computer anywhere. Before I switch routers, this was working perfectly. I was using the Dynamic DNS feature of the router using my DynDNS account, which was set up on my old router, and my new one. So basically, I should just use my old router?
Some routers will not route the external IP while you are on the internal network. I had a router which was like this. Try connecting from an external location (have a friend try, connect to a remote server and connect back in, or use a device connected to 3G wireless etc).
But im not sure from your question if you actually want to connect from the outside. If you dont, there is no need to creating the port forward (in fact you are just making your server visible to the world unnecessarily). Use the local address of your machine (192.168.x.x / 10.1.1.* etc depending on your router) from any machine within your LAN.
I have fully developed a chat room for multiple clients with multi-threaded server which does the job, however only on my local machine. I want to go beyond this, and make this chat room to be working over the internet. So far I have made the port forwarding on my router for TCP protocol to route to my local IP address, however this didn't solve the problem and I still can't connect the client, even on my own local network. What other steps should I follow to get my chat room working on my own local network and then the internet?
try disable (windows) firewall ?
So my friend the basic rule for make anything to work over internet is to do Port forwarding or in simple way you can say that to open your server for the public network. For that you need to make sure that the routing path is complete from internet machines to your desktop. For this to work you need to open the port for which you need to access your machine from firewall settings, and also ensuring that trafic is routed from your public IP address to the server's IP as your server will be private under some router or ISP.
Way to do that:
You need to configure your home network i.e router setting. So in your router, configure the port you want the communication to happen(say port 5443).
In your router, configure a port-forward for the port 5443 to the internal IP address of your actual server, also to port 5443.
Reference: https://www.noip.com/support/knowledgebase/general-port-forwarding-guide/
On your server(your Desktop Machine) ensure that your firewall settings for port 5443 is on and set to allow rather than block.
Im using TCP/IP sockets in java to try and create a client-server application. The program works fine when run locally and also over the local area network, but when I use the internet IP address the clients connection is refused.
I used this website to get my IP address and have added a firewall entry to unblock the port im using (port 4445).
I am almost certain the problem lies in some sort of security measure that is blocking the port. Does it matter that I'm running the client and server on the same PC but using the IP address from the previously mentioned website?
If I could get a list of ways to test the port is in fact open, or a list of things to try in order to get my program running, that would be great!
That website may very likely give you the IP address of the gateway through which your PC is connecting to the internet, and if the gateway is out of your control (which is most of the cases as far as I know) there's nothing you can do to use that IP address to test your program. Here's some advice:
Try http://aws.amazon.com, once registered you have one-year free access to a micro-server (which can be accessed publicly through DNS/Elastic IP.)
If your PC have a public IP address, you don't need that website to find out what it is. Just check your network adapter control panel.
Where is the server has been located? If your server is located in some commercial hosting, there is possibility that the ports you use are blocked. Also if you use modem with router or just router in your local network you should check nat table.
I'm developing with Java GAE and Google API's with OAuth authentication that requires an URL Callback that receives the access tokens.
To test locally, running Jetty in 127.0.0.1:8888/home.html?gwt.codesvr=127.0.0.1:9997, I've configure a DynDNS domain and set my router to redirect traffic from port 8888 to my machine.
When I do that DynDNS domain shows my router web configuration page, like I was browsing to my router local IP.
I've achieved a workaround activating my StrongVPN account to trick the router loopback, but when DynDNS refresh the VPN IP I can't access anymore, well I have to wait a lot of time to do the trick again.
How can I avoid these loopback connections? Should I set up a proxy? Anyone has met this scenario (local debug GAE+G.APIs+OAuth)?
Edit:
I'll show you my LAN configuration (trying to discard causes):
INTERNET (WAN IP) <-> ISP Router (192.168.1.1) <-> (192.168.1.2) Neutral Router (192.168.0.1) <-> (192.168.0.XX manual static IP) MacBook Local Server
I set this port forwarding configuration in my ISP Router to redirect the incoming port 80 connections to my 8888 port
- TCP port 80 to 192.168.1.2 port 8888
I set this port forwarding configuration in my Neutral Router
- Port 8888 to 192.168.0.XX
The configuration described would be OK because if I access through my mobile 3G connection to mydyndns.dyndns.org I access to Eclipse local web server.
Then, I tried to edit host file as Owen "point your DynDNS domain to 127.0.0.1" says but without success :(
If I set '127.0.0.1 mydyndns.dyndns.org' in my hosts file dyndns domain doesn't work, I think is because port forwarding, but I receive a not found, as if I type 127.0.0.1 in the browser. Eclipse server is attaching 127.0.0.1:8888 then port 80 doesn't have nothing to show.
If I set '127.0.0.1:8888 mydyndns.dyndns.org' in my hosts file I access to the ISP Router web configuration page as I was typing 192.168.1.1. But the address is inmediately replaced on the browser address bar for MY_WAN_IP:80
Then I think that a connection loopback is happening. Any idea about how to fix that :(?
You could edit the hosts file on your machine to point your DynDNS domain to 127.0.0.1 That's what I do.
The location of the hosts file depends on your operating system. Check the Wikipedia article to find it's location in your OS and how to edit it.
In addition to editing your hosts file, I think you can follow the advice in this question/answer to locally forward. https://serverfault.com/questions/102416/iptables-equivalent-for-mac-os-x
I change my ADSL Provider and the main router, with that I reconfigure the scenario as the documents says and it works.
I'm sorry for so specific question, that was a ISP problem who, for any reason, don't support or has any undocumented custom configuration to configure your own server.
Thanks
I fixed this problem by connecting to my ADSL Router via Telnet (the command after you're in telnet is "o router-web-configuration-ip-here") and then I issued the commands to check NAT loopback ("ip nat l"), after verifying it was off I issued the command to turn it on ("ip nat l on"). You can also edit the autoexec.net ("sys edit autoexec.net", "n" [twice], "ip nat l on", "x" ) of the router to make the change permanent.
I also did edit the HOSTS in my machine, placing my server's own local IP tied to the DynDNS host.
I'm using Windows 7 for development, I don't know about your specific configuration, but this might help others doing SO/HO dev.
I need to connect to a mysql database across a network.
The connection string ive given is
"jdbc:mysql://host/dbname"
i can access the site across the network but the only problem is with the java database connection.
Ive updated the phpmyadmin.conf file giving
# Deny from all
Allow from all
But still the database connection cannot be made.
Please help me..
I don't know much aboud phpmyadmin, but what I did to configure a remote db:
The connection string is: jdbc:mysql://host:port/dbname
The port is 3306 by default
The mysql user is often name#localhost, you need to configure a user for the remote (client) machine (IP address, hostname, wildcard)
HTH
Ok, there are few things you need to check ...
1) If your database got username/password
2) Have you restarted your server after altering phpmyadmin.conf?
3) Make sure you are connecting to the correct port. Ex: mysql://host:port/dbname (if port differs from default.
4) make sure that the PC that have the DB allows incoming connections through the port.
If you still facing problems, try disabling your antivirus/firewall on the PC that have the DM and try.