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 am using a Ubuntu machine as a NAT router. How can I find out the following:

  • the ports on which the LAN machines are listening or communicating (both tcp and udp);
  • which local machines have established connections with which WAN ip's on those ports;
  • and the size of data that has been transfered on those ports.
share|improve this question
up vote 1 down vote accepted

I think you want to try netstat-nat I seem to remember using it when I had a Slackware box set up as a NAT-server.

share|improve this answer

sudo iftop

sudo netstat -ntlp

sudo tcpdump -i /dev/ethX

share|improve this answer

You could also try "lsof " with a combination of different flags one in particular "-i" , if you don't have the package , see that you install it, the data displayed is easily read and can give you a good insight about whats happening on your network.

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.