LinuxQuestions.org
Review your favorite Linux distribution.
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


Reply
  Search this Thread
Old 09-03-2004, 06:22 AM   #1
mancini
LQ Newbie
 
Registered: Sep 2004
Distribution: Slackware
Posts: 16

Rep: Reputation: 0
Arrow fowarding promisc trafic from eth0 to eth1


does anyone have experience with forwarding data from a network segment to another network segment even if the data is not adressed to it ?

namely i have my LAN gateway able to see all the trafic on the MAN/WAN , but i want it to forward that trafic into my LAN so all the stations can see it too

more explicitly , my gateway has masquerading enabled and i am trying to use iptables to achieve my goal but even after trying out quite a number of rules i still can not make it work

Last edited by mancini; 09-03-2004 at 12:20 PM.
 
Old 09-03-2004, 06:31 AM   #2
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
example:

-i : incoming interface
-p : protocol (tcp/udp)
--dport : destination port
--to 192.168.0.10 : forward to 192.168.0.10

iptables -t nat -I PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to 192.168.0.10

it says that if packets come to eth0 and if its protcol is tcp and if destination port is 80, forward it to 192.168.0.10 to port 80
 
Old 09-03-2004, 07:57 AM   #3
mancini
LQ Newbie
 
Registered: Sep 2004
Distribution: Slackware
Posts: 16

Original Poster
Rep: Reputation: 0
ok , great info , i'm playing with it

for now i used

Quote:
iptables -t nat -I PREROUTING -i eth0 -j DNAT --to 192.168.8.1
where :
192.168.8.1 is the ip of eth1 on the gateway box
eth1 is connected to the switch of the lan
eth0 is connected to the WAN

i can see on the gateway that packets are being processed by that rule however i still can not see wan trafic on the lan
 
Old 09-03-2004, 08:09 AM   #4
mancini
LQ Newbie
 
Registered: Sep 2004
Distribution: Slackware
Posts: 16

Original Poster
Rep: Reputation: 0
i have tried using also the ip of a station in my lan instead of the ip of eth1 of the gateway

still nothing

might it be because i am aiming to capture packets that are not destinated to the ip of the gateway , but instead all packets captured by eth0 in proisc mode
 
Old 09-03-2004, 08:34 AM   #5
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
i didnt try to route all of traffic trou linux. im not sure
"iptables -t nat -I PREROUTING -i eth0 -j DNAT --to 192.168.8.1" rule is a good idea.
if i were u, i would just forward specific ports to local computer, not all of packets.

i am asking to make sure:
ip_forward is 1, right ?
and do u have some iptables rules which can block forwarding (check the forward chain)?
u can see rules by typing
#iptables -nvL
#iptables -nvL -t nat
 
Old 09-03-2004, 08:46 AM   #6
mancini
LQ Newbie
 
Registered: Sep 2004
Distribution: Slackware
Posts: 16

Original Poster
Rep: Reputation: 0
yes i nat is working on my gateway , i am using a clinet on my lan that is forwarded thru it to post this

as for seeing the filter and nat status yes i know , when i said "packets are being processed by that rule" i meant that iptables -nvL -t nat shows a growing number of packets matched for that rule

as for #cat /proc/sys/net/ipv4/ip_forward it is 1 yes

i also have tcp_syncookies and icmp_echo_ignore_broadcasts but i dont think those should cause problems

all the default filters are set to ALLOW too

as for the promiscous issue im quite sure that as long as eth0 in in promisc mode all the packets it sees , even if no destinated to it will be forwarded


now i also tried
Quote:
iptables -t nat -I PREROUTING -i eth0 -j DNAT --to 192.168.8.255
and
Quote:
iptables -t nat -I PREROUTING -i eth0 -j DNAT --to 192.168.8.0
192.168.8.255 being the brodcast address for eth1
but still no cigar

Last edited by mancini; 09-03-2004 at 10:19 AM.
 
Old 09-03-2004, 09:13 AM   #7
maxut
Senior Member
 
Registered: May 2003
Location: istanbul
Distribution: debian - redhat - others
Posts: 1,188

Rep: Reputation: 50
Quote:
Originally posted by mancini

i also have tcp_syncookies and icmp_echo_ignore_broadcasts but i dont think those should cause problems
i think so.
 
Old 09-03-2004, 12:19 PM   #8
mancini
LQ Newbie
 
Registered: Sep 2004
Distribution: Slackware
Posts: 16

Original Poster
Rep: Reputation: 0
turns out that

Quote:
iptables -t nat -A PREROUTING -i eth0 -j DNAT --to 192.168.8.2-192.168.8.5
works (192.168.8.2-192.168.8.5 being the hosts wich i want to see the trafic)

this fixed my dcgui problem nicely with the trafic now being forwarded from my gateway to my expecting dcgui clients

however what this does is forward only the traffic to the MAC of eth0 , not all the trafic captured by eth0 in promisc mode

i submitted this at https://bugzilla.netfilter.org/bugzi...bug.cgi?id=238

Last edited by mancini; 09-03-2004 at 01:34 PM.
 
  


Reply



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
X!! Fowarding using commandline cvcrud Red Hat 3 06-26-2005 04:22 PM
Port Fowarding zaicheke *BSD 9 10-25-2004 06:05 PM
Fowarding Ports BugBear Linux - Networking 2 05-22-2004 01:18 AM
Fowarding port 80 ? Drogo Linux - Networking 13 05-28-2003 03:16 AM
Port Fowarding. Arisen Sun Linux - Security 1 05-23-2003 06:48 PM

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

All times are GMT -5. The time now is 06:34 AM.

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