Randomizing MAC address on startup in Linux Mint
I’d like Linux Mint to randomize my MAC address on startup on all network interfaces (enp2s0f1 & wlp3s0), and notify me if one of them failed to change via a pop-up.
How would I go about doing this?
(I’m running Linux Mint 18.1 64-bit)
linux debian networking scripting
add a comment |
I’d like Linux Mint to randomize my MAC address on startup on all network interfaces (enp2s0f1 & wlp3s0), and notify me if one of them failed to change via a pop-up.
How would I go about doing this?
(I’m running Linux Mint 18.1 64-bit)
linux debian networking scripting
are you using network manager/wicd/etc or do you connect via /etc/network/interfaces ?
– ivanivan
Oct 11 '17 at 22:12
@ivanivan I’m connecting via network-manager
– Bashtheparty
Oct 11 '17 at 22:52
+1 Been thinking myself of doing that, but have not looked how to do it.
– Rui F Ribeiro
Oct 12 '17 at 9:30
add a comment |
I’d like Linux Mint to randomize my MAC address on startup on all network interfaces (enp2s0f1 & wlp3s0), and notify me if one of them failed to change via a pop-up.
How would I go about doing this?
(I’m running Linux Mint 18.1 64-bit)
linux debian networking scripting
I’d like Linux Mint to randomize my MAC address on startup on all network interfaces (enp2s0f1 & wlp3s0), and notify me if one of them failed to change via a pop-up.
How would I go about doing this?
(I’m running Linux Mint 18.1 64-bit)
linux debian networking scripting
linux debian networking scripting
edited May 5 '18 at 3:24
Rui F Ribeiro
40.7k1479137
40.7k1479137
asked Oct 11 '17 at 19:32
BashthepartyBashtheparty
214
214
are you using network manager/wicd/etc or do you connect via /etc/network/interfaces ?
– ivanivan
Oct 11 '17 at 22:12
@ivanivan I’m connecting via network-manager
– Bashtheparty
Oct 11 '17 at 22:52
+1 Been thinking myself of doing that, but have not looked how to do it.
– Rui F Ribeiro
Oct 12 '17 at 9:30
add a comment |
are you using network manager/wicd/etc or do you connect via /etc/network/interfaces ?
– ivanivan
Oct 11 '17 at 22:12
@ivanivan I’m connecting via network-manager
– Bashtheparty
Oct 11 '17 at 22:52
+1 Been thinking myself of doing that, but have not looked how to do it.
– Rui F Ribeiro
Oct 12 '17 at 9:30
are you using network manager/wicd/etc or do you connect via /etc/network/interfaces ?
– ivanivan
Oct 11 '17 at 22:12
are you using network manager/wicd/etc or do you connect via /etc/network/interfaces ?
– ivanivan
Oct 11 '17 at 22:12
@ivanivan I’m connecting via network-manager
– Bashtheparty
Oct 11 '17 at 22:52
@ivanivan I’m connecting via network-manager
– Bashtheparty
Oct 11 '17 at 22:52
+1 Been thinking myself of doing that, but have not looked how to do it.
– Rui F Ribeiro
Oct 12 '17 at 9:30
+1 Been thinking myself of doing that, but have not looked how to do it.
– Rui F Ribeiro
Oct 12 '17 at 9:30
add a comment |
1 Answer
1
active
oldest
votes
A more standard way to randomize mac addresses is using macchanger.
Following (roughly) the instructions of the ubuntu wiki: AnonymizingNetworkMACAddresses
Install MACCHANGER
The package macchanger is in the Networking
(universe). Install it.
apt-get install macchanger
Create the Randomizer Trigger
Utilizing Network-Manager's methods to trigger events when a network
interface changes state, place the macchanger script into
/etc/network/if-pre-up.d.
vi /etc/network/if-pre-up.d/macchanger
Don't change $IFACE. It is a
reference provided by NetworkManager for the particular activated
interface.
#!/bin/sh
# Randomize the mac address for the given interface
/usr/bin/macchanger -e "$IFACE"
Make it executable.
chmod +x /etc/network/if-pre-up.d/macchanger
Interface State Change
Now everytime any managed interface is activated, as it passes through
the pre-up phase, the network MAC address will be randomized under the
VENDOR id.
Fully Random
If you desire a completely random MAC address change the
-e in the macchanger script to -r.
I have cut steps from the original page, as they are not strictly necessary.
– Rui F Ribeiro
Oct 12 '17 at 9:21
Thanks for the answer, I’ll try it out and let you know if it worked or not :)
– Bashtheparty
Oct 12 '17 at 9:27
I've encountered a problem, but don't know where to post it, as the explanation is a bit long. I'll do my best to explain myself.
– Bashtheparty
Oct 12 '17 at 21:34
I went to create the /etc/network/if-pre-up.d/macchanger file, but it tuns out it already existed, and had content in it (I have no idea why). Here is what it had:
– Bashtheparty
Oct 12 '17 at 21:37
#!/bin/sh # # randomize MAC address before connecting to wifi or ethernet # # This script should always be run in if-pre-up.d, but unfortunately # NetworkManager does not run if-pre-up.d scripts before it sets up a network # connection (bugzilla.gnome.org/show_bug.cgi?id=387832). # if-post-down.d scripts are run, so there is a symlink to this script # there. That means when running network config from the terminal, macchanger # will be run twice, but it'll only be run in if-post-down.d when using # NetworkManager. (continues)
– Bashtheparty
Oct 12 '17 at 21:38
|
show 3 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397566%2frandomizing-mac-address-on-startup-in-linux-mint%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
A more standard way to randomize mac addresses is using macchanger.
Following (roughly) the instructions of the ubuntu wiki: AnonymizingNetworkMACAddresses
Install MACCHANGER
The package macchanger is in the Networking
(universe). Install it.
apt-get install macchanger
Create the Randomizer Trigger
Utilizing Network-Manager's methods to trigger events when a network
interface changes state, place the macchanger script into
/etc/network/if-pre-up.d.
vi /etc/network/if-pre-up.d/macchanger
Don't change $IFACE. It is a
reference provided by NetworkManager for the particular activated
interface.
#!/bin/sh
# Randomize the mac address for the given interface
/usr/bin/macchanger -e "$IFACE"
Make it executable.
chmod +x /etc/network/if-pre-up.d/macchanger
Interface State Change
Now everytime any managed interface is activated, as it passes through
the pre-up phase, the network MAC address will be randomized under the
VENDOR id.
Fully Random
If you desire a completely random MAC address change the
-e in the macchanger script to -r.
I have cut steps from the original page, as they are not strictly necessary.
– Rui F Ribeiro
Oct 12 '17 at 9:21
Thanks for the answer, I’ll try it out and let you know if it worked or not :)
– Bashtheparty
Oct 12 '17 at 9:27
I've encountered a problem, but don't know where to post it, as the explanation is a bit long. I'll do my best to explain myself.
– Bashtheparty
Oct 12 '17 at 21:34
I went to create the /etc/network/if-pre-up.d/macchanger file, but it tuns out it already existed, and had content in it (I have no idea why). Here is what it had:
– Bashtheparty
Oct 12 '17 at 21:37
#!/bin/sh # # randomize MAC address before connecting to wifi or ethernet # # This script should always be run in if-pre-up.d, but unfortunately # NetworkManager does not run if-pre-up.d scripts before it sets up a network # connection (bugzilla.gnome.org/show_bug.cgi?id=387832). # if-post-down.d scripts are run, so there is a symlink to this script # there. That means when running network config from the terminal, macchanger # will be run twice, but it'll only be run in if-post-down.d when using # NetworkManager. (continues)
– Bashtheparty
Oct 12 '17 at 21:38
|
show 3 more comments
A more standard way to randomize mac addresses is using macchanger.
Following (roughly) the instructions of the ubuntu wiki: AnonymizingNetworkMACAddresses
Install MACCHANGER
The package macchanger is in the Networking
(universe). Install it.
apt-get install macchanger
Create the Randomizer Trigger
Utilizing Network-Manager's methods to trigger events when a network
interface changes state, place the macchanger script into
/etc/network/if-pre-up.d.
vi /etc/network/if-pre-up.d/macchanger
Don't change $IFACE. It is a
reference provided by NetworkManager for the particular activated
interface.
#!/bin/sh
# Randomize the mac address for the given interface
/usr/bin/macchanger -e "$IFACE"
Make it executable.
chmod +x /etc/network/if-pre-up.d/macchanger
Interface State Change
Now everytime any managed interface is activated, as it passes through
the pre-up phase, the network MAC address will be randomized under the
VENDOR id.
Fully Random
If you desire a completely random MAC address change the
-e in the macchanger script to -r.
I have cut steps from the original page, as they are not strictly necessary.
– Rui F Ribeiro
Oct 12 '17 at 9:21
Thanks for the answer, I’ll try it out and let you know if it worked or not :)
– Bashtheparty
Oct 12 '17 at 9:27
I've encountered a problem, but don't know where to post it, as the explanation is a bit long. I'll do my best to explain myself.
– Bashtheparty
Oct 12 '17 at 21:34
I went to create the /etc/network/if-pre-up.d/macchanger file, but it tuns out it already existed, and had content in it (I have no idea why). Here is what it had:
– Bashtheparty
Oct 12 '17 at 21:37
#!/bin/sh # # randomize MAC address before connecting to wifi or ethernet # # This script should always be run in if-pre-up.d, but unfortunately # NetworkManager does not run if-pre-up.d scripts before it sets up a network # connection (bugzilla.gnome.org/show_bug.cgi?id=387832). # if-post-down.d scripts are run, so there is a symlink to this script # there. That means when running network config from the terminal, macchanger # will be run twice, but it'll only be run in if-post-down.d when using # NetworkManager. (continues)
– Bashtheparty
Oct 12 '17 at 21:38
|
show 3 more comments
A more standard way to randomize mac addresses is using macchanger.
Following (roughly) the instructions of the ubuntu wiki: AnonymizingNetworkMACAddresses
Install MACCHANGER
The package macchanger is in the Networking
(universe). Install it.
apt-get install macchanger
Create the Randomizer Trigger
Utilizing Network-Manager's methods to trigger events when a network
interface changes state, place the macchanger script into
/etc/network/if-pre-up.d.
vi /etc/network/if-pre-up.d/macchanger
Don't change $IFACE. It is a
reference provided by NetworkManager for the particular activated
interface.
#!/bin/sh
# Randomize the mac address for the given interface
/usr/bin/macchanger -e "$IFACE"
Make it executable.
chmod +x /etc/network/if-pre-up.d/macchanger
Interface State Change
Now everytime any managed interface is activated, as it passes through
the pre-up phase, the network MAC address will be randomized under the
VENDOR id.
Fully Random
If you desire a completely random MAC address change the
-e in the macchanger script to -r.
A more standard way to randomize mac addresses is using macchanger.
Following (roughly) the instructions of the ubuntu wiki: AnonymizingNetworkMACAddresses
Install MACCHANGER
The package macchanger is in the Networking
(universe). Install it.
apt-get install macchanger
Create the Randomizer Trigger
Utilizing Network-Manager's methods to trigger events when a network
interface changes state, place the macchanger script into
/etc/network/if-pre-up.d.
vi /etc/network/if-pre-up.d/macchanger
Don't change $IFACE. It is a
reference provided by NetworkManager for the particular activated
interface.
#!/bin/sh
# Randomize the mac address for the given interface
/usr/bin/macchanger -e "$IFACE"
Make it executable.
chmod +x /etc/network/if-pre-up.d/macchanger
Interface State Change
Now everytime any managed interface is activated, as it passes through
the pre-up phase, the network MAC address will be randomized under the
VENDOR id.
Fully Random
If you desire a completely random MAC address change the
-e in the macchanger script to -r.
edited 4 mins ago
answered Oct 12 '17 at 9:20
Rui F RibeiroRui F Ribeiro
40.7k1479137
40.7k1479137
I have cut steps from the original page, as they are not strictly necessary.
– Rui F Ribeiro
Oct 12 '17 at 9:21
Thanks for the answer, I’ll try it out and let you know if it worked or not :)
– Bashtheparty
Oct 12 '17 at 9:27
I've encountered a problem, but don't know where to post it, as the explanation is a bit long. I'll do my best to explain myself.
– Bashtheparty
Oct 12 '17 at 21:34
I went to create the /etc/network/if-pre-up.d/macchanger file, but it tuns out it already existed, and had content in it (I have no idea why). Here is what it had:
– Bashtheparty
Oct 12 '17 at 21:37
#!/bin/sh # # randomize MAC address before connecting to wifi or ethernet # # This script should always be run in if-pre-up.d, but unfortunately # NetworkManager does not run if-pre-up.d scripts before it sets up a network # connection (bugzilla.gnome.org/show_bug.cgi?id=387832). # if-post-down.d scripts are run, so there is a symlink to this script # there. That means when running network config from the terminal, macchanger # will be run twice, but it'll only be run in if-post-down.d when using # NetworkManager. (continues)
– Bashtheparty
Oct 12 '17 at 21:38
|
show 3 more comments
I have cut steps from the original page, as they are not strictly necessary.
– Rui F Ribeiro
Oct 12 '17 at 9:21
Thanks for the answer, I’ll try it out and let you know if it worked or not :)
– Bashtheparty
Oct 12 '17 at 9:27
I've encountered a problem, but don't know where to post it, as the explanation is a bit long. I'll do my best to explain myself.
– Bashtheparty
Oct 12 '17 at 21:34
I went to create the /etc/network/if-pre-up.d/macchanger file, but it tuns out it already existed, and had content in it (I have no idea why). Here is what it had:
– Bashtheparty
Oct 12 '17 at 21:37
#!/bin/sh # # randomize MAC address before connecting to wifi or ethernet # # This script should always be run in if-pre-up.d, but unfortunately # NetworkManager does not run if-pre-up.d scripts before it sets up a network # connection (bugzilla.gnome.org/show_bug.cgi?id=387832). # if-post-down.d scripts are run, so there is a symlink to this script # there. That means when running network config from the terminal, macchanger # will be run twice, but it'll only be run in if-post-down.d when using # NetworkManager. (continues)
– Bashtheparty
Oct 12 '17 at 21:38
I have cut steps from the original page, as they are not strictly necessary.
– Rui F Ribeiro
Oct 12 '17 at 9:21
I have cut steps from the original page, as they are not strictly necessary.
– Rui F Ribeiro
Oct 12 '17 at 9:21
Thanks for the answer, I’ll try it out and let you know if it worked or not :)
– Bashtheparty
Oct 12 '17 at 9:27
Thanks for the answer, I’ll try it out and let you know if it worked or not :)
– Bashtheparty
Oct 12 '17 at 9:27
I've encountered a problem, but don't know where to post it, as the explanation is a bit long. I'll do my best to explain myself.
– Bashtheparty
Oct 12 '17 at 21:34
I've encountered a problem, but don't know where to post it, as the explanation is a bit long. I'll do my best to explain myself.
– Bashtheparty
Oct 12 '17 at 21:34
I went to create the /etc/network/if-pre-up.d/macchanger file, but it tuns out it already existed, and had content in it (I have no idea why). Here is what it had:
– Bashtheparty
Oct 12 '17 at 21:37
I went to create the /etc/network/if-pre-up.d/macchanger file, but it tuns out it already existed, and had content in it (I have no idea why). Here is what it had:
– Bashtheparty
Oct 12 '17 at 21:37
#!/bin/sh # # randomize MAC address before connecting to wifi or ethernet # # This script should always be run in if-pre-up.d, but unfortunately # NetworkManager does not run if-pre-up.d scripts before it sets up a network # connection (bugzilla.gnome.org/show_bug.cgi?id=387832). # if-post-down.d scripts are run, so there is a symlink to this script # there. That means when running network config from the terminal, macchanger # will be run twice, but it'll only be run in if-post-down.d when using # NetworkManager. (continues)
– Bashtheparty
Oct 12 '17 at 21:38
#!/bin/sh # # randomize MAC address before connecting to wifi or ethernet # # This script should always be run in if-pre-up.d, but unfortunately # NetworkManager does not run if-pre-up.d scripts before it sets up a network # connection (bugzilla.gnome.org/show_bug.cgi?id=387832). # if-post-down.d scripts are run, so there is a symlink to this script # there. That means when running network config from the terminal, macchanger # will be run twice, but it'll only be run in if-post-down.d when using # NetworkManager. (continues)
– Bashtheparty
Oct 12 '17 at 21:38
|
show 3 more comments
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f397566%2frandomizing-mac-address-on-startup-in-linux-mint%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
are you using network manager/wicd/etc or do you connect via /etc/network/interfaces ?
– ivanivan
Oct 11 '17 at 22:12
@ivanivan I’m connecting via network-manager
– Bashtheparty
Oct 11 '17 at 22:52
+1 Been thinking myself of doing that, but have not looked how to do it.
– Rui F Ribeiro
Oct 12 '17 at 9:30