From owner-freebsd-net@FreeBSD.ORG Mon Jan 19 01:34:48 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id DDB0816A4CE for ; Mon, 19 Jan 2004 01:34:48 -0800 (PST) Received: from ns2.alphaque.com (ns2.alphaque.com [202.75.47.153]) by mx1.FreeBSD.org (Postfix) with SMTP id 1D57543D1D for ; Mon, 19 Jan 2004 01:34:45 -0800 (PST) (envelope-from dinesh@alphaque.com) Received: (qmail 78936 invoked by uid 0); 19 Jan 2004 09:34:40 -0000 Received: from lucifer.net-gw.com (HELO prophet.alphaque.com) (202.75.47.153) by lucifer.net-gw.com with SMTP; 19 Jan 2004 09:34:40 -0000 Received: from localhost (localhost.alphaque.com [127.0.0.1]) by prophet.alphaque.com (8.12.10/8.12.9) with ESMTP id i0J9YPx3001411 for ; Mon, 19 Jan 2004 17:34:25 +0800 (MYT) (envelope-from dinesh@alphaque.com) Date: Mon, 19 Jan 2004 17:34:25 +0800 (MYT) From: Dinesh Nair To: freebsd-net@freebsd.org Message-ID: <20040119171546.T312-100000@prophet.alphaque.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: netgraph questions on ng_tee, ng_iface, ng_socket X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Jan 2004 09:34:49 -0000 hey all, am beginning to learn on how to manipulate netgraph nodes. i've read archie cobbs' paper at http://www.daemonnews.org/200003/netgraph.html and it provided a good backgrounder on using netgraph. i'm now playing around with ng_socket, ng_tee, ng_one2many and ng_iface to accomplish round robin routing for a freebsd box with two interfaces going to two ISPs. what i intent to achieve in principle is to have packets going out alternately over each of the two interfaces with source ip address set to the appropriate interface so the reply packets come back in properly. i looked at the examples which archie gave in the daemonnews paper, and am a little stumped at the behaviour of the whole thing. this could be due to my lack of understanding of the whole thing. what i want do is similar to this: i presently have two NICs on the box, fxp0 (192.168.0.5) and aue0 (10.1.1.25). both fxp0 and aue0 go out to different ISPs. currently, default route is thru ISP1 on fxp0, i.e. defroute to 192.168.0.1. what i want to do is to round robin outgoing packets across both ISP links, i.e. one packet out on fxp0 then the next out on aue0 and then the next out on fxp0 ad nauseaum. of course, packets going out on fxp0 will have a src address of 192.168.0.5 and packets going out on aue0 will have a src address of 10.1.1.25. create a new interface (presumably using ng_iface). give this iface an ip address, set the default route thru this iface (ng0). then, using ng_one2many, chain ng0 to both fxp0 and aue0. an example to do this for ethernet frames is given in the ng_one2many(4) man page, however i want to do it for IP packets with the underlying src address being changed where appropriate. i need some understanding on what exactly ng_iface achieves, as it makes a reference to the hook inet being connected to something. however, connecting the ng_iface hook inet to ng_ether's upper or lower doesnt make any sense because ng_ether itself does not do an encasulation of the IP packet into an ethernet frame. or am i wrong here, and just configuring it wrongly ? any pointers/explanations would sure help a lot. thanx in advance. Regards, /\_/\ "All dogs go to heaven." dinesh@alphaque.com (0 0) http://www.alphaque.com/ +==========================----oOO--(_)--OOo----==========================+ | for a in past present future; do | | for b in clients employers associates relatives neighbours pets; do | | echo "The opinions here in no way reflect the opinions of my $a $b." | | done; done | +=========================================================================+