You could either do this @ layer 2 and or 3.
What I would consider is using a method that uses either a keepalive or response test to make sure the link is there. The other issue you have is stability - you don't want the link flapping all the time, so you can either use interface/route dampning. With layer 2 you need to be mindful of port state transistions on span-tree unless you use 802.1w
What routing protocols do you run if any? What span-tree are you currently using?
HTH>