Skip to content

Add Raspberry Pi MAC address cloner scripts#8

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/mac-address-cloner-scripts
Draft

Add Raspberry Pi MAC address cloner scripts#8
Copilot wants to merge 2 commits into
mainfrom
copilot/mac-address-cloner-scripts

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 21, 2026

Implements the requested workflow: connect a device to the Pi over ethernet, capture its MAC via DHCP, then reconnect to the LAN impersonating that device's MAC address.

Scripts (mac-address-cloner/)

  • 01-setup-dhcp-server.sh — assigns a static IP to the ethernet interface, saves the Pi's original MAC, and starts dnsmasq as a DHCP server so the target device gets an address automatically
  • 02-capture-mac.sh — extracts the device MAC from the dnsmasq lease file; falls back to ARP table; persists to /var/lib/mac-address-cloner/captured_mac
  • 03-clone-and-connect.sh — tears down dnsmasq, applies the captured MAC via ip link set … address, and requests a LAN DHCP lease
  • 04-restore-mac.sh — releases the cloned-MAC lease and restores the Pi's hardware MAC

Workflow

sudo ./01-setup-dhcp-server.sh   # connect target device to Pi
sudo ./02-capture-mac.sh          # disconnect device; plug Pi into LAN
sudo ./03-clone-and-connect.sh    # Pi appears on LAN as the target device
sudo ./04-restore-mac.sh          # optional: restore Pi's real MAC

State (original MAC, captured MAC, interface) is persisted under /var/lib/mac-address-cloner/ so steps can run independently at different times. Requires dnsmasq; works with either dhclient or dhcpcd.

Original prompt

This section details on the original issue you should resolve

<issue_title>mac address cloner</issue_title>
<issue_description>I want to do the following:

  • connect a device to my raspberry pi via ethernet
  • give the device an IP dhcp and remember the mac address
  • disconnect the device and connect to LAN with the mac address of the device I previously had connected

can this be done with a bunch of scripts?</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Co-authored-by: falkorichter <50506+falkorichter@users.noreply.github.com>
Copilot AI changed the title [WIP] Add scripts for MAC address cloning on Raspberry Pi Add Raspberry Pi MAC address cloner scripts Feb 21, 2026
Copilot AI requested a review from falkorichter February 21, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

mac address cloner

2 participants