-1

i have a problem with a mariaDB server, the port is locally open, but on a remote desktop, the port appears closed.

 Port       Status    service
3306/tcp     open      mysql

^^^^ localhost output

Port 3306 is closed on (my IP)

^^^^ remote desktop

Also when i try to open new ports, for example port 123 for a web based game using mode.js, the same thing happens.

Firewall is inactive

All that happened after i once rebooted my vps.

Thank You!

NiKiZe
  • 1,246
  • 8
  • 20
kuba42
  • 1
  • 2

1 Answers1

2

One thing to check if which address it listens on, use netstat -anp | grep 3306 if it is 0.0.0.0:3306 then anyone can connect, however if it is 127.0.0.1:3306 then you can only connect to it via localhost.

To change what MariaDb listen on, change my.cnf and comment out bind-address line, which will make it listen on all interfaces, see documentation

Also check iptables iptables -vnL

Some things that you should provide in original post is which commands you used to obtain the output. And also more details about the network, where is the server that you try to connect to in relation to where the client is located, is it on the same local network, or is there something else in-between?

NiKiZe
  • 1,246
  • 8
  • 20
  • When im running the netstat command you provided, there are 127.0.0.1 ip's. The machine im trying to connect to is a VPS, so im trying to connect to a while another network. The question is now, How can i change the ip's to 0.0.0.0 on mariaDB? – kuba42 Jul 14 '21 at 20:27
  • The other thing is, when i try to open ports for another web server, i also can't connect to it. (It worked fine before i did the reboot) – kuba42 Jul 14 '21 at 20:34
  • Then it only listens on localhost, see edit on how to modify my.cnf to change this. Also remember both the machine, and the hosting can have firewalls, leaving out these details makes it harder to answer. – NiKiZe Jul 14 '21 at 20:35
  • Hey, sorry for a late answer, im sure its not the firewall problem. Im trying to edit 50-server.cnf in etc/MySQL/mariadb.conf.d/ as its mariadb, im uncommenting and changing the bind address to 0.0.0.0, after rebooting my vps it still listens to 127.0.0.1. – kuba42 Jul 15 '21 at 08:03
  • And the iptables command you told me to run, is giving me a bunch of 0.0.0.0 docker ips – kuba42 Jul 15 '21 at 08:04
  • Also, as i said before, all that was working fine before i rebooted my vps. Now i can not even connect to a single service that worked fine before, – kuba42 Jul 15 '21 at 08:39
  • the `iptables` output IS firewall (in hosting there can be multiple layers), check if you have any `DROP` or `REJECT` lines, since that could give similar symptoms. you can use the `netstat` command to check the other services as well. Debugging these issues are all about pinpointing where the issue is, and then be able to solve it - (premature conclusions is one of the enemies), check every step in a bisecting manner. Since you have told us so little about your setup it's hard to help. `netstat` can show you the PID of mariadb, `ps aux could show you the cmdline of that process. – NiKiZe Jul 15 '21 at 09:21
  • Chain DOCKER-ISOLATION-STAGE-2 (1 references) pkts bytes target prot opt in out source destination 0 0 DROP all -- * docker0 0.0.0.0/0 0.0.0.0/0 – kuba42 Jul 15 '21 at 09:41
  • NiKiZe, i dont really know much about it, do you maybe have some communication app like discord where we could talk about it please? – kuba42 Jul 15 '21 at 09:42