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?

share|improve this question
1  
Look into udev. – terdon Sep 18 '13 at 13:54
up vote 12 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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