As the answers to Tcpdump on multiple interfaces provide, which @Marged linked to above, you can run tcpdump
(or tshark
or dumpcap
) specifying -i any
as the interface if you don't mind capturing traffic on all interfaces. And if you only want traffic on those 2 specific interfaces, then you can simultaneously run 2 separate instances of the capture tool, one capturing on the eth0 interface, the other capturing on the eth1 interface and then merge the two capture files together using a tool such as mergecap
.
Alternatively - and much simpler in my opinion - is to just use a single instance of either dumpcap
or tshark
to capture traffic on both interfaces to a single capture file with no merging of separate capture files needed at all. As the man pages for those tools indicate, "This option can occur multiple times. When capturing from multiple interfaces, the capture file will be saved in pcapng format."
For example:
tshark -i eth0 -i eth1 -w eth0_eth1.pcapng