{
    "mode": "man",
    "parameter": "DHCPCD-RUN-HOOKS",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/DHCPCD-RUN-HOOKS/8/json",
    "generated": "2026-11-10T10:43:42Z",
    "sections": {
        "NAME": {
            "content": "dhcpcd-run-hooks — DHCP client configuration script\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "dhcpcd-run-hooks  is used by dhcpcd(8) to run any system and user defined hook scripts.  Sys‐\ntem hook scripts are found in /usr/lib/dhcpcd/dhcpcd-hooks and the  user  defined  hooks  are\n/etc/dhcpcd.enter-hook.   and  /etc/dhcpcd.exit-hook.   The  default  install  supplies  hook\nscripts for configuring /etc/resolv.conf and the hostname.  Your distribution  may  have  in‐\ncluded  other hook scripts to say configure ntp or ypbind.  A test hook is also supplied that\nsimply echos the dhcp variables to the console from DISCOVER message.\n\nThe hooks scripts are loaded into the  current  shell  rather  than  executed  in  their  own\nprocess.   This allows each hook script, such as /etc/dhcpcd.enter-hook to customise environ‐\nment variables or provide alternative functions to hooks further down the  chain.   As  such,\nusing  the  shell  builtins exit, exec or similar will cause dhcpcd-run-hooks to exit at that\npoint.\n\nEach time dhcpcd-run-hooks is invoked, $interface is set to the interface that dhcpcd is  run\non and $reason is set to the reason why dhcpcd-run-hooks was invoked.  DHCP information to be\nconfigured  is  held  in variables starting with the word new and old DHCP information to be\nremoved is held in variables starting with the word old.  dhcpcd can display the  full  list\nof variables it knows about by using the -V, --variables argument.\n\nHere's a list of reasons why dhcpcd-run-hooks could be invoked:\n\nPREINIT           dhcpcd  is  starting  up and any pre-initialisation required should be per‐\nformed now.\n\nCARRIER           dhcpcd has detected the carrier is up.  This is generally just a  notifica‐\ntion and no action need be taken.\n\nNOCARRIER         dhcpcd  lost the carrier.  The cable may have been unplugged or association\nto the wireless point lost.\n\nNOCARRIERROAMING\ndhcpcd lost the carrier but the interface configuration is persisted.   The\nOS has to support wireless roaming or IP Persistence for this to happen.\n\nINFORM | INFORM6  dhcpcd informed a DHCP server about its address and obtained other configu‐\nration details.\n\nBOUND | BOUND6    dhcpcd obtained a new lease from a DHCP server.\n\nRENEW | RENEW6    dhcpcd renewed its lease.\n\nREBIND | REBIND6  dhcpcd has rebound to a new DHCP server.\n\nREBOOT | REBOOT6  dhcpcd successfully requested a lease from a DHCP server.\n\nDELEGATED6        dhcpcd assigned a delegated prefix to the interface.\n\nIPV4LL            dhcpcd obtained an IPV4LL address, or one was removed.\n\nSTATIC            dhcpcd  has  been configured with a static configuration which has not been\nobtained from a DHCP server.\n\n3RDPARTY          dhcpcd is monitoring the interface for a 3rd party to give  it  an  IP  ad‐\ndress.\n\nTIMEOUT           dhcpcd failed to contact any DHCP servers but was able to use an old lease.\n\nEXPIRE | EXPIRE6  dhcpcd's lease or state expired and it failed to obtain a new one.\n\nNAK               dhcpcd  received a NAK from the DHCP server.  This should be treated as EX‐\nPIRE.\n\nRECONFIGURE       dhcpcd has been instructed to reconfigure an interface.\n\nROUTERADVERT      dhcpcd has received an IPv6 Router Advertisement, or one has expired.\n\nSTOP | STOP6      dhcpcd stopped running on the interface.\n\nSTOPPED           dhcpcd has stopped entirely.\n\nDEPARTED          The interface has been removed.\n\nFAIL              dhcpcd failed to operate on the  interface.   This  normally  happens  when\ndhcpcd  does not support the raw interface, which means it cannot work as a\nDHCP or ZeroConf client.  Static configuration and DHCP INFORM is still al‐\nlowed.\n\nTEST              dhcpcd received an OFFER from a DHCP server but will not configure the  in‐\nterface.  This is primarily used to test the variables are filled correctly\nfor the script to process them.\n",
            "subsections": []
        },
        "ENVIRONMENT": {
            "content": "dhcpcd  will  clear the environment variables aside from $PATH.  The following variables will\nthen be set, along with any protocol supplied ones.\n\n$interface                   the name of the interface.\n\n$protocol                    the protocol that triggered the event.\n\n$reason                      as described above.\n\n$pid                         the pid of dhcpcd.\n\n$ifcarrier                   the link status of $interface: unknown, up or down.\n\n$ifmetric                    $interface preference, lower is better.\n\n$ifwireless                  1 if $interface is wireless, otherwise 0.\n\n$ifflags                     $interface flags.\n\n$ifmtu                       $interface MTU.\n\n$ifssid                      the SSID the interface is connected to.\n\n$interfaceorder             A list of interfaces, in order of preference.\n\n$ifup                       true if the interface is up, otherwise false.  This is more than\nIFFUP and may not be equal.\n\n$ifdown                     true if the interface is down, otherwise false.   This  is  more\nthan IFFUP and may not be equal.\n\n$afwaiting                  Address family waiting for, as defined in dhcpcd.conf(5).\n\n$profile                     the name of the profile selected from dhcpcd.conf(5).\n\n$newdelegateddhcp6prefix  space-separated list of delegated prefixes.\n",
            "subsections": []
        },
        "FILES": {
            "content": "When   dhcpcd-run-hooks   runs,   it  loads  /etc/dhcpcd.enter-hook,  any  scripts  found  in\n/usr/lib/dhcpcd/dhcpcd-hooks in lexical order, then finally /etc/dhcpcd.exit-hook.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "dhcpcd(8)\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "Roy Marples <roy@marples.name>\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Please report them to https://roy.marples.name/projects/dhcpcd\n",
            "subsections": []
        },
        "SECURITY CONSIDERATIONS": {
            "content": "dhcpcd will validate the content of each option against its encoding.  For string, ascii, raw\nor binhex encoding it's up to the user to validate it for the intended purpose.\n\nWhen used in a shell script, each variable must be quoted correctly.\n\nDebian                                     August 31, 2022                       DHCPCD-RUN-HOOKS(8)",
            "subsections": []
        }
    },
    "summary": "dhcpcd-run-hooks — DHCP client configuration script",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "dhcpcd",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/dhcpcd/8/json"
        }
    ]
}