Hi, What is the easiest way to bridge between two user-space processes that talk directly to Ethernet interfaces? I have two applications that write/read Ethernet frames to/from Linux Ethernet ports (e.g. eth0). The applications can successfully talk to each other when they run on two machines connected over Ethernet. I would like to be able to test them on a single machine without employing the physical network. Would TAP + bridging do the job? If so, what am I doing wrong? Linux 2.4.20, root user. I set up tap interfaces like this:>tunctl tap4 >ifconfig tap4 4.4.4.4 promisc up >tunctl tap5 >ifconfig tap5 5.5.5.5 promisc upI then set up the bridge and add the tap interfaces to it:>brctl addbr tapbr >brctl setfd tapbr 0 >brctl sethello tapbr 0 >brctl stp tapbr off >ifconfig tapbr 7.7.7.7 netmask 255.255.255.0 up >brctl addif tapbr tap4 >brctl addif tapbr tap5I then do a ping over tap4:>ping -I tap4 8.8.8.8and tcpdump on tap5:>tcpdump -i tap5and see nothing. Shouldn't I see the ping requests on tap5 now? BTW, if I enable STP on the bridge I start seeing the STP frames on tap5. Thanks! Derek __________________________________ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail
Thanks! I was afraid this was the reason ... :( I actually tried writing an application that would open /dev/tap4 as a file and do a select() on it. The select() timed out when I tried pinging over the bridge, but I guess I'll have to go back and debug it, I must have missed something. --- "Eble, Dan" <DanE@aiinet.com> wrote:> The bridge is designed to do the opposite of what > you are trying to do. It > takes incoming frames and copies them out other > interfaces. You want to > take outgoing frames and copy them into other > interfaces. > > I have not played with tun/tap myself, but the > kernel documentation in > Documentation/networking/tuntap.txt seems to > indicate that you need a > program to listen on two opened /dev/net/tun devices > and copy the frames > from one to the other. > > > -----Original Message----- > > From: Derek Smalls [mailto:dsmalls321@yahoo.com] > > Sent: Wednesday, June 16, 2004 12:04 AM > > To: bridge@lists.osdl.org > > Subject: [Bridge] Bridging between user processes > > > > > > Hi, > > > > What is the easiest way to bridge between two > > user-space processes that talk directly to > Ethernet > > interfaces? > > > > I have two applications that write/read Ethernet > > frames to/from Linux Ethernet ports (e.g. eth0). > The > > applications can successfully talk to each other > when > > they run on two machines connected over Ethernet. > I > > would like to be able to test them on a single > machine > > without employing the physical network. Would TAP > + > > bridging do the job? > > > > If so, what am I doing wrong? Linux 2.4.20, root > > user. I set up tap interfaces like this: > > > > >tunctl tap4 > > >ifconfig tap4 4.4.4.4 promisc up > > >tunctl tap5 > > >ifconfig tap5 5.5.5.5 promisc up > > > > I then set up the bridge and add the tap > interfaces to > > it: > > > > >brctl addbr tapbr > > >brctl setfd tapbr 0 > > >brctl sethello tapbr 0 > > >brctl stp tapbr off > > >ifconfig tapbr 7.7.7.7 netmask 255.255.255.0 up > > >brctl addif tapbr tap4 > > >brctl addif tapbr tap5 > > > > I then do a ping over tap4: > > >ping -I tap4 8.8.8.8 > > > > and tcpdump on tap5: > > >tcpdump -i tap5 > > > > and see nothing. Shouldn't I see the ping requests > on > > tap5 now? > > > > BTW, if I enable STP on the bridge I start seeing > the > > STP frames on tap5. > > > > Thanks! > > > > Derek > > > > > > > > > > > > __________________________________ > > Do you Yahoo!? > > New and Improved Yahoo! Mail - Send 10MB messages! > > http://promotions.yahoo.com/new_mail > > >==== __________________________________ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail
Thanks for the response! Running the application produces the same result (no result actually) as ping -I. Looks like tcpdump can see the tap interfaces: tcpdump on tap4 can see outgoing pings sent out on tap4. Moreover, I can send pings through the bridge and tcpdump on tap4 picks them up. I guess in order to bridge between taps I really do need a separate utility that would copy frames between /dev/tap4 and /dev/tap5 . --- "John W. Linville" <linville@tuxdriver.com> wrote:> Derek Smalls wrote: > > > I then do a ping over tap4: > > > >>ping -I tap4 8.8.8.8 > > > and tcpdump on tap5: > > > >>tcpdump -i tap5 > > > and see nothing. Shouldn't I see the ping requests > on > > tap5 now? > > My guess is that your `ping -I` is completely > bypassing the bridging > code. I haven't looked at it lately, but I'd guess > that the bridging > functionality is geared toward receiving frames on > the "slave" interface > and transmitting frames through the "master" > interface. You example is > transmitting on the "slave" interface (to use my > terminology). > > A better test would be to setup your bridge, then > start the application > you mentioned on the transmitting side and monitor > the other side for > traffic (probably with another instance of your > application). > > BTW, I don't think tcpdump will be useful. You'll > need something that > is "tap-aware". > > Good luck! > > John >__________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo