Operating System - Linux
1834770 Members
3135 Online
110070 Solutions
New Discussion

tracing ""out going traffic thru a port""

 
SOLVED
Go to solution
vnykr
Advisor

tracing ""out going traffic thru a port""

can we trace the traffic going thru particular port in our own computer.and how??
how i have to proceed..
i dont have unix n/w programming idea.
but i want to learn .so pls kindly guide me..

byeeeeeee

4 REPLIES 4
Kodjo Agbenu
Honored Contributor
Solution

Re: tracing ""out going traffic thru a port""

Hello,

Assuming you are talking about TCP/IP port, you can use either a network traffic spy like tcpdump, or a packet filtering utility with logging capabilities like iptables.

=> tcpdump : just read the syntax and start it on an "ad-hoc" basis. Other utilities exist (ethereal, ...).

=> iptables : can be configured to finely tune permanent logging (and of course filtering) of TCP/IP traffic.

Example with iptables :

# Create a user-defined chain for logging
iptables -t filter -N LOG_OUTPUT
iptables -t filter -A LOG_OUTPUT -j LOG --log-level debug --log-prefix OUTPUT --log-tcp-sequence --log-tcp-options --log-ip-options

# Log outgoing traffic
iptables -t filter -A OUTPUT -j LOG_OUTPUT



Of course, the example above is not guaranteed "syntax error-free", and has to be customized.

Good lcuk.
Kodjo
Learn and explain...
Steven E. Protter
Exalted Contributor

Re: tracing ""out going traffic thru a port""

Shalom vnykr,

Also,

tcpdump -i eth0 port 22

Change the eth and port to something actual.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
g33k
Valued Contributor

Re: tracing ""out going traffic thru a port""

as SEP said tcpdump

well iptables is also OK but if you wanna exactly see one port and all posible information then tcpdump is best solution, there is also a posibility to store packets from tcpdump to files and then read them, for reading you can use wireshark(is more confortable).

So decide what you exactly need and how much space and time do you have.

Read man iptables and man tcpdump
vnykr
Advisor

Re: tracing ""out going traffic thru a port""

thanks all