How are the routing tables populated on a Debian system? I understand that the ip route family of commands can be used to manually manipulate the routing tables, but how are the routing tables initially populated on system start, and under what circumstances are the routing tables updated?


When working with a Debian system, the routing tables are automatically populated whenever network interfaces are brought up or down. See man interfaces, man ifup, and man ip for a detailed description.

Essentially, ifup reads configuration bits from /etc/network/interfaces and then for statically defined interfaces uses ip route add to create the appropriate routes. For interfaces configured to use DHCP, ifup requests the configuration bits from the DHCP server and then uses ip route add to create those routes as well. When an interface is taken down, ifdown deletes the routes that would have been added based on the current configuration. So be aware that when the configuration changes, the routes deleted by ifdown might not be the same as the routes originally added by ifup.

In /etc/network/interfaces, the pre-up, post-up, pre-down, and post-down hooks are available to manually manipulate the routing tables (or to run commands for other purposes).

The scripts in /etc/network/if-*.d/* provide additional hooks for more complex tasks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.