Skip to contentSkip to conversation

Packet Sniffing

DISCUSSION Patrick Ahler 3 participants 3 messages Apr 14, 2003 – Apr 16, 2003

lore
Share & tools
lore
#0 lore raw

Using iptables as a firewall/gateway/router machine for my stub network. Using snat and dnat to translate internal ip's to public and vice versa.

Want to setup a machine inside the network to packet sniff. I was hoping iptables could do this. What I'd like is if iptables would route each incoming packet to the correct machine, but also direct it to the packet sniffer (in other words duplicate the packet and send to 2 destinations).

Just wondering if this is possible and if it is how can I set this up? I've also tried doing all my packet sniffing off the firewall, but I've been unsuccessful, can't seem to get ethereal to look at the forwarded packets. If someone knows a way to successfully do setup either solutions please let me know.

Thanks,
Patrick

#1 lore raw

From: "Patrick Ahler" <[email protected]>

Quoted 6 lines

Want to setup a machine inside the network to packet sniff. I was hoping iptables could do this. What I'd like is if iptables would route each incoming packet to the correct machine, but also direct it to the packet sniffer (in other words duplicate the packet and send to 2 destinations).

Just wondering if this is possible and if it is how can I set this up?

I've

Quoted 3 lines

also tried doing all my packet sniffing off the firewall, but I've been unsuccessful, can't seem to get ethereal to look at the forwarded packets. If someone knows a way to successfully do setup either solutions please

let

Quoted 1 line

me know.

I think things are a bit misconcepted over here...

First, the sniffer machine needs not to receive any packet. It just grabs them from the network when in promiscous mode.
Also, if you have a switch on your internal network, not all packets will be broadcasted to the sniffer. So your best choice is to run the sniffer on the firewall itself, where all the traffic passes through (or just set up a small hub -- not a switch -- on it's input interface along with the sniffer computer, this should also work).
The way I do when I need to troubleshoot something is to run tcpdump with the -w option to capture to a packet file, along with the -s 0 (to capture full packet), and then open the saved file with ethereal to check the packets. It works perfectly. But if you need real time sniffing then go for the prior option (the one with the little hub).

Have fun,
Marcelo.

#2 lore raw

iptables 1.2.8, mangle-recomputes, userspace?

Hello, poking around at the website I see the 1.2.8 is out. In the 'history'
(http://www.iptables.org/downloads.html#cvs) it appears there is a patch-o-matic entry between 1.2.7a and 1.2.8. To use 1.2.8, do I need to do anything special? I currently have the 2.4.20 w/ebtables patches.

Also, when mangling the contents of a packet (including payload size), is there anything special you need to do aside from recomputing IP and TCP/UDP checksums?

Lastly, are there any good references for userspace apps? There is a ton for the netfilter, but was looking for more in the way of userspace concepts & activities. Thanks!

-Scott

__________________________________________________
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo
http://search.yahoo.com