From owner-freebsd-net Mon Feb 19 3:50:13 2001 Delivered-To: freebsd-net@freebsd.org Received: from syncopation-03.iinet.net.au (syncopation-03.iinet.net.au [203.59.24.49]) by hub.freebsd.org (Postfix) with SMTP id 3F1C637B4EC for ; Mon, 19 Feb 2001 03:50:09 -0800 (PST) Received: (qmail 14642 invoked by uid 666); 19 Feb 2001 12:02:50 -0000 Received: from i074-022.nv.iinet.net.au (HELO elischer.org) (203.59.74.22) by mail.m.iinet.net.au with SMTP; 19 Feb 2001 12:02:50 -0000 Message-ID: <3A910856.CE68FEAC@elischer.org> Date: Mon, 19 Feb 2001 03:49:42 -0800 From: Julian Elischer X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 5.0-CURRENT i386) X-Accept-Language: en, hu MIME-Version: 1.0 To: Satyajeet Seth Cc: net@freebsd.org Subject: Re: Using netgraph to implement pseudo interfaces References: Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Satyajeet Seth wrote: > > Hi > > I wished to implement pseudo interfaces with the following requirements: > > 1. There is a ethernet interface fxp0 having MAC address MAC0. It also > receives packets with destination MAC address MAC1 and MAC2. > > 2. The packets with destination MAC address MAC1 are sent to a pseudo > interface 1 and packets with destination MAC address MAC2 are sent to > pseudo interface 2. > > 3. The packets addressed to MAC0 should be sent to sent to fxp0. > > I plan to design a netgraph as follows: > > iface1 > / > fxp0 <-> bpf > \ > iface2 I forgot to add in my previous response that you'd have to do this like: fxp0: <--> bpf <--> bpf <--> interface0 \ \ \ ------>interface1 \ \------------>interface2 as each bpfnode hook only selects between a "match" and "no match" hook. you could do it with one node as follows: +----------------------------+ | | +->(hook2)[ ] | fxp0:(lower)<->(hook1)[bpf](nomatch1)----+ [ ](match1)<-------->(upper)fxp0: [ ](nomatch2)<------>(hook)iface1: [ ](match2)<-------->(hook)iface2: i.e. loop the data back through the same node twice to effect two rules on the same data. > > fxp0, iface1, iface2, bpf are nodes of type ng_ether, ng_iface, ng_iface > and ng_bpf respectively. > > The packets with destination addresses MAC1 and MAC2 are sent to > interfaces iface1 and iface2 respectively by bpf. Remaining are sent to > fxp0. > > Could you suggest some pitfalls/improvements in the above scheme? > > I am using FreeBSD 4.0. > > Thanks > Satya > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-net" in the body of the message -- __--_|\ Julian Elischer / \ julian@elischer.org ( OZ ) World tour 2000-2001 ---> X_.---._/ v To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message