Date: Fri, 09 Oct 1998 11:31:10 -0700 From: Chris Wee <wee@cs.ucdavis.edu> To: freebsd-questions@FreeBSD.ORG Subject: Want to route according to dest addr AND interface traversed Message-ID: <361E566E.D8DAE990@cs.ucdavis.edu>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?361E566E.D8DAE990>