I have modified my routing table by deleting one rule, and adding two new rules for my second interface eth1:route del -net 10.1.2.0 netmask 255.255.255.0route add -host 10.1.2.51 eth1route add -host 10.1.2.52 eth1I want the rules to survive reboot. I could write a simple rc script to remove 1 rule and insert 2 new, but I was wondering whether there is a way to configure ifconfig, not to add a route rule for the interface (eth1) when it is started, or even better, to specify which rules should be added.What would be a clean way to do it? Does ifconfig allow me to specify custom rules for routing?
Set persistent routing table on Debian
debian;networking;route
You can add the calls to the post-up hook when the interface comes up. Theinterface configuration sits in /etc/network/interfaces. Here an example:auto eth1iface eth1 inet dhcp  post-up route del -net 10.1.2.0 netmask 255.255.255.0  post-up route add -host 10.1.2.51 eth1  post-up route add -host 10.1.2.52 eth1  pre-down route add -net 10.1.2.0 netmask 255.255.255.0  pre-down route add -host 10.1.2.51 eth1  pre-down route add -host 10.1.2.52 eth1From the man page - interfaces:post-up command                Run command after bringing the interface up.   If  this  command                fails then ifup aborts, refraining from marking the interface as                configured (even though it has really been  configured),  prints                an  error  message,  and exits with status 0.pre-down command                Run command before taking the interface down.  If  this  command                fails  then  ifdown  aborts, marks the interface as deconfigured                (even though it has not really  been  deconfigured),  and  exits                with status 0.Furthermore, on Linux the net-tools route is deprecated and should be replacedby the tools from the iproute2 package.Further reading:Linux Set Up Routing with ip CommandIPROUTE2 Utility Suite Howto