From owner-freebsd-net@freebsd.org Fri Apr 27 15:09:19 2018 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D399FA9CFC for ; Fri, 27 Apr 2018 15:09:19 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 369336BD17 for ; Fri, 27 Apr 2018 15:09:19 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1fC4a6-0006oL-U0; Fri, 27 Apr 2018 17:42:38 +0300 Date: Fri, 27 Apr 2018 17:42:38 +0300 From: Slawa Olhovchenkov To: Eugene Grosbein Cc: Abdullah Tariq , freebsd-net@freebsd.org Subject: Re: NETGRAPH- bridge vlans using netgraph help Message-ID: <20180427144238.GA80496@zxy.spb.ru> References: <5AE216DC.7010905@grosbein.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5AE216DC.7010905@grosbein.net> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 Apr 2018 15:09:19 -0000 On Fri, Apr 27, 2018 at 01:13:48AM +0700, Eugene Grosbein wrote: > 27.04.2018 0:58, Abdullah Tariq wrote: > > > I am trying to make 2 systems connected to freebsd box directly to be able > > to communicated with each other. Explanation diagram is attached > > > > ifconfig vlan2 create vlan 5 vlandev igb5 > > ifconfig vlan3 create vlan 5 vlandev igb6 > > ifconfig bridge10 create addm vlan2 addm vlan3 up > > > > as explained to me on freebsd forums > > > >> PC1 would send packets without any vlan tags attached (so they belong to > >> the "DEFAULT" vlan aka vlan 1). igb0 on FreeBSD would receive the packet, > >> compare the vlan tag to what it's configured to use (1 <--> 5), see they > >> are not equal, and would drop the packet. > >> Same for PC2. It would send untagged packets (aka vlan tag 1) to igb1. > >> FreeBSD would compare vlan tags, see they don't match what's set on igb1, > >> and drop the packets. > >> If you configure PC1 and PC2 to also use tagged vlan 5, then the bridge > >> configuration using tagged vlan 5 interfaces would work. > > > > > > > > Which turns me to netgraph. The documentation is very very scarce. So i > > want to know if what i am trying to achieve is possible and if anyone can > > please guide me. > > Rhanks > > If you want to bridge untagged frames between igb5 and igb6, you do not need > to dive into netgraph structures. Just create another bridgeX and add both of > igb5 and igb6 to that bridge. I am use next script for bridge vr0 and wlan0: kldload -v ng_eiface ng_ether ng_bridge ngctl mkpeer . eiface hook ether ifconfig ngeth0 ether 00:40:63:c1:87:02 ngctl mkpeer ngeth0: bridge ether link0 ngctl name ngeth0:ether br0 ngctl connect wlan0: br0: lower link1 ngctl msg wlan0: setpromisc 1 ngctl msg wlan0: setautosrc 0 ngctl connect vr0: br0: lower link2 ngctl msg vr0: setpromisc 1 ngctl msg vr0: setautosrc 0