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

Use Google instead of Bing with Windows 10 search

I want to use Google Chrome and Google search instead of Bing when I search in Windows 10. Google Chrome is launched when I click on web, but it's Bing search. (My default search engine on Google and Edge is http://www.google.com ) I haven't found how to configure that. Someone can help me ? Answer There is no way to change the default in Cortana itself but you can redirect it in Chrome. You said that it opens the results in the Chrome browser but it used Bing search right? There's a Chrome extension now that will redirect Bing to Google, DuckDuckGo, or Yahoo , whichever you prefer. More information on that in the second link.

linux - Using an index to make grep faster?

I find myself grepping the same codebase over and over. While it works great, each command takes about 10 seconds, so I am thinking about ways to make it faster. So can grep use some sort of index? I understand an index probably won't help for complicated regexps, but I use mostly very simple patters. Does an indexer exist for this case? EDIT: I know about ctags and the like, but I would like to do full-text search. Answer what about cscope , does this match your shoes? Allows searching code for: all references to a symbol global definitions functions called by a function functions calling a function text string regular expression pattern a file files including a file

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 - CentOs 7.1 - Install Tomcat 8

I am using this tutorial as a setup reference to getting a Tomcat 8 running on CentOs 7.1 , but after typing: [root@localhost tomcat]# sudo systemctl start tomcat I get the error: Job for tomcat.service failed. See 'systemctl status tomcat.service' and 'journalctl -xn' for details. systemctl status tomcat.service prints the following: [root@localhost tomcat]# systemctl status tomcat.service tomcat.service - Apache Tomcat Web Application Container Loaded: loaded (/etc/systemd/system/tomcat.service; disabled) Active: failed (Result: exit-code) since Wed 2015-11-25 16:54:33 CET; 1min 19s ago Process: 45873 ExecStart=/opt/tomcat/bin/startup.sh (code=exited, status=203/EXEC) Nov 25 16:54:33 localhost.localdomain systemd[1]: Starting Apache Tomcat Web Application Container... Nov 25 16:54:33 localhost.localdomain systemd[1]: tomcat.service: control process exited, code=exited status=203 Nov 25 16:54:33 localhost.localdomain systemd[1]: Failed to start Apache Tomcat Web App...