Contents
Last Update: 2019-09-10
Functions: changing the mac address and hostname for each boot.
Tip: The example code is on Debian.
Mac Address Spoofing
Use macchanger to spoof manually
The macchanger (a.k.a., the GNU MAC Changer) provides a variety of features such as changing the address to match a certain vendor or completely randomizing it.
Install the package macchanger from the official repositories.
1 | sudo apt update |
Display available network interfaces.
1 | ip a |
Change the mac address:
1 | sudo macchanger -r your_interface_name |
Automatically changes the mac address when boots
Use the NetworkManager to configure MAC address randomization.
1 | sudo vim /etc/NetworkManager/NetworkManager.conf |
1 | [main] |
Dynamic Hostname
Creat a file.
1 | sudo mkdir -p /etc/systemd/scripts |
1 |
|
Make it executable.
1 | sudo chmod +x /etc/systemd/scripts/newhostname |
Make it run at startup:
1 | sudo vim /etc/systemd/system/newhostname.service |
1 | [Unit] |
1 | sudo systemctl enable newhostname |
Now you can reboot to test the functions.