WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: change eth0 and eth1 with udev rules  (Read 246 times)

Offline halma

  • Full Member
  • ***
  • Posts: 116
change eth0 and eth1 with udev rules
« 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 ?
1 + 2 = 6  cause  10 - 6 = 78 ;-) lol

Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 5660
Re: change eth0 and eth1 with udev rules
« Reply #1 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.

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 9737
Re: change eth0 and eth1 with udev rules
« Reply #2 on: April 06, 2018, 01:33:50 AM »
Try ifrename as well, it's been mentioned here before.
The only barriers that can stop you are the ones you create yourself.

Offline halma

  • Full Member
  • ***
  • Posts: 116
Re: change eth0 and eth1 with udev rules
« Reply #3 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
« Last Edit: April 06, 2018, 07:22:50 AM by halma »
1 + 2 = 6  cause  10 - 6 = 78 ;-) lol

Online Rich

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 5660
Re: change eth0 and eth1 with udev rules
« Reply #4 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