Skip to main content

networking - Why can't I access MySQL server with port forward rule in router?


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 192.168.1.101 (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 192.168.2.103 -u gnucash_admin


and I get a 2003 error when trying:


mysql -h 192.168.2.103


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


Additional Info:


hosts on Laptop:


192.168.2.103 home.fakedomain.loc


hosts on Windows 7:


192.168.1.101 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.


Update


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


telnet 192.168.2.103 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).


Update


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 192.168.2.103 -u gnucash_admin -p
I see nothing on the RPi. So I re-ran my nmap scan (nmap -sT -p3306 192.168.2.103) 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?



Answer



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.


Comments

Popular Posts

How do I transmit a single hexadecimal value serial data in PuTTY using an Alt code?

I am trying to sent a specific hexadecimal value across a serial COM port using PuTTY. Specifically, I want to send the hex codes 9C, B6, FC, and 8B. I have looked up the Alt codes for these and they are 156, 182, 252, and 139 respectively. However, whenever I input the Alt codes, a preceding hex value of C2 is sent before 9C, B6, and 8B so the values that are sent are C2 9C, C2 B6, and C2 8B. The value for FC is changed to C3 FC. Why are these values being placed before the hex value and why is FC being changed altogether? To me, it seems like there is a problem internally converting the Alt code to hex. Is there a way to directly input hex values without using Alt codes in PuTTY? Answer What you're seeing is just ordinary text character set conversion. As far as PuTTY is concerned, you are typing (and reading) text , not raw binary data, therefore it has to convert the text to bytes in whatever configured character set before sending it over the wire. In other words, when y...

linux - Extract/save a mail attachment using bash

Using normal bash tools (ie, built-ins or commonly-available command-line tools), is it possible, and how to extract/save attachments on emails? For example, say I have a nightly report which arrives via email but is a zip archive of several log files. I want to save all those zips into a backup directory. How would I accomplish that? Answer If you're aiming for portability, beware that there are several different versions of mail(1) and mailx(1) . There's a POSIX mailx command, but with very few requirements. And none of the implementations I have seem to parse attachments anyway. You might have the mpack package . Its munpack command saves all parts of a MIME message into separate files, then all you have to do is save the interesting parts and clean up the rest. There's also metamail . An equivalent of munpack is metamail -wy .

Desktop reboots itself on sleep or hibernate

I have been using an ASUS M2NPV-VM motherboard for main home desktop workstation, operating Windows Vista x64. This computer has right from day one not been able to enter hibernate or standby; after Windows performs its final actions and brings the machine down, it would automatically revive itself for a reboot. Updating to the second latest BIOS (1201)has not helped (the latest BIOS revision would induce video refresh problems rendering it unusable). I have been reading related discussions on incidents similar to mine to no avail of a true workable solution. They appear to be more speculative guesses rather than actual knowledge on the inner workings of motherboard hardware. Does anybody have any electronic engineering experience on PC energy-saving standards to provide a more informed opinion how to go about getting this to work? More stories: this motherboard could not even reboot properly the first thing i used it. It was due to refresh rate of the onboard GPU, which had no influe...

keyboard - Is there any utility/method to change Windows key bindings to type rare chars to currently empty bindings?

I'm currently typing this post with my windows XP machine and (Spanish) keyboard, and I'd like to add some extra symbols to my text. I could open the "char map" windows utility, look for the desired symbols, and paste them. But I'd like something quickier. For example, when I'm using my OSX Mac at work, I can easily add a ©, ™, ® or similar symbols, just pressing some weird ALT-GR + G / H / J, key combinations. In my (Spanish) keyboard mapping, these combinations are empty, as they don't produce any char at all, which, on the other hand, is perfectly normal and desirable. So, I thought: Why couldn't I add some extra key mappings on top of my currently empty ALT-GR + G/J/H Keys in my Spanish keyboard, and thus, being able to quickly type these special symbols? So that's my question: Is there any utility/method to achieve that effect under windows? (My version is XP). I've even googled this for some time but no luck. I've been a long term Hot...