Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Why don't you use an external service like Shiels UP!? If a port appears as closed (as opposed to stealth), it could be reached from external machines. – enzotib Nov 16 '11 at 8:03
up vote 5 down vote accepted

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


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

Then just run nmap from your client.

share|improve this answer
tcpdump -nnq src host <campus-external-ip> and not port ssh this solved the problem – Michael Nov 16 '11 at 20:24

I don't have a good way to test this right now, but...

I believe you can use iptables to translate every port to a single port. It would be something like the following:

iptables -t nat -I PREROUTING -m multiport -sports 0:65535 -J DNAT --to-destination

That should redirect all incoming ports to 1024. You can then start a server on 1024.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.