How to bind a route to a network adapter and not IP

H hm at hm.net.br
Tue Jun 19 07:56:34 UTC 2012


On Monday 18 June 2012 18:07 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 at 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 ??
> 


so now we're coming to the point ...

on renewal of the IP address the interface is set do down, old IP removed and 
the new one (even if the same as before) is associated and the IF comes up 
again

means, any route associated get lost, you may get a new one (default) from the 
dhcp server

you could set some options in your /etc/dhclient.conf to match your needs

you could request a longer lease time, eventually reduce the retry time to get 
less down time

check your log what the dhcp server send to you

may be you try something like:

timeout 60;
retry 60;
send dhcp-lease-time 36000; (or more to cover your longest up time)

if the longer lease time does not work, then  I guess then you could use the 
'script "name"' option to set your special route after renewal

Hans



-- 

HM
+55 17 8111.3300
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: This is a digitally signed message part.
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20120619/eb12e11c/attachment.pgp


More information about the freebsd-stable mailing list