E
E
evgeniy00902020-05-03 18:22:49
linux
evgeniy0090, 2020-05-03 18:22:49

Who faced writing dhcpcd-run-hooks?

Good afternoon, on this topic dhcpcd-run-hooks is very little described, for example, how to write a rule for building routes when raising the interface.
In the directory /etc/dhcp/dhclient-enter-hooks.d/ I create a myscr file with the following content

case $interface in
       wlan0)
       case $reason in
              BOUND|RENEW|REBIND|REBOOT)
                  ip route add default via 192.168.1.1
              ;;
       esac
       ;;
esac

I reboot and nothing happens.
How to make the script work?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2020-05-03
@hempy80

Try like in the example

#!/bin/bash
if [ “${interface}” = “wlan0” ]; then
 case “${reason}” in BOUND|RENEW|REBIND|REBOOT)
           ip route add default via 192.168.1.1 
       ;;
       esac
fi

Don't forget to make the file executable
chmod +x myscr

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question