I want to connect to a Mysql database remotely. The database accept connections from only local ip like 192.168.0.%. I am wondering if there is a way to connect to the database host by setting my ip using a mask that match the accepted url pattern.

I am not on the same host as the database host

  • Seriously? I was just asking. Why Do you down-vote me? – user3502626 Jul 14 '17 at 19:34
  • Not my downvote, but probably because it looks like a really stupid question to people who have not seen the same type of misunderstandings made by very smart people. Is I mentioned in the meta question I linked we need a way to help people like you. In the meantime you might want start with an introduction on internet routing. – hildred Jul 14 '17 at 19:41
  • I saw your meta question. And I do not know [a lot] about network. I was just asking to know about security (if an Ip address can be faked) and about hacking. – user3502626 Jul 14 '17 at 19:56
  • read the article derobert has started, It still needs work but may help you ask better questions. Also don't worry about the downvotes as you can't get negative rep. – hildred Jul 14 '17 at 20:01

If you have an SSH access to a server in the allowed IP range, you may be able to use an SSH tunnel. From your host:


Then connect to the database:

mysql -H localhost -P 3306

Obviously this is not a long term solution. As soon as the SSH tunnel is stopped, the mysql server won't be accessible anymore.

Plus you need to be sure this way of accessing the server is allowed

  • That SSH access would be on the same host as the Mysql db right? – user3502626 Jul 14 '17 at 19:58
  • Not necessarily. If you have an ssh access to a server in the allowed ip range, you can use it as a relay to the MySQL server – Tim Jul 14 '17 at 22:08
  • Ok. I am gonna test it. – user3502626 Jul 15 '17 at 9:20

Restricting access to an IP range is usually a security measure. I think you've got two sensible options:

  1. Convince the server admin to grant access for your IP, too.
  2. Get an IP in the appropriate range.
  • Well, the question is about hacking. So from your step 2. If I can get a VPN or Tor with an IP in the appropriate range. That can allow me to connect. But in my knowledge. the IPs,, are reserved or used only locally. Or is it possible to have one of that reserved IP for external communication? Sorry for my technical words. I do not know a lot about network – user3502626 Jul 14 '17 at 19:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.