0

Predictable network interfaces on the raspberry by are usually set via sudo raspi-config -> enable predictable network interfaces. Is there a way to enable this option programmatically? I have a shell script that initializes the raspberry pi which should also enable said option.

glades
  • 3,778
  • 1
  • 12
  • 34

2 Answers2

1

By quickly looking in the source code at line 1866 I found the do_net_names function. Here's a snippet of code you might want to work with:

if [ $RET -eq 0 ]; then
  sed -i $CMDLINE -e "s/net.ifnames=0 *//"
  rm -f /etc/systemd/network/99-default.link
  STATUS=enabled
elif [ $RET -eq 1 ]; then
  ln -sf /dev/null /etc/systemd/network/99-default.link
  STATUS=disabled
else
  return $RET
fi
DadiBit
  • 769
  • 10
  • 22
  • 1
    Thank you for posting that link! I figured I could just do ```sudo raspi-config do_net_names 0``` to enable predictable names. – glades Mar 26 '21 at 16:01
0

The correct command is actually... $ sudo raspi-config nonint do_net_names 0

Without the nonint parameter the UI is engaged when raspi-config executed.