First of all, excuse if the topic is not in the proper forum. My question is network-related (for a server, actually) but could not find a network-specific forum.
I am a Gentoo user since the end of 2006, and ever since I heard about Funtoo, I've been looking at it with a mixture of love and curiosity. Recently a friend (PeGa!, I dunno if he's registered in the forums or active in the community) who has been using Funtoo for a while, pointed me to a news piece by drobbins re. Funtoo upgrades, and I decided to dig in a little more, particularly the networking system (since OpenRC does not do what I want to do, go on reading and you'll see what I mean).
My main issue is the following: whenever my ISP (cablemodem, hooked up to eth0 on my Gentoo gateway) has one of those issues, I lose my public IP address on eth0, and am given a private IP (192.168.etc), with a lease time of ~30secs. dhclient keeps renewing for an indefinite amount of time, and only when my ISP fixes their stuff (and coincidentally, the rest of the cablemodem lights light up) do I recover a public IP.
Whenever this happens, I have another laptop at home, which is constantly hooked up to the neighbour's wifi, and is all set up with IPTables to share its connectino. So, whenever this happens, I add an additional route on my gateway, and put as default gateway this laptop, which is accessible via eth1 (since it is on my LAN), and fix my IPTables script so my gateway can NAT properly. This makes it possible for all my LAN machines to recover their Internet connection and I can keep on working.
However, when my ISP comes back, I get another default route added (for eth0, since it is now up again), so I have to go in my gateway, delete the previously added default route via eth1, and re-run my IPTables script so it has the normal rules for NATing via the eth0 connection.
Now my question is: does the network infrastructure system of Funtoo have a way to automate this, without having to perform manual intervention? I can simplify this at the most with this statement: can Funtoo run a custom script whenever a default gw route on a specific interface is lost, and run another script (or the same one, with different parameters) when the default gw route on that same interface comes back?
Cheers and thanks in advance