From owner-freebsd-questions@FreeBSD.ORG Thu Sep 20 22:20:10 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A80C16A420 for ; Thu, 20 Sep 2007 22:20:10 +0000 (UTC) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: from be-well.ilk.org (dsl092-078-145.bos1.dsl.speakeasy.net [66.92.78.145]) by mx1.freebsd.org (Postfix) with ESMTP id C5A2813C4B6 for ; Thu, 20 Sep 2007 22:20:09 +0000 (UTC) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: from Lowell-Desk.lan (Lowell-Desk.lan [172.30.250.6]) by be-well.ilk.org (Postfix) with ESMTP id 0719828431; Thu, 20 Sep 2007 18:20:06 -0400 (EDT) Received: by Lowell-Desk.lan (Postfix, from userid 1147) id 499D61CCD9; Thu, 20 Sep 2007 18:20:06 -0400 (EDT) To: "Len Gross" References: <27cb3ada0709161413i163d942cld279e92634d06001@mail.gmail.com> From: Lowell Gilbert Date: Thu, 20 Sep 2007 18:20:06 -0400 In-Reply-To: <27cb3ada0709161413i163d942cld279e92634d06001@mail.gmail.com> (Len Gross's message of "Sun\, 16 Sep 2007 14\:13\:33 -0700") Message-ID: <448x71nfmx.fsf@Lowell-Desk.lan> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.99 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "freebsd-questions@freebsd.org" Subject: Re: Multiple NICs - custom protocol development X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: "freebsd-questions@freebsd.org" List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Sep 2007 22:20:10 -0000 "Len Gross" writes: > I have a host on my local 192.168.0 / 24 subnet that works fine in getting > to the Internet via a default route.via a wireless connection. > I want to develop some custom link protocols and I have placed two Ethernet > NICs in the box. > I want to be able to send packets from one NIC to the other and maintain the > link to the Internet. > I've tried a large number of things via rc.conf but when I ping of the cards > it is not going out the interface; it just gets looped back. (I test this > by disconnecting the "crossover cable" between the two cards.) > > My current rc.conf has the following attempt, but this fails. > > # > router_enable="Yes" > gateway_enable="Yes" > # Ethernet 1: > ifconfig_xl0="inet 192.168.1.1 netmask 255.255.255.0" > # Ethernet 2 > ifconfig_rl0="inet 192.168.2.1 netmask 255.255.255.0" > # > # Set up loop between the two ethernet cards > static_routes "xtor, rtox" > route_rtox = "-host 192.168.1.1 192.168.2.1" > route_xtor = "-host 192.168.2.1 192.168.1.1" > > Can I do what I want or must I have a second development box? What you want to do doesn't make sense; there is no reason to send packets to yourself over a wire. If your machine is sending packets to itself, the best path is over the loopback, and it doesn't make sense to send it over a different path. So you need to examine *why* you want to do that before you can figure out the best approach to your root problem. I do protocol development and testing through a number of different approaches, but for basic development there's usually no problem with letting the packets go over the loopback. For working on something like DHCP, I need separate IP stacks, because that will modify the routing tables differently on the server and the client(s). For that, I find virtual machines (qemu, most recently) to be the easiest and most flexible environment. I have also used environments based on bpf(4) interfaces when I was working with IP stacks that ran separately from the system's kernel. Good luck.