I am currently at my uni and connected to uni's network. I set up a server on my PC but noone can connect from outside uni network because ports are blocked, however I have access to one of uni's servers with linux and I think I could make vpn server there and connect from my pc to uni's server and people would connect in this order Internet -> VPN on my uni's server -> My PC but the thing is that I don't know which port is open and unused so I could use it as port for the vpn and the server. How can I check which port is open for sure and if it is unused? Is it possible that this solution will work and people would connect to me like this?
Will list ports in use if you have permissions to check. Trying is the only way to see if a port is open (not being blocked by a firewall etc), one of the many ways to try is;
nc -l $IP $PORT > test.tmp
it will wait for a connection, so then in a different terminal/screen/tmux do
echo test | nc -q 0 $IP $PORT
from outside the network.... nmap is commonly used for port scanning but unless you want to test all ports is not going to help much in this case (and you would need a service binding to all ports first).