Tiny Core Linux

Tiny Core Base => TCB Talk => Topic started by: halma on April 05, 2018, 12:40:22 PM

Title: change eth0 and eth1 with udev rules
Post by: halma on April 05, 2018, 12:40:22 PM
Hi,

is it correct that i can use /etc/udev/rules.d/70-persistent-net.rules to change eth0 to eth1 and eth1 to eth0 or which file is used under TC for doing this ?
Title: Re: change eth0 and eth1 with udev rules
Post by: Rich on April 05, 2018, 01:11:13 PM
Hi halma
You could try:
Code: [Select]
SUBSYSTEM=="net", ATTR{address}=="ab:cd:ef:12:34:56", NAME="eth0"
SUBSYSTEM=="net", ATTR{address}=="65:43:21:fe:dc:ba", NAME="eth1"
That was found here:
https://bbs.archlinux.org/viewtopic.php?id=140029

The  ATTR{address}==  refers to the network adapters  MAC  address.
Title: Re: change eth0 and eth1 with udev rules
Post by: curaga on April 06, 2018, 01:33:50 AM
Try ifrename as well, it's been mentioned here before.
Title: Re: change eth0 and eth1 with udev rules
Post by: halma on April 06, 2018, 07:17:49 AM
Hi Rich and Curaga, my qestion was, what is the correct file name/Stage unter TC for doing this ? sorry for my bad english
Title: Re: change eth0 and eth1 with udev rules
Post by: Rich on April 06, 2018, 08:22:56 AM
Hi halma
As is often the case there can be multiple ways of doing something under Linux. If you don't want to use  udev  you can try adding
this to your  /opt/bootsync.sh  file:
Code: [Select]
# Assign unused names to the network cards
nameif want_eth0 ab:cd:ef:12:34:56
nameif want_eth1 65:43:21:fe:dc:ba

# Assign the desired names to the network cards
nameif eth0 ab:cd:ef:12:34:56
nameif eth1 65:43:21:fe:dc:ba

If your  opt  directory is not persistent, run a backup and reboot. The  nameif  command is the  busybox  version of  renameif.

If you do try the  udev  way you probably need to ad this to your  /opt/bootsync.sh  file:
Code: [Select]
udevadm control --reload-rules
udevadm trigger