Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I seem to be having trouble finding just the right syntax to capture all traffic between 2 IPs.
I've tried a number of commands, but haven't seemed to find the right combo.
I am on RHEL 8.8.
A list of commands I have tried:
tcpdump -s 0 -vv -c 100 -i ens192 -xX src host IP and dst host IP and not stp -w /tmp/capture.pcap
tcpdump -nli ens192 host IP and IP -w /tmp/allcap.pcap
tcpdump -s 0 -vv -c 100 -nli ens192 host IP and IP -w /tmp/allcap.pcap
I've tried separate commands for each IP. However, neither of those limits the capture to just the 2 IPs that I want.
tcpdump -ni ens192 src host IP -w /tmp/capout.pcap
tcpdump -ni ens192 dst host IP -w /tmp/capin.pcap
I'm trying other options, but I thought I'd try you guys.
Thanks
If you have space enough, it might be useful to capture the more complete dump and then filter the output to build a database of the traffic only involving BOTH of your two addresses.
I seem to be having trouble finding just the right syntax to capture all traffic between 2 IPs
A you are wanting to capture packets going to another IP address that is not the machine that you are on? You need to put the ethernet interface into promiscuous mode.
Code:
ip link set eth0 promisc on
Read about the security risk of doing that before you do.
I didn't have to worry about any of that.
tcpdump -s 0 -c 100 -vv src host 10.0.0.1 and dst host 10.0.0.2 -w /tmp/capin.pcap
I just changed the IP around and ran the command a 2nd time.
tcpdump -s 0 -c 100 -vv src host 10.0.0.2 and dst host 10.0.0.1 -w /tmp/capout.pcap.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.