Skip to contentSkip to conversation

linux bridging problem: how to emulate 2 separate

LARTC Robb Bossley 1 participant 1 message Jul 2, 2005

lore
Share & tools
lore
#0 lore raw

Sorry Alexey, I meant to send that to the list, not just you.

---------- Forwarded message ----------
From: Robb Bossley <[email protected]>
Date: Jul 1, 2005 11:15 PM
Subject: Re: [LARTC] linux bridging problem: how to emulate 2 separate interfaces on a single one?
To: Alexey Toptygin <[email protected]>

Yes, it can be done. I know because I've done it before. (The only issue is what you want to do with it.) First, if you are using DHCP to set up the interface ip, eth0 will take the first address assigned by DHCP. Then you need to create the bridge after bringing eth0 up with no ip. Then add eth0 to the bridge. Then you can create and add the tun devices that the taps will come from. When you add the taps, you must specify different MAC addresses, or I believe they may default to the same one - perhaps even the same as the MAC on your NIC.

When I did this, I had problems because although I had three different MAC addresses, the address for eth0 was still in force (even though I had freed the address, the DHCP server had a very long time before it would reset the ip). This was a problem because my ISP only would give me a maximum of three ip's at once. (I needed all three for my little experiment to work)

Why do this? Because I can! That's the beauty of Linux - freedom to do whatever you want, even if it doesn't make sense.

If you would like, I can attach a little script that I wrote that sets up the bridge.

Robb

Quoted 42 lines · Alexey Toptygin
Quoted 24 lines · Stephen Hemminger
Quoted 24 lines

LAN______________________________________________

                         |
                         | eth0 (no IP)
    _____________________|________________________
   |                     |          Linux Box (PC)|
   |             ________|________                |
   |            |                 |               |
   |            |       br0       |               |
   |            |     (no IP)     |               |
   |            |_________________|               |
   |           tap0  |        | tap1              |
   | 192.168.40.1/24 |        | 192.168.30.1/24   |
   |           MAC_0 |        | MAC_1             |
   |              ___|________|____               |
   |             |                 |              |
   |             | OS TCP-IP stack |              |
   |             |                 |              |
   |             |_________________|              |
   |                 | | | |                      |
   |                 | | | |                      |
   |                Processes                     |
   |                                              |
   |                                              |
   |______________________________________________|

[snip]

Quoted 3 lines

It should work if the tap interface looks sufficiently like Ethernet. You probably need filter rules to make sure and drop packets intended for the other network get dropped and to prevent broadcast leakage.

The way I interpret the drawing, ISTM that Antonio has the bridge a layer below the tap devices (even though it's drawn a layer above). I don't think that's a very sane idea...

The crux of the problem seems to be that Antonio wants a single physical ethernet card to use two different MAC adresses, which I don't think briding is ever going to solve. This is, perhaps, possible by putting the card into promiscuous mode, and using some clever ebtables mangling.

Quoted 6 lines

Alexey
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc

--
As if you could kill time without injuring eternity. The mass of men live lives of quiet desperation.
- Henry David Thoreau

Signature · 7 lines
As if you could kill time without injuring eternity.  The mass of men
live lives of quiet desperation.
- Henry David Thoreau
_______________________________________________
LARTC mailing list
[email protected]
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc