A small systemd-based utility that randomizes (spoofs) network interface MAC addresses on system boot and can be run periodically via a systemd timer. It uses the well-known macchanger utility and is intended for systemd-based Linux distributions (Arch, Debian/Ubuntu, Fedora, etc.).
Why use this
- Improve privacy by rotating MAC addresses to reduce device tracking on networks.
- Automatically randomize MAC addresses at boot and optionally at configured intervals.
- Lightweight: uses existing system utilities and a simple shell script + systemd units.
Requirements
- A systemd-based Linux distribution.
macchangerinstalled and available in PATH.- Root privileges to change MAC addresses and install systemd units.
Supported platforms
- Any Linux distribution that uses systemd and provides
macchanger(Arch Linux, Debian/Ubuntu, Fedora, and derivatives).
Quick features
- Randomizes MAC at boot via a systemd service.
- Optional periodic randomization via a systemd timer (configurable interval).
- Minimal dependencies and easy to inspect/modify.
Table of contents
- Installation
- Configuration
- Usage
- Enabling periodic randomization (systemd timer)
- Files in this repository
- Contributing
- License
- Maintainer
- Install macchanger
- Arch / Manjaro:
sudo pacman -Syu macchanger
- Debian / Ubuntu:
sudo apt update sudo apt install macchanger
- Fedora:
sudo dnf install macchanger
- Clone this repository
git clone https://github.com/Pushpenderrathore/macchanger_daeion.git
cd macchanger_daeion- Install the script and systemd service
# Install the main script
sudo cp change-mac.sh /usr/local/bin/change-mac.sh
sudo chmod +x /usr/local/bin/change-mac.sh
# Install the systemd service unit
sudo cp macchanger.service /etc/systemd/system/macchanger.service
# Reload systemd, enable and start the service
sudo systemctl daemon-reload
sudo systemctl enable --now macchanger.serviceNotes:
- The example above places the script in
/usr/local/binand the systemd unit in/etc/systemd/system. Adjust paths if you prefer a different layout. - You may need to edit
change-mac.shto specify which interfaces to randomize (see Configuration).
-
Interfaces
- The script can be configured to target specific interfaces (for example
wlp3s0,enp0s31f6) or all non-loopback interfaces. Editchange-mac.shto list desired interface names or adjust its filtering logic. - If the script supports arguments or environment variables for interface selection, you may pass them via the systemd unit (see the service file or set a drop-in unit).
- The script can be configured to target specific interfaces (for example
-
Logging
- The service writes to the system journal. Use
journalctlto view logs.
- The service writes to the system journal. Use
-
Check status:
sudo systemctl status macchanger.service
-
Follow logs in real time:
sudo journalctl -u macchanger.service -f
-
Run the script manually (useful for testing):
sudo /usr/local/bin/change-mac.sh
-
To test on a single interface :
sudo /usr/local/bin/change-mac.sh wlp13s0
[Unit]
Description=Randomize MAC address at boot
After=network-pre.target
Before=network.target
Wants=network-pre.target
[Service]
Type=simple
ExecStart=/usr/local/bin/change-mac.sh
Restart=always
[Install]
WantedBy=multi-user.targetOR-Direct run option :
sudo ./install.sh
sudo systemctl status macchanger.serviceWhen run, ./install.sh it will trigger macchanger.service at the system Deamonic level to configure everything.
- change-mac.sh — Core script that performs MAC randomization.
- macchanger.service — systemd service unit to run the script at boot (and on-demand).
- macchanger.timer — optional systemd timer unit to run the service periodically (example).
- install.sh — convenience installation script (one-shot installer).
- setup.py / requirements.txt — packaging helpers (if converting to a Python package).
- macchanger-daemon — optional CLI/entrypoint (if present).
- CODE_OF_CONDUCT.md — community guidelines.
- LICENSE — MIT License.
(Adjust names above if your repository differs.)
Contributions are welcome. Typical ways to contribute:
- Add support for additional distributions or interfaces.
- Improve the script's robustness and logging.
- Add automated tests or packaging (AUR, DEB, RPM).
- Improve documentation and add examples.
Please follow the repository's code of conduct and open a pull request. If you want me to prepare a PR with the revised README, tell me and I can create one (I'll need the repository owner permission to push).
- Changing a MAC address may violate network policies in some environments. Do not use this on networks where spoofing is prohibited.
- Changing the MAC of an active interface may temporarily disrupt network connectivity.
- Keep in mind that MAC randomization alone does not guarantee anonymity; use it in combination with other privacy measures if needed.
This project is licensed under the MIT License. See LICENSE for details.
Pushpenderrathore — https://github.com/Pushpenderrathore