From owner-freebsd-questions Fri Oct 9 11:27:31 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id LAA20396 for freebsd-questions-outgoing; Fri, 9 Oct 1998 11:27:31 -0700 (PDT) (envelope-from owner-freebsd-questions@FreeBSD.ORG) Received: from nag.cs.ucdavis.edu (nag.cs.ucdavis.edu [128.120.56.6]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id LAA20390 for ; Fri, 9 Oct 1998 11:27:29 -0700 (PDT) (envelope-from wee@cs.ucdavis.edu) Received: from cs.ucdavis.edu (lhotse.cs.ucdavis.edu [128.120.56.217]) by nag.cs.ucdavis.edu (8.8.8/8.7.2 Mainx) with ESMTP id LAA13731 for ; Fri, 9 Oct 1998 11:15:41 -0700 (PDT) Message-ID: <361E566E.D8DAE990@cs.ucdavis.edu> Date: Fri, 09 Oct 1998 11:31:10 -0700 From: Chris Wee X-Mailer: Mozilla 4.05 [en] (X11; I; FreeBSD 2.2.7-STABLE i386) MIME-Version: 1.0 To: freebsd-questions@FreeBSD.ORG Subject: Want to route according to dest addr AND interface traversed Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi all, I'm trying to simulate a network of routers and hosts within a single BSD host. The idea is to use IP aliasing, a bunch of loopback devices (lo1, lo2,...) and routes to emulate a small network using the stand BSD TCP/IP stack. I'm also planning to use Luigi Rizzo's dummynet code to simulate varying link conditions. So here is a brief example [hostC]---pipe4-----+ | .9 [hostA]--pipe1---[routerA]---pipe2---[routerB]---pipe3---[hostB] 10.1.4 ifconfig lo0 10.1.1.1 alias # host A ifconfig lo0 10.1.2.1 alias # host B ifconfig lo0 10.1.3.1 alias # host C ifconfig lo1 10.1.1.9 # interfaces on routers ifconfig lo2 10.1.4.9 ifconfig lo3 10.1.3.9 ifconfig lo4 10.1.2.9 ipfw pipe 1 config delay 10ms # luigi's dummynet stuff ipfw pipe 2 config delay 10ms ipfw pipe 3 config delay 10ms ipfw pipe 4 config delay 10ms ipfw add pipe 1 ip any to any from any via lo1 ipfw add pipe 2 ip any to any from any via lo2 ipfw add pipe 3 ip any to any from any via lo3 ipfw add pipe 4 ip any to any from any via lo4 now I would like to configure routing as follows: route pkts destined for 10.1.3 to lo3 if they passed through lo1 (10.1.1) or lo2 (10.1.4) but route pkts destined for 10.1.3 to lo2 if passing through lo4 (10.1.2) to route packets the first way, I use the command # route add -net 10.1.3 10.1.3.9 -interface but how do I specify ONLY if the pkt is traversing lo1 or lo2? The man page of route mentions -ifa and -ifp I've scanned through the kernel source code and found the route table entry in /sys/net/route.h /* * A route consists of a destination address and a reference * to a routing entry. These are often held by protocols * in their control blocks, e.g. inpcb. */ struct route { struct rtentry *ro_rt; struct sockaddr ro_dst; }; FINALLY here is my question, -- -chris To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message