Ubuntu 10.04 with NetworkManager
Ubuntu 10.04 (and as of September 1, 2010 and the near future, all distributions using Network Manager) ships with a version of Network Manager that does not support “pre-up” scripts for network connections—this means that it is unable to run scripts before connecting to a network. This feature would easily enable one to use a script that changes the MAC address on every connection. Due to this limitation, this guide specifically generates a random MAC address every time the Network Manager service starts, and then generates a new one every time you disconnect from the network.
- Open a terminal and run:
sudo apt-get install macchanger - It’s suggested to take note of your current MAC address at this point, to verify that it is being changed by your scripts later on. To do this for a wired (ethernet) connection, type:
macchanger eth0
to do the same for a wireless adapter, type:macchanger wlan0
The output will look something like this:Current MAC: 00:0c:1d:47:a4:0c (Mettler & Fuchs Ag)
00:0c:1d:47:a4:0c is the MAC address in this instance, always in the form of XX:XX:XX:XX:XX:XX. The text in the parentheses will vary. - Create the file /etc/init/macchanger.conf. This can be done by typing:
sudo nano /etc/init/macchanger.conf - Paste the following lines into it and save the file (Ctrl+X will save and close in nano):
# macchanger - set MAC addresses
#
# Set the MAC addresses for the network interfaces.
description "change mac addresses"
start on starting network-manager
pre-start script
/usr/bin/macchanger -A wlan0
/usr/bin/macchanger -A eth0
/usr/bin/macchanger -A wmaster0
/usr/bin/macchanger -A pan0
#/usr/bin/logger wlan0 `/usr/bin/macchanger -s wlan0`
#/usr/bin/logger eth0 `/usr/bin/macchanger -s eth0`
end script
This script runs after the network manager service starts through the Ubuntu Upstart daemon system then, using the -A switch, creates a random vendor-identified MAC address. The program macchanger can generate various kinds of addresses—this method may look strange to active network monitoring, but passive network monitoring and background tracking will likely not notice. This method should work best for most people.
- Create the file /etc/network/if-post-down.d/random-mac and paste the following lines into it:
#!/bin/sh MACCHANGER=/usr/bin/macchanger [ "$IFACE" != "lo" ] || exit 0 # Bring down interface (for wireless cards that are up to scan for networks), change MAC address to a random vendor address, bring up the interface /sbin/ifconfig "$IFACE" down macchanger -A "$IFACE"
This script changes the MAC address again when the network is disconnected. It’s possible if the network is never properly brought down and one never reboots that one can use the same address more than once.
- Make the random-mac script executable by typing:
sudo chmod +x /etc/network/if-post-down.d/random-mac - Restart Network Manager to take effect:
sudo service network-manager restart
Your computer will now automatically create (without your intervention or notification) a new random MAC address for every physical network adapter you have (wired and WIFI) and reduce your trackability on public networks!
Tidak ada komentar:
Posting Komentar