# /etc/conf.d/net: Changing interface name *and* MAC - paradox

## Jarjar

Is this possible? I want to change the MAC of one of my NICs, to, say 11:22:33:44:55:66, and at the same time rename the interface from eth*, which of course is done based on the MAC address. Chicken and the egg.

Is this possible?

In which order are mac_ethX=665544332211 and rename_112233445566=newname "executed"?

I currently have this:

 *Quote:*   

> 
> 
> rename_001D7DC7D923="lan"
> 
> rename_00105A01EB3C="net"
> ...

 

... and would like to change the MAC of the net interface, and have it persistent across reboots. (Without actually rebooting now, though.)

Any advice?  :Smile: 

----------

## Mad Merlin

You should be able to rename your NIC with udev (based on the MAC at boot time), see /etc/udev/rules.d/70-persistent-net.rules. Your network scripts would run after, and then you can change the MAC address.

----------

## Inodoro_Pereyra

 */etc/conf.d/net.example wrote:*   

> # MAC changer
> 
> # To set a specific MAC address
> 
> #mac_eth0="00:11:22:33:44:55"

 

Add that to your /etc/conf.d/net file, remove or rename the file/content of /etc/conf.d/rules.d/70-persistent-net-rules and have udev restart the network subsystem:

```
udevadm --trigger net
```

Again, rename the network interface in 70-persistent-net-rules to net.whatever and create a proper symlink:  /etc/init.d/net.wathever -> /etc/init.d/net.lo.

Stop net.eth0, start net.whatever.

Theoretically, that will change your net.X to net.Y without rebooting (never tryed myself).

Also:

```
ifconfig eth0 hw ether AA:BB:CC:DD:EE:FF
```

Changes the mac address in real time in case you didn't know that.

Cheers!

----------

## Jarjar

Thanks guys, it works great! Well, not so great as I'd hoped, as my end goal didn't work out... Everything I asked for here did, though.  :Smile: 

/etc/udev/rules.d/70-persistent-net.rules

```

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:10:5a:aa:bb:cc", ATTR{type}=="1", KERNEL=="?*", NAME="net"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1d:7d:xx:yy:zz", ATTR{type}=="1", KERNEL=="?*", NAME="lan"

```

Then run

```

$ udevadm trigger net    # no --trigger

```

That should take care of device naming. Next up, MAC changing, as easy as in my initial post (see net.example for details).

/etc/conf.d/net

```

mac_net="00:10:5a:cc:dd:ee"

```

----------

