From owner-freebsd-net Mon May 28 4:28:57 2001 Delivered-To: freebsd-net@freebsd.org Received: from shadow.otel.net (JuDiCaToR.OTEL.net [212.36.9.113]) by hub.freebsd.org (Postfix) with ESMTP id BA39437B42C for ; Mon, 28 May 2001 04:28:53 -0700 (PDT) (envelope-from tbyte@tbyte.org) Received: from localhost (localhost [127.0.0.1]) by shadow.otel.net (8.11.3/8.11.1) with ESMTP id f4SBSp021340 for ; Mon, 28 May 2001 14:28:52 +0300 (EEST) (envelope-from tbyte@tbyte.org) Date: Mon, 28 May 2001 14:28:51 +0300 (EEST) From: Iasen Kostoff X-Sender: tbyte@shadow.otel.net To: freebsd-net@freebsd.org Subject: routing socket and routes assignment Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hi, I have a problem in assigning a default gateway from network that my computer's interfaces don't have IP from. And even when I add a route to this network throw any of the interfaces it still returns ENETUNREACH message. Then I thought that I can fix that with -ifp modifer of route command but - no luck. After many tryes I found a way to set this route but I don't think it's the right way it should be done. Ok, now you have an interface with IP 2.2.2.2 but your gateway is 1.1.1.1 . First you should add a default route from your interface's network or even his own IP 2.2.2.2 , then you should change this route gateway to point to real gateway 1.1.1.1 and you should have a route to this host or his network 1.1.1.1/??. Here is same but displayed with route command: 1. route add default 2.2.2.2 2. route add 1.1.1.1 -iface xl0 arp -s 1.1.1.1 lladdr_of_1.1.1.1 or route add -net 1.1.1.1/24 -iface xl0 3. route change default 1.1.1.1 4. optionaly : route change default -ifp xl0 That did it but why can't I do it with this command: route add default 1.1.1.1 -ifp xl0 I look in sys/net/rtsock.c and sys/net/route.c and saw that rtrequest() can't add a route to host throw interface but route_output() function in rtsock.c could change it that way ?!? I've changed these tow functions and now "route add default host -ifp ifname" works but you still need a route to the gateway. I think that if there is set ifp or ifa (end this is set if there is a route at all :)) the kernel should try to arpresolve gateway's lladdr throw that interface if it can't find a route to it. Regards. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message