From owner-freebsd-stable@FreeBSD.ORG Mon Jun 25 22:44:43 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 433501065672 for ; Mon, 25 Jun 2012 22:44:43 +0000 (UTC) (envelope-from freebsd@damnhippie.dyndns.org) Received: from qmta12.emeryville.ca.mail.comcast.net (qmta12.emeryville.ca.mail.comcast.net [76.96.27.227]) by mx1.freebsd.org (Postfix) with ESMTP id 232A98FC12 for ; Mon, 25 Jun 2012 22:44:43 +0000 (UTC) Received: from omta15.emeryville.ca.mail.comcast.net ([76.96.30.71]) by qmta12.emeryville.ca.mail.comcast.net with comcast id SkaJ1j0011Y3wxoACmjdUE; Mon, 25 Jun 2012 22:43:37 +0000 Received: from damnhippie.dyndns.org ([24.8.232.202]) by omta15.emeryville.ca.mail.comcast.net with comcast id Smjc1j0034NgCEG8bmjcgM; Mon, 25 Jun 2012 22:43:37 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id q5PMhYg8045275; Mon, 25 Jun 2012 16:43:34 -0600 (MDT) (envelope-from freebsd@damnhippie.dyndns.org) From: Ian Lepore To: Hans Petter Selasky In-Reply-To: <201206182307.10050.hselasky@c2i.net> References: <4FDB6AA3.3040606@gmail.com> <201206181754.15680.hselasky@c2i.net> <201206181803.41211.hm@hm.net.br> <201206182307.10050.hselasky@c2i.net> Content-Type: text/plain; charset="us-ascii" Date: Mon, 25 Jun 2012 16:43:33 -0600 Message-ID: <1340664213.1156.27.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: freebsd-stable@freebsd.org 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, 25 Jun 2012 22:44:43 -0000 On Mon, 2012-06-18 at 23:07 +0200, Hans Petter Selasky wrote: > On Monday 18 June 2012 23:03:34 H wrote: > > On Monday 18 June 2012 12:54 Hans Petter Selasky wrote: > > > 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 > > > > no no no my friend, wrong again > > > > that is a static route and it goes away same way it was created, manually > > or by deleting the IP address 10.0.0.2 from the related interface > > > > wether there is or not an active link on that interface does not matter > > > > Hi, > > Can it be that dhclient which I'm running on this interface with manual routes > disrupts stuff then ?? > > --HPS I think you can get the effect you want with dhclient.conf. I just experimented a bit and it works for me, installing the static route when it gets an address (and it gets removed if I manually configure the interface back to 0.0.0.0), using this dhclient.conf: interface "re0" { supersede static-routes 10.1.1.1 172.22.42.240; } It works with either the 'prepend' or 'supersede' verb, depending on your needs. You can also specify multiple static routes, see dhcp-options(5). -- Ian