New baremetal install/proper interface not chosen for PNET0 mapping

Before posting something, READ the changelog, WATCH the videos, howto and provide following:
Your install is: Bare metal, ESXi, what CPU model, RAM, HD, what EVE version you have, output of the uname -a and any other info that might help us faster.

Moderator: mike

Post Reply
tjohnson2456
Posts: 9
Joined: Tue Jul 20, 2021 1:19 am

New baremetal install/proper interface not chosen for PNET0 mapping

Post by tjohnson2456 » Wed Nov 23, 2022 6:50 pm

I'm doing a baremetal installation on a Cisco C2200-M4 server with the EVE-NG v5 Pro. It has 4 interfaces on it. 2x 10 gig SFP, and 2x 1 gig copper. I'm using the copper interfaces. Everything works well through the standard Linux installation, I'm creating a bonded interface between 2 of my copper gigabit ethernet ports, and the installation works great. I get all the way to configuring the Management IP for EVE-NG, but, the software is chosing PNET0 which is being mapped to an interface that I am not using. The one I want to use is PNET2 which is mapped to the proper physical interface, even though I would prefer the bonded interface. I did try this with only a single, non-bonded interface during set up, and I get the same issue.

Any thoughts on how to resolve this?

Uldis (UD)
Posts: 5067
Joined: Wed Mar 15, 2017 4:44 pm
Location: London
Contact:

Re: New baremetal install/proper interface not chosen for PNET0 mapping

Post by Uldis (UD) » Tue Nov 29, 2022 9:55 pm

Try this:

To fix all nic, you have to use /opt/ovf/pimarywizard.sh and to choose auto

Then create new file:

grep : /sys/class/net/eth*/address | sed -e 's/.*eth/eth/g' -e 's,/address:,=,' -e 's/://g' -e 's/=/=enx/' -e 's/\(.*\)=\(.*\)/\2=\1/' > /opt/unetlab/nicorder

The edit this file to match your requirement
Sample:
enx000c29709660=eth8
enx000c29709688=eth1
enx000c297096b0=eth2
enx000c2970966a=eth4
enx000c29709692=eth3
enx000c297096ba=eth5
enx000c29709674=eth6
enx000c2970969c=eth7
enx000c2970967e=eth0
enx000c297096a6=eth9

Just check your needs to match ethX(pnetX) with mac

Once your file is created,

create a new file named /etc/udev/rules.d/70-eve-nicorder-net.rules
with content:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{type}=="1", KERNEL=="eth*", RUN+="/opt/unetlab/scripts/nicorder.sh"

Then create file /opt/unetlab/scripts/nicorder.sh

With content:



#!/bin/bash
if [ ! -e /opt/unetlab/nicorder ] ; then \
exit 0
fi

. /opt/unetlab/nicorder


LIVE_ID_NET_NAME_MAC=$(cat /sys/class/net/${!ID_NET_NAME_MAC}/address | sed -e 's/://g' -e 's/^/enx/')



if [ $LIVE_ID_NET_NAME_MAC = $ID_NET_NAME_MAC ] ; then exit 0 ; fi


if [ -n "${!ID_NET_NAME_MAC}" -a "${!ID_NET_NAME_MAC}" != "$INTERFACE" ] ; then \
ip link set $INTERFACE name ${!ID_NET_NAME_MAC}
if [ $? -ne 0 ] ; then \
ip link set $INTERFACE name ${!ID_NET_NAME_MAC}-new
fi
# try set every interfaces
ls -d /sys/class/net/eth* | sed -e 's,.*/,,' | grep new | while read IF
do TIF=$(echo $IF | sed -e 's/-new//')
ip link set $IF name $TIF
done
fi

Make it executable: chmod +x /opt/unetlab/scripts/nicorder.sh

Reboot your server and nic should be ordered

lupus
Posts: 1
Joined: Sat Apr 04, 2020 11:24 pm

Re: New baremetal install/proper interface not chosen for PNET0 mapping

Post by lupus » Wed Feb 01, 2023 10:31 pm

Hi,

I have the same issue. I previously chatted with UD and RUSTY, but still have some questions. In my case pnet0 bridged with wrong interface (eth0) instead of eth4.
To fix all nic, you have to use /opt/ovf/pimarywizard.sh and to choose auto
Do we suppose to have pimarywizard.sh under /opt/ovf/ ? I only have ovfconfig.sh, ovfstartup.sh and ovf.xsl

Ran below command:

Code: Select all

grep : /sys/class/net/eth*/address  | sed -e 's/.*eth/eth/g' -e 's,/address:,=,' -e 's/://g' -e 's/=/=enx/' -e 's/\(.*\)=\(.*\)/\2=\1/' > /opt/unetlab/nicorder
/opt/unetlab/nicorder content is below:
eth0=enxXXXXXXXX
eth1=enxXXXXXXXX
eth2=enxXXXXXXXX
eth3=enxXXXXXXXX
eth4=enxXXXXXXXX
eth5=enxXXXXXXXX

In order to use this file for my case, I believe I need to move eth4 before eth0 ?

create a new file named /etc/udev/rules.d/70-eve-nicorder-net.rules
with content:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{type}=="1", KERNEL=="eth*", RUN+="/opt/unetlab/scripts/nicorder.sh"
I did, then created /opt/unetlab/scripts/nicorder.sh with the content you provided, made it executable and rebooted the server. Nothing changed.

Regards,
You do not have the required permissions to view the files attached to this post.

ecze
Posts: 533
Joined: Wed Mar 15, 2017 1:54 pm

Re: New baremetal install/proper interface not chosen for PNET0 mapping

Post by ecze » Thu Feb 02, 2023 2:59 am

When /opt/unetlab/nicorder is created, edit it and replace eth4 by eth0 and eth0 by eth4

so

eth0=enxXXXXXXXX
eth1=enxXXXXXXXX
eth2=enxXXXXXXXX
eth3=enxXXXXXXXX
eth4=enxXXXXXXXX
eth5=enxXXXXXXXX

become

eth4=enxXXXXXXXX
eth1=enxXXXXXXXX
eth2=enxXXXXXXXX
eth3=enxXXXXXXXX
eth0=enxXXXXXXXX
eth5=enxXXXXXXXX


without touching to order... just edit the eth before the egal sign

Regards,

E.

Post Reply