How to automaticaly changing MAC address on linux mint ?
Forum rules
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.
There are no such things as "stupid" questions. However if you think your question is a bit stupid, then this is the right place for you to post it. Please stick to easy to-the-point questions that you feel people can answer fast. For long and complicated questions prefer the other forums within the support section.
Before you post please read how to get help. Topics in this forum are automatically closed 6 months after creation.
-
- Level 3
- Posts: 175
- Joined: Mon Feb 04, 2019 11:57 am
How to automaticaly changing MAC address on linux mint ?
Hi, I need to automate the MAC changing system, so even after reboot computer will use set up MAC and NOT the default one. I'm doing this cause after hardware failure (fire) I have equipment limitations and need to use specific MAC to not change whole configuration.
At the beginning I were using macchanger program to no avail - I could not automate the process (https://community.linuxmint.com/tutorial/view/376). After every restart my card had default address. The only permanent option was to install macchanger with random MAC address option set up at the beginning - MAC was the same after restart but I need manual specific MAC address so it was not an option for me. Then I found some info at kali linux wiki (good documentation - https://wiki.archlinux.org/title/MAC_address_spoofing) but in linux mint, some thing are simply different. I tried SO, SU scripts but there were not working properly.
So... any of you know hot to set up your specific MAC address that will last after restarts, and are set up BEFORE any connections are made (so the MAC is set up on card FIRST and then the card is up, NOT otherwise - cause then card is up using old MAC and you need to turn it off, give proper MAC and then set it up).
Thanks for any input. Tutorials/links are appreciated.
At the beginning I were using macchanger program to no avail - I could not automate the process (https://community.linuxmint.com/tutorial/view/376). After every restart my card had default address. The only permanent option was to install macchanger with random MAC address option set up at the beginning - MAC was the same after restart but I need manual specific MAC address so it was not an option for me. Then I found some info at kali linux wiki (good documentation - https://wiki.archlinux.org/title/MAC_address_spoofing) but in linux mint, some thing are simply different. I tried SO, SU scripts but there were not working properly.
So... any of you know hot to set up your specific MAC address that will last after restarts, and are set up BEFORE any connections are made (so the MAC is set up on card FIRST and then the card is up, NOT otherwise - cause then card is up using old MAC and you need to turn it off, give proper MAC and then set it up).
Thanks for any input. Tutorials/links are appreciated.
- Pjotr
- Level 23
- Posts: 18828
- Joined: Mon Mar 07, 2011 10:18 am
- Location: The Netherlands (Holland) 🇳🇱
- Contact:
Re: How to automaticaly changing MAC address on linux mint ?
Well, apparently it's quite simple to do if you launch Network settings, click on the gear wheel after your network name (SSID), tab Identity. There you can fiddle with "Cloned address".
No idea how well this works nor whether it's persistent across reboots, but it's worth a try, I'd say.
No idea how well this works nor whether it's persistent across reboots, but it's worth a try, I'd say.
Tip: 10 things to do after installing Linux Mint 21.1 Vera
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
Keep your Linux Mint healthy: Avoid these 10 fatal mistakes
Twitter: twitter.com/easylinuxtips
All in all, horse sense simply makes sense.
-
- Level 3
- Posts: 175
- Joined: Mon Feb 04, 2019 11:57 am
Re: How to automaticaly changing MAC address on linux mint ?
@Pjotr I have tried it - it was the first thing I tried, but it's not working - the card is started with default address. Also ifconfig, ip addr, my router etc. show default MAC. I would like the change of MAC to be on lowest level possible (so there is no "I as a separate program set to this, and the other program set it to that, and third program set it again cause default network manager change it to default, and then again... - just set MAC and THEN start network UP - automatically at system start up).
- Midnight True
- Level 4
- Posts: 457
- Joined: Wed Jul 20, 2022 3:23 am
- Location: Pilipinas 🇵🇭
Re: How to automaticaly changing MAC address on linux mint ?
If i may add, have you tried setting
Clone Mac Address
---> Random
? also on IPv4 Settings
---> Method ---> Automatic (DHCP) Addresses only
if you use IPv6 change it as well like on IPv4OS: Linux Mint 21.1 x86_64 Host: VivoBook_ASUSLaptop X415JA 1.0 Kernel: 5.15.0-60-generic DE: Xfce 4.16
"Learning by Trying ... Learning by Failing ... Learning by Doing"
"Learning by Trying ... Learning by Failing ... Learning by Doing"
-
- Level 3
- Posts: 175
- Joined: Mon Feb 04, 2019 11:57 am
Re: How to automaticaly changing MAC address on linux mint ?
@Midnight True hi, no random is not an option for me cause server is configured in a way it need specific MAC. Also I do not use IP6 it is turned off im interested in IP4 only.
I can't believe that you can set up proper custom MAC on linux mint. My acquaintance with arh linux can do it immediately but is way more advanced user and linux mint is more friendly so I prefer to keep it (and thanks to this forum I could configure it as I want to).
I can't believe that you can set up proper custom MAC on linux mint. My acquaintance with arh linux can do it immediately but is way more advanced user and linux mint is more friendly so I prefer to keep it (and thanks to this forum I could configure it as I want to).
- Midnight True
- Level 4
- Posts: 457
- Joined: Wed Jul 20, 2022 3:23 am
- Location: Pilipinas 🇵🇭
Re: How to automaticaly changing MAC address on linux mint ?
Inspamator12 wrote: ⤴Sun Mar 19, 2023 8:58 am @Midnight True hi, no random is not an option for me cause server is configured in a way it need specific MAC.
Xfce

OS: Linux Mint 21.1 x86_64 Host: VivoBook_ASUSLaptop X415JA 1.0 Kernel: 5.15.0-60-generic DE: Xfce 4.16
"Learning by Trying ... Learning by Failing ... Learning by Doing"
"Learning by Trying ... Learning by Failing ... Learning by Doing"
Re: How to automaticaly changing MAC address on linux mint ?
Try creating a file with the same name of the adapter you want to apply the permanent MAC address in the
(replace eth0 with the name of your adapter)
Reboot and check the MAC address with
/etc/network/interfaces.d/
directory and add the following to it:Code: Select all
auto eth0
iface eth0 inet dhcp
hwaddress ether XX:XX:XX:XX:XX:XX
Reboot and check the MAC address with
ifconfig
Linux Mint Una Cinnamon 20.3 Kernel: 5.15.x | Quad Core I7 4.2Ghz | 24GB Ram | 1TB NVMe | Intel Graphics


-
- Level 3
- Posts: 175
- Joined: Mon Feb 04, 2019 11:57 am
Re: How to automaticaly changing MAC address on linux mint ?
@axrusar this does not work for me. At startup there is:
Then
@Midnight True - it works! Thanks! How to do that via command line (terminal), or by script or in /etc/network/interfaces.d/ ?
and it trying to resolve that for 5 min or so.A start job is running for network interface...
Then
is set on/off and again on/off. And when I log in there is no network, and you can choose and start any connection.Network name resolving
@Midnight True - it works! Thanks! How to do that via command line (terminal), or by script or in /etc/network/interfaces.d/ ?
- Midnight True
- Level 4
- Posts: 457
- Joined: Wed Jul 20, 2022 3:23 am
- Location: Pilipinas 🇵🇭
Re: How to automaticaly changing MAC address on linux mint ?
Your welcomespamator12 wrote: ⤴Sun Mar 19, 2023 3:37 pm @Midnight True - it works! Thanks! How to do that via command line (terminal), or by script or in /etc/network/interfaces.d/ ?
OS: Linux Mint 21.1 x86_64 Host: VivoBook_ASUSLaptop X415JA 1.0 Kernel: 5.15.0-60-generic DE: Xfce 4.16
"Learning by Trying ... Learning by Failing ... Learning by Doing"
"Learning by Trying ... Learning by Failing ... Learning by Doing"
Re: How to automaticaly changing MAC address on linux mint ?
I did it on Mint XFCE 20.3 like this and it works:
Have you previously changed any other settings on your network interface that may conflict with this?
Try resetting it, it should work
Have you previously changed any other settings on your network interface that may conflict with this?
Try resetting it, it should work
Linux Mint Una Cinnamon 20.3 Kernel: 5.15.x | Quad Core I7 4.2Ghz | 24GB Ram | 1TB NVMe | Intel Graphics


-
- Level 3
- Posts: 175
- Joined: Mon Feb 04, 2019 11:57 am
Re: How to automaticaly changing MAC address on linux mint ?
@Midnight True, sorry but after few restarts, it stop working.
@axrusar thanks for the screen, I has set it up exactly like you to no avail.
I try to set everything to default, check if programs are uninstalled correctly (my guess is that some macchanger scripts are still interfere with network setups), and try to set up everything again.
EDIT: ok, so remove simply not works with some of network mutating programs you need to use purge. Also you need to clear cache of your arp table and check it if its ok AND then restart you system.
So after restart the @Midnight True solution is working. Now I'm gonna check again if @axrusar idea is working.
EDIT2: no it's not...
I also disable IP6 in Network Settings, but
EDIT3: I have manage to disable IPv6!
simply typing does not work! Cause my PC doesn't load /etc/sysctl.conf at boot time and disabling IPv6 from grub is needed (https://askubuntu.com/a/337736) - simply add to GRUB_CMDLINE_LINUX_DEFAULT.
I still do not know why @axrusar solution does not work for me...
@axrusar thanks for the screen, I has set it up exactly like you to no avail.
I try to set everything to default, check if programs are uninstalled correctly (my guess is that some macchanger scripts are still interfere with network setups), and try to set up everything again.
EDIT: ok, so remove simply not works with some of network mutating programs you need to use purge. Also you need to clear cache of your arp table
Code: Select all
ip -s -s neigh flush all
Code: Select all
arp -n
So after restart the @Midnight True solution is working. Now I'm gonna check again if @axrusar idea is working.
EDIT2: no it's not...
I also disable IP6 in Network Settings, but
,ifconfig
are still showing if as on. The wired connection has properlyip addr
so it is turned off, but wireless has always some IP6 address...inet6 ::1
EDIT3: I have manage to disable IPv6!
simply typing
Code: Select all
net.ipv6.conf.all.disable_ipv6 = 1
Code: Select all
ipv6.disable=1
I still do not know why @axrusar solution does not work for me...
Re: How to automaticaly changing MAC address on linux mint ?
Please post a screenshot like i did with the ifconfig output, and the file with the code in thespamator12 wrote: ⤴Mon Mar 20, 2023 8:41 am I still do not know why @axrusar solution does not work for me...
/etc/network/interfaces.d/
directory.Also your system info report (inxi -Fznxxx).
Note that the solution i provided works on ethernet adapters, i did not test on wifi ones. Which one are you trying to setup?
Linux Mint Una Cinnamon 20.3 Kernel: 5.15.x | Quad Core I7 4.2Ghz | 24GB Ram | 1TB NVMe | Intel Graphics


-
- Level 3
- Posts: 175
- Joined: Mon Feb 04, 2019 11:57 am
Re: How to automaticaly changing MAC address on linux mint ?
@axrusar that explains a lot. I'm using this to set up wifi adapter (WLAN). My LAN (cable) is not connected.
Anyway, the 5min wait till system set up is weird.
Anyway, the 5min wait till system set up is weird.