Subsections

custom interface hooks

per interface

You can execute various commands on interface startup or shutdown with special option:
[label=\file{/etc/network/interfaces}]
iface foobar inet static
    [...]
    pre-up <command>
    up <command>
    up <command>
    down <command>
    post-down <command>

You can give each option multiple times and their commands will be executed in given order.

pre-up
before the interface will be started
up
after the interface was started successfully
down
before the interface goes down
post-down
after the interface shut down

general hooks

Additionally you can write scripts executed for each interface if you put them in Same semantics as above.