Search code examples
raspberry-piraspbian

Open TCP ports on Raspbian


I am trying to use my raspberry pi as a server, I have a java app using tcp port 1777 and mysql on 3306, however neither one or the other is accessible from lan (both works fine from the pi itself). When I scan the ports open on the pi from my laptop I only see the ssh and vnc ports, but when running the netstat on the pi both ports appear to be in listening state. I am running the latest version of raspbian (image had a ssh and vnc disabled by default, I enabled it in pi configuration (raspi-config)). Any ideas?

enter image description here

enter image description here


Solution

  • In my opinion, check which interface these services are listening on because the services listening on localhost are not 'binded' to the external network so try to make them listening on 192.**** ip address.

    Example : Edit MySQL configuration

    By default, MySQL is not configured to accept remote connections. You can enable remote connections by modifying the configuration file:

    sudo nano /etc/mysql/my.cnf

    and set bind-address = 192.** or bind-address = 0.0.0.0 then restart mysql servic:

    sudo service mysql restart