From owner-freebsd-stable@FreeBSD.ORG Mon Jun 18 16:33:49 2012 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBB891065672 for ; Mon, 18 Jun 2012 16:33:49 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.c2i.net [212.247.154.34]) by mx1.freebsd.org (Postfix) with ESMTP id 33B4E8FC0A for ; Mon, 18 Jun 2012 16:33:49 +0000 (UTC) X-T2-Spam-Status: No, hits=-1.0 required=5.0 tests=ALL_TRUSTED Received: from [176.74.212.201] (account mc467741@c2i.net HELO laptop015.hselasky.homeunix.org) by mailfe02.swip.net (CommuniGate Pro SMTP 5.4.4) with ESMTPA id 288576468; Mon, 18 Jun 2012 17:54:39 +0200 From: Hans Petter Selasky To: H Date: Mon, 18 Jun 2012 17:54:15 +0200 User-Agent: KMail/1.13.7 (FreeBSD/9.0-STABLE; KDE/4.7.4; amd64; ; ) References: <4FDB6AA3.3040606@gmail.com> <20120617.231049.41685248.sthaug@nethelp.no> <4FDE5393.5050808@hm.net.br> In-Reply-To: <4FDE5393.5050808@hm.net.br> X-Face: 'mmZ:T{)),Oru^0c+/}w'`gU1$ubmG?lp!=R4Wy\ELYo2)@'UZ24N@d2+AyewRX}mAm; Yp |U[@, _z/([?1bCfM{_"B<.J>mICJCHAzzGHI{y7{%JVz%R~yJHIji`y>Y}k1C4TfysrsUI -%GU9V5]iUZF&nRn9mJ'?&>O MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201206181754.15680.hselasky@c2i.net> Cc: freebsd-stable@freebsd.org, sthaug@nethelp.no Subject: Re: How to bind a route to a network adapter and not IP X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Jun 2012 16:33:50 -0000 On Monday 18 June 2012 00:00:51 H wrote: > sthaug@nethelp.no wrote: > >>> I loose packets because I use a WLAN adapter. Sometimes the link is > >>> down for various reasons, and then the routes start changing for > >>> manually created routes, and I want to prevent that. > >> > >> well that is certainly not a reason for changing routes > >> > >> I have the feeling you are not explaining good enough what really is > >> going on and it may help sending your configurations and an example of > >> routes and IP addresses before and after this route change > > > > Why is this so hard to understand? "Link down" leads to "static route > > is deleted". This is standard FreeBSD behavior, and has been this way > > for as long as I can remember (btw, I believe this behavior is from > > the original BSD, not FreeBSD specific). > > > > You can show this by having a static default route pointing to an > > address on an Ethernet interface which has link. And then pulling the > > TP cable from the Ethernet interface. Observe that the default route > > is automatically removed. > > may be you have not understood your own problem yet > > because so far is nothing to be understood because none of your > statements is correct, it is also not FreeBSD's standard behavior and > never has been > > as long as there is the valid IP address on the related interface, no > static route will be deleted, you can even boot without cable and the > [default] static route is there > > so you need to explain better your problem in order to understand it > > probably you have some other stuff running, thirdparty network manager > or something, incorrect or incomplete ppoe or dhc configuration or > whatever leads to the problem > > FYI static routes usually are the manually configured routes, so what > you say is redundant and not correct, I guess you're loosing some kind > of dynamic route > > since WL networks usually do not run RIP/OSPF/BGP I guess the route you > apparently loose is coming from some dhcp server and may be your > dhclient configuration is incomplete or none existent, but here now it > would be useful to see your config Hi, I think we need to distinguish between two matters. One is where the route is directly reachable on the local-net of the network adapter, and ARP is valid/responding. The second case is when the route is not directly reachable. The second case is where the problem happens, like Stian kindly explained. # For example: ifconfig wlan0 10.0.0.2 255.255.255.0 up # Assume the router is at 10.0.0.1 # And we want to reach a certain destination through 10.0.0.1 # Then we do: route add 10.22.1.1 10.0.0.1 # # First the FreeBSD network stack will resolve the ethernet address for # 10.0.0.1, and all 10.22.1.1 IP packets will get sent to 10.0.0.1. # However, if the wlan0 link goes down, which sometimes happen, then the route for 10.22.1.1 is deleted. This is sometimes very annoying, and also, if it happens that the 10.22.1.1 is reachable from another network adapter, then traffic sometimes can end up mis-routed. --HPS