LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Closed Thread
  Search this Thread
Old 02-15-2011, 02:29 PM   #1
jkmin96
LQ Newbie
 
Registered: Feb 2011
Posts: 7

Rep: Reputation: 0
can sniffed packets be forwarded to a different network?


Hi,

I'm using madwifi linux driver (ath1) in monitor mode to capture some wireless traffic.
I can see that all wireless traffic is coming well through the wireless interface (checked using TCPDUMP).

What I want to know is how I can forward the captured wireless packets to a different Ethernet interface (e.g. eth2) in the same machine to send those captured packet out to a different computer.

I set 1 for /proc/sys/net/ipv4/ip_forward
for iptables, I tried this rule: iptables -A FORWARD -i ath1 -o eth2 -j ACCEPT

However, I coudn't read any packet from eth2 via TCPDUMP.
I think I'm missing some important things to do this.

Could you please give me a direction? It would be really appreciated.

Thanks,
JK
 
Old 02-15-2011, 02:44 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Maybe use prerouting before you setup the forwarding?
 
Old 02-15-2011, 03:13 PM   #3
jkmin96
LQ Newbie
 
Registered: Feb 2011
Posts: 7

Original Poster
Rep: Reputation: 0
corp769;
Thanks for your comment. But I don't understand your comment because I'm new on iptables.
Did you mean that I need to use NAT? and could you let me know why prerouting is needed before forwarding?

Thanks,
JK
 
Old 02-15-2011, 03:23 PM   #4
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Check these out for reference.

http://forum.soft32.com/linux/IPTabl...ict440623.html
http://www.linuxreport.org/content/view/26/23/

Overall, you want to preroute so you can forward what you need to a new destination interface or IP address.
 
Old 02-15-2011, 03:31 PM   #5
jkmin96
LQ Newbie
 
Registered: Feb 2011
Posts: 7

Original Poster
Rep: Reputation: 0
corp769;
Thank you so much.
I will check those links out.

Thanks,
JK
 
Old 02-15-2011, 03:42 PM   #6
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Not a problem, that's why I'm here. Wasting my work time for linuxquestions.org
 
Old 02-15-2011, 08:00 PM   #7
jkmin96
LQ Newbie
 
Registered: Feb 2011
Posts: 7

Original Poster
Rep: Reputation: 0
To make my problem simple, I tested this simple case with iptables.

There are three nodes: a wireless node, an AP and a server.



client ---------(wireless)--------- AP -------(Ethernet)--------- server



Using iperf, client send udp or tcp packets to a server via an AP.
I run another iperf server on AP and I try to intercept the udp iperf traffic by setting the rule of iptables with "iptables -t nat -A PREROUTING -p udp -d server_IP -j DNAT --to AP_IP".
This works fine.

However, here is my problem.
I added one sniffer which has a wireless interface with monitor mode.



client ---------(wireless)--------- AP -------(Ethernet)--------- server
|
|
(wireless)
|
|
sniffer



If Iperf on client send udp traffic to the server, I can see that UDP traffic is captured in the wireless interface on the sniffer (using TCPDUMP).
And I also tried same thing as what I did on the AP in the first case.
By setting the iptables rule with "iptables -t nat -A PREROUTING -p udp -d server_IP -j DNAT --to SNIFFER_IP", I ran iperf on the sniffer, the Iperf on sniffer couldn't receive any packets.
Do I need to do extra work for iptables or something else?

Thanks,
JK
 
Old 02-15-2011, 08:09 PM   #8
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Monitor mode maybe?
 
Old 02-15-2011, 08:32 PM   #9
jkmin96
LQ Newbie
 
Registered: Feb 2011
Posts: 7

Original Poster
Rep: Reputation: 0
I set the wireless interface of the sniffer with monitor mode. And I checked packets are captured.
Is there any flag or bit setting that let other protocol layers know that this packet was not originally for this node so that the packets are dropped before iptables rule is applied?


Thanks,
JK
 
Old 02-15-2011, 08:39 PM   #10
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
Quote:
Originally Posted by jkmin96 View Post
I set the wireless interface of the sniffer with monitor mode. And I checked packets are captured.
Is there any flag or bit setting that let other protocol layers know that this packet was not originally for this node so that the packets are dropped before iptables rule is applied?


Thanks,
JK
As far as what? Being in monitor mode, you can sniff the packets for security testing using a program like wireshark, etc.
 
Old 02-15-2011, 08:54 PM   #11
jkmin96
LQ Newbie
 
Registered: Feb 2011
Posts: 7

Original Poster
Rep: Reputation: 0
Unhappy

Quote:
Originally Posted by corp769 View Post
As far as what? Being in monitor mode, you can sniff the packets for security testing using a program like wireshark, etc.
I don't know.. you are right..
Because I have not found any clue for this problem, I'm just trying to think of anything
 
Old 02-15-2011, 10:07 PM   #12
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
This thread is in violation of LQ Rules (#13). It is closed as a result.
 
  


Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to see network packets sent/recieved anti.corp Debian 5 01-18-2006 07:56 AM
Kernel 2.6.11.12 fixes Network Bridge Incorrectly Forwarded Packets unSpawn Linux - Security 0 11-23-2005 07:25 AM
Linux not accepting port forwarded packets? p_motch Linux - Networking 10 07-18-2004 09:54 AM
Can the X server be sniffed? Howie000 Linux - Security 8 03-24-2004 12:49 AM
Avoid being sniffed farpa Linux - Security 4 01-16-2004 01:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration