NETPLUGD(8)

πŸ“¦
version 1.2.9.2 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu questing, ubuntu resolute

✨ NETPLUGD ✨

okay bestie, gather round, because we're about to talk about netplugd(8) β€” the System Manager's Manual girlie who watches your network cables like it's her job (because it literally is) πŸ’…


πŸŽ€ NAME πŸŽ€

netplugd β€” the network cable hotplug management daemon. she's the one who notices when you plug stuff in and unplug stuff out. no cap.


🌸 SYNOPSIS 🌸

netplugd [-FP] [-c config_file] [-s script_file] [-i interface_pattern]
         [-p pid_file]

πŸ¦‹ DESCRIPTION πŸ¦‹

so. netplugd is a daemon that responds to network link events from the Linux kernel β€” like when a network interface loses or acquires a carrier signal. it's giving attentive. it's giving aware.

here's the lore: when an Ethernet-style network interface on a host gets plugged into a powered-up switch, hub, or other host, the two of them use a carrier signal to establish that the link is alive. and the Linux kernel makes this whole situation available through its netlink(7) interface. iconic of the kernel honestly.

so netplugd just... listens. it listens for carrier detection and loss messages from the kernel's netlink(7) subsystem. when a carrier signal is detected on an interface, it runs a script to bring the interface up. when carrier is lost, netplugd runs a script to bring the interface down. and that's it β€” netplugd does not define any policies for how to manage interfaces. it leaves that entire decision to a script, /etc/netplug.d/netplug, which is described in β€œFILES” below. she's not a control freak, she's a delegator 🫢

now, how do you tell netplugd which interfaces it should manage? you give it a list of shell-style glob patterns, and it matches against them using the fnmatch(3) function. for example, a pattern of eth[13] will tell netplugd to only manage eth1 and eth3, if those interfaces exist. and if the interfaces aren't known to the kernel at the time you start netplugd β€” maybe because they're unplugged PCMCIA network interfaces, or devices whose drivers haven't been installed yet β€” netplugd will start to manage them as soon as they're plugged in or their drivers become available. she's patient. she waits. main character energy tbh πŸ‘‘


πŸ’– OPTIONS πŸ’–

  • -F β€” run in the foreground; do not detach and run as a daemon. messages get logged to stdout or stderr, instead of using the syslog(3) mechanism. this option is useful mainly for debugging your configuration. debugging era πŸ”₯
  • -P β€” prevent autoprobing for interfaces. so normally, netplugd probes for all possible interface names that might match the patterns you tell it to manage. this is necessary in order to get network driver modules (the default with almost all Linux distributions) loaded and set up, so that they can provide link status notifications to the netplugd daemon. autoprobing should always be safe, and doesn't take long. disable it with caution. ⚠️
seriously bestie, with caution. i said what i said.
  • -c config_file β€” specify the name of a file from which to read patterns that describe the interfaces to manage. you can provide this option multiple times to read from more than one file. if you do not provide this option at all, netplugd will attempt to read from a default config file. and if you do not want netplugd to try to read from any real config files, you can specify /dev/null as a config file. chaotic but valid πŸ’€
  • -s script_file β€” specify an alternative script file path, override /etc/netplug.d/netplug
  • -i interface_pattern β€” specify a pattern that will be used to match interface names that netplugd should manage. you can provide this option multiple times to specify multiple patterns. stack 'em up πŸŽ€
  • -p pid_file β€” write the daemon's process ID to the file pid_file. if you tell netplugd to run in the foreground, this option is ignored. she said "not applicable, next" πŸ™ˆ

🌈 FILES 🌈

  • /etc/netplug/netplugd.conf β€” the default config file to read, if none is specified on the command line. the config file format is one pattern per line, with white space, empty lines, and comments starting with a # character ignored. patterns are standard shell-style glob patterns, e.g. "eth[0-9]".
  • /etc/netplug.d/netplug β€” the "policy" program (typically a shell script) that netplugd uses to probe for interfaces, and to bring them up or down in response to network link events. this program is called with the name of the interface as its first argument, and one of the following options:
    • in β€” a cable was plugged in, or carrier came up. the command should bring the interface up. the command is run asynchronously, and it should exit with status 0 on success.
    • out β€” a cable was plugged out, or carrier went down. the command should bring the interface down. the command is run asynchronously, and it should exit with status 0 on success.
    • probe β€” the command should load and initialise the driver for this interface, if possible, and bring the interface into the "up" state, so that it can generate netlink(7) events. the command is run synchronously; it must exit with status code 0 if it succeeds, otherwise with a non-zero exit code or signal. no pressure or anything ✨
  • /etc/init.d/netplug β€” the init(8) script that starts, stops, and displays status of the netplugd daemon.

πŸ‘‘ AUTHOR πŸ‘‘

netplugd was written by Bryan O'Sullivan <bos@serpentine.com>. we stan a legend 🫢


Copyright 2003 PathScale, Inc. Copyright 2003, 2004, 2005 Bryan O'Sullivan

netplugd is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published by the Free Software Foundation. you are forbidden from redistributing or modifying it under the terms of any other license, including other versions of the GNU General Public License. read that again bestie, it's not a suggestion 🚫

netplugd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. see the GNU General Public License for more details. no warranty bestie, none, zero, nada 😭


⭐ SEE ALSO ⭐

cardmgr(5), hotplug(8), ip(8), netlink(7)


okay that's the whole page, you ate it, you're so informed now πŸ“ and for the record: this was NETPLUGD(8) from the Linux 2.6 era, dated August 26, 2003 β€” yes she's vintage, yes she still serves πŸ’…βœ¨ bye bestie!! 🌸