Date: Mon, 30 Mar 1998 03:10:13 -0300 (EST) From: Joao Carlos Mendes Luis <jonny@coppe.ufrj.br> To: hackers@FreeBSD.ORG Subject: IP Routing Message-ID: <199803300610.DAA12803@gaia.coppe.ufrj.br>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199803300610.DAA12803>