Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

In a wireless Ad-Hoc network, I have two computers which communicates in UDP together from 192.168.1.3 to 192.168.1.5

I have a third computer (192.168.1.6) which wants to listen to the packets which are not addressed to it. I can see the packets with tcpdump (which sets the wireless card in promiscuous mode).

To redirect the packets, I am using :

iptables -t nat -I PREROUTING -s 192.168.1.3 -j DNAT --to-destination 192.168.1.5

Is it the only rule I need to use? Why isn't it working? Did I miss other requirements?

share|improve this question
    
You are asking about sniffing packets, yet you want to forward them ? What are you trying to do ? –  BatchyX Jun 17 '13 at 20:18
add comment

1 Answer 1

Maybe you just need to instruct the 192.168.1.3 machine that it should reach the .5 machine over the .6 machine (depending on the route command syntax insert gw between the IP addresses):

route add 192.168.1.5 192.168.1.6

...and on the .6 machine ip forwarding needs to be enabled, which can be done by echo 1 > /proc/sys/net/ipv4/ip_forward (note the space after the 1).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.