Forums

Resolved
0 votes
I need to change my MACADDR and in the past one would just add MACADDR=NewMac to the ifcfg-eth0 file. In ClearOS7.6, that file name has changed a bit.

I did change my MAC using MACADDR in this file, it did in fact change the MAC when I did an an interface Down and Up command and it was there when I did an ifconfig to check it. But when I look at my ifcfg-enp2s0, "MACADDR=" is not there and it, the MACADDR change did not 'stick' after a reboot.

How do we make this stick for multiple reboots? Where did my setting go?

John
Monday, June 24 2019, 05:35 PM
Share this post:

Accepted Answer

Tuesday, June 25 2019, 08:03 AM - #Permalink
Resolved
0 votes
Unfortunately, ClearOS regularly overwrites the file and you will lose your changes, which you have found out There is an outstanding feature request for this but I don't know when it will be implemented. In the meanwhile, you can block the file from being overwritten by setting the immutable bit on it with the command:
chattr +i {filename}
If you ever need to make changes, you must remember to unset the immutable bit with a:
chattr -i {filename}
The reply is currently minimized Show
Responses (6)
  • Accepted Answer

    Friday, June 28 2019, 04:52 AM - #Permalink
    Resolved
    0 votes
    Nick, YOU are the man!! I Love it! I will give it a try and after reading everything and looking at the code it seems as htough it will work well. I will let you know in a few days!

    John

    PS.. THANK-YOU SIR! And the feature request.
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, June 26 2019, 09:01 PM - #Permalink
    Resolved
    0 votes
    There may be another way round this which is safe and repeatable and won't ever get stomped on. I bumped into this post and it gave me an idea. The commands:
    ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
    macchanger-ng --mac xx:xx:xx:xx:xx:xx eth0
    ip link set eth0 address xx:xx:xx:xx:xx:xx
    Need to be run when networking is down. You only need one of them, so let's use the ifconfig one.

    If you don't have one, create a file /usr/sbin/ifup-pre-local and make it executable. In it put:
    if [ "$1" == 'eth0' ]; then
    ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
    fi
    Obviously change eth0 and the MAC address to suit.

    Once you have created the file, to test do:
    ifdown eth0 && ifup eth0


    The /usr/sbin/ifup script is already set to call /usr/sbin/ifup-pre-local, if it exists, before it does the business of bring up the interface
    Like
    1
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, June 26 2019, 04:31 PM - #Permalink
    Resolved
    0 votes
    Forum request and now a feature request
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, June 26 2019, 07:31 AM - #Permalink
    Resolved
    0 votes
    If you want a real kludge, edit /usr/clearos/apps/network/libraries/Iface.php and in the save_dhcp_config function at around line 1737 add:
            if ($this->iface == 'enp0s10')
    $info['MACADDR'] = '11:22:33:44:55:66';
    Obviously replace enp0s10 with the device you want to fix and the MACADDR with your desired MACADDR.

    Although this works you are at risk of an update to app-network. I know there is one coming but it is waiting a code merge and testing and after that I'll be updating it again for PPPoE. In yum.conf you could try blocking updates to app-network* if this is critical or you'd need to monitor for changes.

    It may be easier to ask your ISP.
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, June 26 2019, 02:17 AM - #Permalink
    Resolved
    0 votes
    WOW! and BUMMER!

    Locking eth0 down really disables quite a few modules with "oops. Invalid interface!" Including DMZ and 1 to 1 NAT, AND IP Settings, (obviously), and more! A lot of cable companies may not be relying on MACs behind their modems that much anymore, but I know, or believe, my ISP DHCP assigned static address is linked to my router/gateway's MAC.

    I am really disappointed, (not that one user being disappointed will really matter), having used Clear since way back when good ol' ClarkConnect. I am a bit chicken to remove my MAC setting and see what happens.... but probably will.

    I truly hope that one can someday easily configure a MAC address and have things work. Clear... PLEASE?!

    On the bright side, absolutely no issues in moving a couple ClearOS 6.9 boxes to 7.6.

    John
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, June 25 2019, 03:50 PM - #Permalink
    Resolved
    0 votes
    Thanks again Nick!

    If I heard nothing on this issue, I was going to try to just make the file read-only for all... Not certain if that is what is called the immutable bit, but doing so would server the same purpose I suppose.

    Still have a few things to go in ClearOS! Weird change and it should only be rewritten, IMHO, when you set/change the parameters/settings of the NIC/Interface.

    Thanks!

    John
    The reply is currently minimized Show
Your Reply