https://github.com/qu1x/ipaddr
Monitor network interfaces for IP address changes
https://github.com/qu1x/ipaddr
hooks-folder ip-addresses monitoring-daemon network-interfaces systemd-unit
Last synced: 11 months ago
JSON representation
Monitor network interfaces for IP address changes
- Host: GitHub
- URL: https://github.com/qu1x/ipaddr
- Owner: qu1x
- Created: 2017-08-18T12:46:46.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-27T20:30:36.000Z (over 8 years ago)
- Last Synced: 2025-01-02T18:46:56.581Z (about 1 year ago)
- Topics: hooks-folder, ip-addresses, monitoring-daemon, network-interfaces, systemd-unit
- Language: Shell
- Size: 31.3 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ipaddr
Monitor network interfaces for IP address changes
Requires `ip` only, optionally `systemd`.
## Usage
```text
$ ipaddr
enp1s0 fe80::2/64
enp1s0 2001:db8::1:2/64
enp1s0 192.0.2.102/24
wlp2s0 fe80::2/64
wlp2s0 2001:db8::2:2/64
wlp2s0 192.0.2.202/24
$ ipaddr --help
IP Address Monitor
ipaddr
ipaddr show
If a monitor is running on the same $IPADDR_WORK directory and the
$IPADDR_HOOK/20-list hook is executable, all currently assigned IP addresses
are shown in the format of the event variable $list.
ipaddr monitor
Monitor network interfaces for IP address changes. Hooks in $IPADDR_HOOK are
executable or ignored. They are entered in lexical order and have access to
the environment and event variables listed below. Hooks are advised to wrap
file operations with `flock'. Long hooks delay subsequent events but no event
is ever missed.
ipaddr OPTION
Print and exit.
OPTIONs:
-h, --help Print help.
-v, --version Print version.
Environment variables:
$IPADDR_WORK /run/ipaddr
$IPADDR_HOOK /etc/ipaddr.d
Event variables:
$list
$action assign|update (lifetime via RA)|resign
$index
$interface
$family inet|inet6
$address
$prefix
$brd
$scope
$flag_list
$valid_lft
$preferred_lft
Executable hooks:
/etc/ipaddr.d/10-echo
/etc/ipaddr.d/20-list
```
## Installation
```text
$ sudo make install
install -m 644 -Dt /usr/lib/systemd/system/ ipaddr.service
install -m 755 -Dt /usr/bin/ ipaddr
install -m 755 -Dt /etc/ipaddr.d/ ipaddr.d/10-echo ipaddr.d/20-list
systemctl daemon-reload
systemctl enable ipaddr
systemctl restart ipaddr
```
## Uninstallation
```text
$ sudo make uninstall
systemctl disable ipaddr
Removed /etc/systemd/system/network.target.wants/ipaddr.service.
systemctl stop ipaddr
rm -f /usr/lib/systemd/system/ipaddr.service
rm -f /usr/bin/ipaddr
rm -f /etc/ipaddr.d/10-echo /etc/ipaddr.d/20-list
rmdir --ignore-fail-on-non-empty /etc/ipaddr.d/
systemctl daemon-reload
```
## License
Copyright (c) 2017 Rouven Spreckels
Usage of the works is permitted provided that
this instrument is retained with the works, so that
any entity that uses the works is notified of this instrument.
DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.
## Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted
for inclusion in the works by you shall be licensed as above, without any
additional terms or conditions.