Help with capturing/reading total packets on specific port number


 
Thread Tools Search this Thread
Special Forums IP Networking Help with capturing/reading total packets on specific port number
# 1  
Old 10-16-2009
Help with capturing/reading total packets on specific port number

Hi guys,

I'm using a Linux system(Ubuntu) and I've been trying to find a method to read the total packets received/sent on a specific port (e.g port 80 or port 25) on a local machine. I can read the overall total packets received/sent from the /proc/net/dev file system. But what I can't do is read packets received/sent from a specific port. I don't think there is any information about total packets on a specific port in any of the /proc file system. So, what is the best way to get this information?

I would like a way to do this so that I can display the activity on a specific port for my program I'm working on. Thanks

---------- Post updated at 02:46 AM ---------- Previous update was at 02:34 AM ----------

Okay, i've found out that I can use tcpdump to do this. This can be one of the many ways. I would prefer a different method where I do not need to install packet capture libraries like libpcap for my program to work. Besides, I need to have root privilege to use libpcap. Any other ideas?

Last edited by lildee; 10-16-2009 at 09:59 AM..
# 2  
Old 10-16-2009
The iptables firewall can be made to simply log activity rather than actually filtering but it would need to load modules as root.
# 3  
Old 10-17-2009
Thanks for the reply, I will look into iptables
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

How to find port number wwn of particular port on dual port HBA,?

please find the below o/p for your reference bash-3.00# fcinfo hba-port HBA Port WWN: 21000024ff295a34 OS Device Name: /dev/cfg/c2 Manufacturer: QLogic Corp. Model: 375-3356-02 Firmware Version: 05.03.02 FCode/BIOS Version: BIOS: 2.02; fcode: 2.01;... (3 Replies)
Discussion started by: sb200
3 Replies

2. HP-UX

Total number of files in a FS

Hello people, On HP-UX B.11.11 U 9000/800 How can I have in aprox. the total number of files in a specific FS? Is the number of used inodes a rough estimation of my total number of files? Server1 /Data:df -i . /Data (/dev/vg_Data/lvol1 ) : 18292960 total i-nodes 15800945 free... (3 Replies)
Discussion started by: drbiloukos
3 Replies

3. Shell Programming and Scripting

Help with sum total number of record and total number of record problem asking

Input file SFSQW 5192.56 HNRNPK 611.486 QEQW 1202.15 ASDR 568.627 QWET 6382.11 SFSQW 4386.3 HNRNPK 100 SFSQW 500 Desired output file SFSQW 10078.86 3 QWET 6382.11 1 QEQW 1202.15 1 HNRNPK 711.49 2 ASDR 568.63 1 The way I tried: (2 Replies)
Discussion started by: patrick87
2 Replies

4. UNIX for Advanced & Expert Users

copy packets from one port to another by iptables

I would like to copy data flow (not redirect!!!) from 1567 port to another 1194 port on same computer. The 1567 Port already binded by Scream program (it is bisy). Is it possible to do it by iptables or for it nesessary another programs? Can you help me in the decision of this question? (1 Reply)
Discussion started by: yanat
1 Replies

5. IP Networking

Retrieve exchanged packets on a particular port

Hi, I want to find out someway to get the number of exchanged packets (received, transmitted or both) on a particular service (so per Port). There are many network tools on linux (netstat, /proc/net/dev, iptables...) but I can not find an efficient way to get these information. All I can do is... (3 Replies)
Discussion started by: nightoy
3 Replies

6. Infrastructure Monitoring

Capturing bad packets

Hello, SNMP reports from my Linux server a large number of "ipInAddrErrors" on several of my systems. According to one description, these packets are discarded datagrams due to: How do I determine what packets these are? Can tcpdump help? If so, can anyone suggest a filter? (1 Reply)
Discussion started by: otheus
1 Replies

7. IP Networking

tcpdump -w file is not capturing all the packets

I am trying to capture tcpdump for traffic to a port in a file but this does not seem to capture all the packets. Command I use is : tcpdump -w tdump.dat port 22 Why is it not capturing all the packets ? Here is my experiment: root@pmode-client6 adc-demo]# tcpdump port 22 tcpdump:... (5 Replies)
Discussion started by: radiatejava
5 Replies

8. Shell Programming and Scripting

Capturing a number at the end of line and store it as variable

Hello, Would someone guide me on how to write a shell script the would search for a phone no using at the end text file using sed or awk and store it in a varaible or print it. The text file is in this form text or numbers in first line text or numbers in second line . . . Firsname... (6 Replies)
Discussion started by: amuthiga
6 Replies

9. Cybersecurity

Reading and Manipulating captured packets (pflog file)

Hey, I currently have a set of captured sessions thru ethereal, saved in pflog files, basically its a tcpdump, which i need to go thru and sort the applications/protocols in order of the times they were used. I also need to change the headers of the packets, basically the source and destination... (0 Replies)
Discussion started by: PenguinDevil
0 Replies

10. IP Networking

NAT Packets/Port Openine

Firstly, I have no knowledge of hubs, so please keep any advice simple! I have a UNIX hub, connecting three PCs and would like to know if the hub has NAT translation for incoming packets and if th hub is able to NAT translate packets coming in to a local (internal) LAN address.. (3 Replies)
Discussion started by: MartinD
3 Replies
Login or Register to Ask a Question