From owner-freebsd-hackers Sun Mar 29 22:10:26 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id WAA19997 for freebsd-hackers-outgoing; Sun, 29 Mar 1998 22:10:26 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from gaia.coppe.ufrj.br (cisigw.coppe.ufrj.br [146.164.5.200]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id WAA19962 for ; Sun, 29 Mar 1998 22:10:16 -0800 (PST) (envelope-from jonny@coppe.ufrj.br) Received: (from jonny@localhost) by gaia.coppe.ufrj.br (8.8.8/8.8.8) id DAA12803; Mon, 30 Mar 1998 03:10:13 -0300 (EST) (envelope-from jonny) From: Joao Carlos Mendes Luis Message-Id: <199803300610.DAA12803@gaia.coppe.ufrj.br> Subject: IP Routing To: hackers@FreeBSD.ORG Date: Mon, 30 Mar 1998 03:10:13 -0300 (EST) X-Mailer: ELM [version 2.4ME+ PL32 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hi, Suppose I have a physical ethernet network with two (or more) logical IP networks above it. Suppose also I have the following machines attached to this physical network: Machine A: ifconfig fxp0 inet 10.0.0.1 netmask 255.255.255.0 up route add -net 10.0.1.0 -netmask 255.255.255.0 -interface fxp0 Machine B: ifconfig fxp0 inet 10.0.1.1 netmask 255.255.255.0 up route add -net 10.0.0.0 -netmask 255.255.255.0 -interface fxp0 Now, machine A can see machine B, over the same cable, with 1 hop distance; and vice-versa. Here's a tcpdump output from a test I've done here (real addresses changed for security reasons): arp who-has 10.0.0.1 tell 10.0.1.1 arp reply 10.0.0.1 is-at 0:a0:c9:5a:6d:45 10.0.1.1 > 10.0.0.1: icmp: echo request 10.0.0.1 > 10.0.1.1 icmp: echo reply 10.0.1.1 > 10.0.0.1: icmp: echo request 10.0.0.1 > 10.0.1.1 icmp: echo reply 10.0.1.1 > 10.0.0.1: icmp: echo request 10.0.0.1 > 10.0.1.1 icmp: echo reply 10.0.1.1 > 10.0.0.1: icmp: echo request 10.0.0.1 > 10.0.1.1 icmp: echo reply Now, why can't I do this on machine A ? route add default 10.0.1.1 I've taken a quick look at /sys/net/route.c and it seems to me that this case is not allowed. The gateway addr must be the other end a point2point interface or an address valid on a local interface address/netmask list. If I add an alias to machine B, like this: ifconfig fxp0 net 10.0.0.2 netmask 255.255.255.0 alias And change the route command on machine A to: route add default 10.0.0.2 Then it works. All this discussion come from a thread on the Brasilian FreeBSD list, on which a user wanted to do something similar to the above and said that it works on Linux, but cannot do the same on his FreeBSD box. I don't care if what he wants to do is the best thing or not (personally, I would never do such a think this way), but I can't see why it's wrong. The gateway is known, and is local to the interface. It's just not on the same subnet. Jonny -- Joao Carlos Mendes Luis jonny@gta.ufrj.br +55 21 290-4698 jonny@coppe.ufrj.br Universidade Federal do Rio de Janeiro UFRJ/COPPE/CISI PGP fingerprint: 29 C0 50 B9 B6 3E 58 F2 83 5F E3 26 BF 0F EA 67 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message