From owner-freebsd-net@freebsd.org Sat Feb 6 16:10:34 2021 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5654552D661 for ; Sat, 6 Feb 2021 16:10:34 +0000 (UTC) (envelope-from peter.garshtja@ambient-md.com) Received: from mail-qk1-x731.google.com (mail-qk1-x731.google.com [IPv6:2607:f8b0:4864:20::731]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DXy1j2krvz4mhm for ; Sat, 6 Feb 2021 16:10:33 +0000 (UTC) (envelope-from peter.garshtja@ambient-md.com) Received: by mail-qk1-x731.google.com with SMTP id a19so10167258qka.2 for ; Sat, 06 Feb 2021 08:10:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ambient-md-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=U2Kd6imONJk/wVJZIdr+g85Qk7scmlHD1lAc4xzTWqA=; b=zEWj2Q9fbxmAlvkAEWK6iaEELKZENS+RzCxzI8saYAiD0iIuxdSgkajPwbscvCB9Pg Ag7Wm9wuC1Jbwr3AkpOBdD1qlbmNocMn2A3705oeL33fptEFrWjEIPvezLQyLfOPAdbI NJCRka6Iwz1Vh/BamjfJOeY8KEiLHw4zeKSBV7ruzzcRUWvAeU2nj/51DKEc9s2TNze7 WX4OtY7ESPNNLyk6pGpD2BL4hi81GWI2vRY850TLmuoUzFFpCgEOPU+cotE+8jUhvZ5D nlQFPjmHv0foE6fx5no7XL8V390t5V3Caa8m64evLwL1Xpb0VYeWi/Hm/RHw2AATL+aM DPIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=U2Kd6imONJk/wVJZIdr+g85Qk7scmlHD1lAc4xzTWqA=; b=NQWwx4GY7rSJGjh9zL2os7z29dKi1uIRt3arfrK3mNVkdkjrHKzmYiOrAT6W659v49 svRn/d4TIbxMaMmpSDN5Dl7DodBWlw7m4Rrzs50nicRhfvHXSwbLXZRNtlcS8Kcljg4b bLPzoKOgu7ELSnz1hWUY8n+Pt4alHZdfSGQ58q6IJyOQ7ND/w4S/rAxO68o6P06Aw6Um ZjQ3Uc/7jwD+EtJVIyeIkF/0Vs/E7bGPATox18Io7P6N6JbuwnqTglNy33KeY+jZsslA c8cys5xsuVmASm9uc+AcDX+vvSPxv1kRSgNivPxkYnPDVyvN+ItaYBks7hQeZaLSRSt/ +jdQ== X-Gm-Message-State: AOAM530SXwDP4UjJZsM8yXngt8Xe4lVVUAVNpBCk1bq3Qc8r11tE2uvb bDo8ldUltzy/qE4E4Hem5BRtu8Tde/PhPgWb X-Google-Smtp-Source: ABdhPJwRSlkOjrXwvulsll8Cppc4AHxYobNNKpJOSgBhwIggKTNtJu4u7Dgv5Z4MCUF0LWBKw3zjEQ== X-Received: by 2002:a05:620a:113a:: with SMTP id p26mr9173588qkk.154.1612627831812; Sat, 06 Feb 2021 08:10:31 -0800 (PST) Received: from ?IPv6:2001:470:1c:38d::4? ([2001:470:1c:38d::4]) by smtp.gmail.com with ESMTPSA id r18sm11344763qtp.41.2021.02.06.08.10.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 06 Feb 2021 08:10:31 -0800 (PST) Subject: Re: netgraph with ng_netflow and ng_gridge nodes To: Lutz Donnerhacke Cc: freebsd-net@freebsd.org References: <43cf5dc9-521c-dcc4-f025-398173608062@ambient-md.com> <20210202201649.GA31653@belenus.iks-jena.de> <20210202202651.GA31946@belenus.iks-jena.de> From: petru garstea Message-ID: Date: Sat, 6 Feb 2021 11:10:29 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210202202651.GA31946@belenus.iks-jena.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Rspamd-Queue-Id: 4DXy1j2krvz4mhm X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ambient-md-com.20150623.gappssmtp.com header.s=20150623 header.b=zEWj2Q9f; dmarc=none; spf=none (mx1.freebsd.org: domain of peter.garshtja@ambient-md.com has no SPF policy when checking 2607:f8b0:4864:20::731) smtp.mailfrom=peter.garshtja@ambient-md.com X-Spamd-Result: default: False [-3.30 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[ambient-md-com.20150623.gappssmtp.com:s=20150623]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-net@freebsd.org]; DMARC_NA(0.00)[ambient-md.com]; SPAMHAUS_ZRD(0.00)[2607:f8b0:4864:20::731:from:127.0.2.255]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[ambient-md-com.20150623.gappssmtp.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::731:from]; NEURAL_HAM_SHORT(-1.00)[-1.000]; R_SPF_NA(0.00)[no SPF record]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RBL_DBL_DONT_QUERY_IPS(0.00)[2607:f8b0:4864:20::731:from]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-net] X-Mailman-Approved-At: Sat, 06 Feb 2021 18:08:43 +0000 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Feb 2021 16:10:34 -0000 Greetings, I have come up with a graph with no use of ng_tee, ng_hub or ng_one2many. Also I validated the flows on a collector In case anybody has the same use case I am sharing the graph mkpeer re0: netflow lower iface0 name re0:lower netflow connect re0: netflow: upper out1 mkpeer netflow: bridge out0 link0 name netflow:out0 re0bridge connect re0bridge: netflow: link1 iface1 mkpeer re0bridge: eiface link2 ether name re0bridge:link2 ng0 mkpeer netflow: ksocket export9 inet/dgram/udp msg re0: setpromisc 1 msg re0: setautosrc 0 msg netflow: setconfig {iface=0 conf=11} msg netflow: setconfig {iface=1 conf=11} msg netflow:export9 connect inet/${collector_ip}:${port} Cheers, Petru Garstea On 2/2/21 3:26 PM, Lutz Donnerhacke wrote: > On Tue, Feb 02, 2021 at 09:16:49PM +0100, Lutz Donnerhacke wrote: >> fxp0.lower -- iface0.netgraph.out0 -- link1.bridge.link2 -- upper.fxp0 >> \.link3 -- ether.eiface > The strange thing is, that both fxp0 and eiface provide an interface to the > kernel IP stack. This is confusing (for the kernel). > > I'd like to point you to ng_tee instead of ng_bridge for a read only access > to the communitcation (depending on the direction). Even ng_one2many or > ng_hub might be a better solution. > > If you only need the eiface to attach tcpdump, you can omit it completely, > because tcpdump is able to sniff on the fxp0 even if the netgraph hooks are > set.