Linux – How to listen to all ports (UDP and TCP) or make them all appear open in Debian

firewalllinuxtcpudp

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?

Best Answer

tcpdump usually comes as standard on Linux distros. It will log all packets visible at the server note that

  • you probably want to set it running with a filter for your client IP to cut down on the noise

  • I think this includes packets not accepted by iptables on the local machine - but you might want to test this

e.g.

/usr/sbin/tcpdump -i eth0 -c 3000000 -np host client.example.com >tcp.log

Then just run nmap from your client.

Related Question