Je reprend ici un note du mardi 22 avril 2008 par Noplay qui m’a été très utile et que je souhaite garder à disposition (comme souvent).
Plusieurs interface, plusieurs route
Sous Debian ou Ubuntu si vous désirez ajouter automatiquement des routes lorsque une interface réseau devient active vous pouvez utiliser la règle post-up du fichier /etc/network/interfaces. Celle-ci permet éxécuter une commande après qu’une interface soit passée active.
allow-hotplug eth1 iface eth1 inet dhcp post-up route add -net <span style="color: #000000;">42.42</span><span style="color: #000000;">.42</span><span style="color: #000000;">.0</span> netmask <span style="color: #000000;">255.255</span><span style="color: #000000;">.255</span><span style="color: #000000;">.0</span> gw <span style="color: #000000;">192.168</span><span style="color: #000000;">.1</span><span style="color: #000000;">.1</span> down route del -net <span style="color: #000000;">42.42</span><span style="color: #000000;">.42</span><span style="color: #000000;">.0</span> netmask <span style="color: #000000;">255.255</span><span style="color: #000000;">.255</span><span style="color: #000000;">.0</span> gw <span style="color: #000000;">192.168</span><span style="color: #000000;">.1</span><span style="color: #000000;">.1</span>
Pour plus d’informations : man interfaces