LinuxQuestions.org
Help answer threads with 0 replies.
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 08-31-2012, 09:42 AM   #1
crust
LQ Newbie
 
Registered: Sep 2010
Posts: 6

Rep: Reputation: 0
Trouble with physdev module and bridging finding wrong ethX


(Note that this is an embedded system with cards, hence the odd setup ... it isn't PC network).

I've got a system that uses a bridge (br0) to connect 3 ethernet ports (eth1-eth3). Within that, I use some iptables rules to forward the DHCP ports to another port based on the physdev. Namely eth1->5167, eth2->5267, eth3->5367.

Then within each DHCP server, I have a distinct IP range. So based on the IP, I can determine to which ethernet port they are attached. 90% of the time this works just fine. However, on some occasions a request will come in on eth3 but the iptables rule for eth1 will match and therefore the device ends up with an IP in the wrong range.

Since this only seems to happen right when it starts up, I am wondering if it is because the bridge hasn't yet matched MACs to eth devices. I have no idea if that is how it works, just a question.

My iptables rule for the dhcp forward is as shown here.

Code:
iptables -I PREROUTING -t nat -i br0 -m physdev --physdev-in eth1 -p udp --dport 67 -j DNAT --to 0.0.0.0:5167
I noticed that without the "-i br0" this rule does not work at all. Secondly, when I attach something to eth3 and the eth1 rule is (incorrectly) matched, the count goes up for the eth1 rule, and the eth3 rule stays at 0.

My bridge setup ....

ifconfig eth1 up 0.0.0.0
ifconfig eth2 up 0.0.0.0
ifconfig eth3 up 0.0.0.0
brctl addbr br0
brctl addif br0 eth1
brctl addif br0 eth2
brctl addif br0 eth3
brctl stp br0 on
brctl setfd br0 20
# assign the bridge to the eth1 address
ifconfig br0 hw ether `cat /sys/class/net/eth1/address`
ifconfig br0 10.0.0.1 up


Thanks

Last edited by crust; 08-31-2012 at 09:43 AM.
 
Old 09-04-2012, 05:02 PM   #2
crust
LQ Newbie
 
Registered: Sep 2010
Posts: 6

Original Poster
Rep: Reputation: 0
In case anyone runs across this again, I never did solve it. I instead canned the bridge and made a router with 3 distinct ethX ports and 3 DHCP servers, 1 per port.
 
  


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
IPTables physdev and bond0 interface ACiD GRiM Linux - Networking 0 07-18-2010 03:29 AM
HowTo Run a script on ifup ethX and a different one for ifdown ethX dscholl Red Hat 3 07-07-2009 01:09 PM
Trouble bridging wireless and ethernet segments shuffles Linux - Networking 11 07-16-2008 12:54 PM
VMWare's bridging vs Window's bridging - routing is messed up when Windows bridging brenan99 General 0 05-04-2008 10:24 PM
finding out which ethX is using which module Menestrel Linux - Newbie 7 01-10-2005 11:32 PM

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

All times are GMT -5. The time now is 11:34 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