This is my setup (the relevant parts, anyway):network

I have port forwarding rules in place (in the Linksys) for all the relevant ports and I've restarted that router multiple times, each time hoping that would be the magic that makes it work. I've tried removing the port forwarding rule and then re-adding it. Still no go.

From the laptop, I can access the NAS (QNAP) via ports :80 and :8080 as well as the counter strike server on the Windows 7 box. So I know those forwarding rules work (and, more importantly, that the client bridged dd-wrt isn't interfering with them).

I can access the MySQL server in the following ways:

  1. auth'd user via phpMyAdmin running on the NAS
  2. auth'd user via local client on Windows 7 machine

I cannot access the MySQL server from the laptop despite the fact that I have 3306 forwarded to (and I've checked the configured port of the server multiple times; it's 3306). It appears to just time out while trying to connect via:

mysql -h -u gnucash_admin

and I get a 2003 error when trying:

mysql -h

nmap -sT doesn't return any results for 3306 at all.

Additional Info:

hosts on Laptop: home.fakedomain.loc

hosts on Windows 7: home.fakedomain.loc

Note: I do not have an actual domain or any name servers, LDAP, etc. All done via hosts files. When trying the above, I've tried by both IP and by name.


From the laptop, I am not able to connect via:

telnet 3306

I am able to log in to the mysql db from the laptop via ssh port forwarding (tunneling to a different machine also on the 192.168.1.x subnet).


So, I connected a hub between the NAS and the router and also connected my Raspberry Pi to the hub (because everything is cooler when done on a RPi). I then ssh'd into the RPi to run:
tcpdump -nS dst port 3306
I can see other traffic headed to the db, but when I run (from the laptop):
mysql -h -u gnucash_admin -p
I see nothing on the RPi. So I re-ran my nmap scan (nmap -sT -p3306 this time with tcpdump running and, again, I see nothing on the RPi.

So, it seems the question has become: why is port 3306 getting filtered (with forwarding rules in place) while other traffic is correctly forwarded?

Another oddity I noticed is that the other db traffic that I saw in tcpdump (dest port 3306) had a source port of 51883. I'm not a TCP guy, so that seemed strange to me. Does the source port have any bearing on this problem?

Does anyone see what I'm missing?

  • MySQL usually have a security of not allowing certain usernames login from random IP address. Check on your MySQL setting to allow gnucash_admin to allow your laptop IP to access it remotely? – Darius Feb 9 '14 at 1:44
  • If that were the issue, wouldn't that have prevented access from the Windows 7 box (which I stated was successful)? – Allen Feb 9 '14 at 1:47
  • It should, unless you already have a current rule to allow win7 IP ( to access it remotely. Or maybe you only allow local subnet on MySQL? (and since your laptop is on 192.168.2.x) – Darius Feb 9 '14 at 1:51
  • The "error 2003" from MySQL also gives a numeric code in parentheses, which provides a platform specific reason for the failed connection. What code do you get when you try to connect? – Michael - sqlbot Feb 9 '14 at 13:24
  • I've seen both 110 and 111, and now I'm trying to remember from where and how I was running when I got each... – Allen Feb 9 '14 at 14:48

So, after having given up on this (I ended up creating a script to start an ssh tunnel, start the program, and then close the tunnel when the program ended), I was in my router tonight and found the problem.

I was so frustrated by the fact that there was no apparent reason why 3306 shouldn't be correctly forwarded. The reason turned to be that I'd forwarded it elsewhere. I have a fairly complicated network (only a small portion shown) and I expose a lot of internal services via port forwarding. The wired Linksys only has a few slots for forwarding rules, so to get around that, I have ranges forwarded. IMAP and Glassfish are on the same server, so I forwarded 143-4848 to their server, but MySQL (3306) is on a different server. <smacks forehead>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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