10

I using a USB wifi dongle to connect to the Internet. When the wireless connection dies, I lose some iproute rules too.

How can I reset these rules when the interface connected again?

1
  • 1
    Look into udev.
    – terdon
    Commented Sep 18, 2013 at 13:54

1 Answer 1

16

If you have ifupdown (most likely if you are using Debian or a Debian-based distro) look at man interfaces:

   post-up command
          Run command after bringing the interface up.  If this command fails then ifup aborts, refraining from marking the interface as  con‐
          figured  (even though it has really been configured), prints an error message, and exits with status 0.  This behavior may change in
          the future.

So in /etc/network/interfaces you can have something like

auto eth0
    iface eth0 inet dhcp
    post-up /usr/local/sbin/my-custom-script

Replace eth0 for your actual interface.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .