I have a headless Debian server with two network cards:2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000    link/ether 01:02:1d:54:7c:01 brd ff:ff:ff:ff:ff:ff2: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000    link/ether 01:02:1d:54:7e:01 brd ff:ff:ff:ff:ff:ffIf I disconnect the cable connected to eth1, then port will go down, but administratively it will stay up:2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000    link/ether 01:02:1d:54:7c:01 brd ff:ff:ff:ff:ff:ff2: eth1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN mode DEFAULT qlen 1000    link/ether 01:02:1d:54:7e:01 brd ff:ff:ff:ff:ff:ffThis means that routes associated with eth1 are still present in routing table. Is there a way to force eth1 administratively down once it's physically disconnected?
Bring network interface down if physical connectivity is lost
ip;route
A quick and dirty solution would be to use ip monitor and a script that ifupdowns the interface.The script would be:#!/bin/ship monitor link | while IFS=':' read num name status; do    read extraline # iproute2 outputs physical address on a separate line.    newstate=$(echo $status|awk -F' ' '{print $NF}')    if [ $newstate = UP ]; then        ifup $name    elif [ $newstate = DOWN ]; then        ifdown $name    fidoneThe script doesn't check network interface status before attempting to change it, but that shouldn't be a problem.To use it just place it in /opt/bin/linkmonitor.sh, make it executable with chmod +x /opt/bin/linkmonitor.sh and add it to /etc/rc.local with an ampersand at the end:/opt/bin/linkmonitor.sh &If you need a more robust solution you may be interested in a route failover solution.