I'm using tcpdump and tcpreplay in ubuntu for capturing packet and resending(with rewriting and openwrt for ap mode in raspberry pi.
My problem is that I cannot capture resent packet.
This is my network :
A ----> B(RPI) -----------> C
192.168.0.199 eth0. wlan0 | 192.168.2.172
192.168.0.100 192.168.2.1 |
------------> D
192.168.2.222
I sent packet(using nping) from A to B, and used portforwarding
nping in A :
nping --udp --dest-port 7777 --dest-ip 192.168.0.100
portforwarding in B using iptables :
iptables -t nat -A PREROUTING -i eth0 --dport 7777 -j DNAT --to 192.168.2.222
So, I done here.
And I write this in D
tcpdump -i wlan0 dst port 7777 -w packet.pcap
tcprewrite -i packet.pcap -o packet_rewrite.pcap -D 192.168.2.222:192.168.2.172
tcpreplay -i wlan0 --topspeed packet_rewrite.pcap
But, in C, I cannot capture modified packet...
tcpdump dst port 7777
I really want to know why i can't...please let me know
and i'm really sorry my explain is not good....
further search.. I captured packets in B (wlan0) Because i edited packet's source mac to my ubuntu wlan mac address... But as before, I cannot capture packets in C... This is captured packets in B
and even replayed packet didn't pass iptables...
I solved!!!!!!!!!!!!!!
I had to change dmac to C's mac address....I was stupid....