I got an external Debian server. The problem is that my university campus doesn't allow connections to go outside when the port is different than TCP port 22, 80, 443, or UDP port 123. I tested them manually. On my Debian server I would like to listen to all my UDP and TCP ports so I can clearly figure out which TCP and UDP ports my university let through their firewall. Nmap is wonderful on the client side to test that, but what should I do on the server side?
A simple and passive solution would be to log all incoming connection attempts to syslog, run your scan, and when you get home look at the logs. With iptables, you can log connections like this:
iptables -A INPUT -p tcp -m state --state new -j LOG --log-prefix "New connection: "
That way, you don't need to run a service that answers all connetion attempts.
Use your regular application to list on one port. Use
iptables to forward all ports to the open port by means of the dnat module.
iptables -A PREROUTING -i interface -p tcp -j DNAT --to-destination your.ip:port iptables -A PREROUTING -i interface -p tcp -j DNAT --to-destination your.ip:port
Someone has already done the server side for you PortQuiz.net.
You should then be able to do this either manually on a web-browser or use your NMAP or script something automatic in something like Python.