how to get the enumarated network interface name via command line

Hi I am new to FreeBSD,

My setup is :
I am having FreeBSD 12.0 HOST and BMC(Baseboard mgmt. Controller), both are connected via USB to Ethernet Interface,
if I issue an ipmi command from HOST, usb to Ethernet interface gets enumerated in host side as "ue0" ( for now).

  1. Is there a way to get this name(ue0) using a script, using which (script) I should be able to tell this is the specific name of the interface that is enumerated.
  2. Or, is there a way to fix this interface name to ue0 always.

please suggest,
Thanks
 
I don't know if that is what you need, but ifconfig(8) will list your network interfaces when given -l (lowercase L) command-line switch: ifconfig -l. Perhaps it is better do describe what are you trying to do and why. Also, which package/port did you get ipmi from?
 
I don't know if that is what you need, but ifconfig(8) will list your network interfaces when given -l (lowercase L) command-line switch: ifconfig -l. Perhaps it is better do describe what are you trying to do and why. Also, which package/port did you get ipmi from?
at regular intervals communication between BMC and HOST will happen using an automated script/bin
in that script/bin , I need to bringup the USB nic using ipmitool command(which is working )
I need to assign an Ip address to that particular USB to Ethernet Interface as soon as it is up(manually works), else communication between BMC and HOST won't happen,
I can not use mac based because , there are many machines like this, so mac keeps changing for each USB to Ethernet.
 
I don't understand your issue

ue stands for driver for USB to Ethernet ASIX chips based nic (the most used USB chips of the market, Apple Belkin, many others use also ASIX )

As far as you connect only one ASIX based USB NIC, the name of the controller will be always ue0, and nothing other... what is the problem ?
If you connect several ASIX based USB NICS, so problems may arise and nic will be enumerated ue0, ue1, ue2.... according to the ranking order of connection...

If this causes an issue with possible conflicting NICs names, there is no other way than writing a configuration script that enumerates interfaces, and according to their hardware mac addresses, renames the interface with a specific name.

This is what I do with my home made configuration script. Some of my computer can have several nic interfaces, and I want to use a common script for various plateforms.

To assign to a specific interface the upstream link (connection to Internet) based on an identified MAC address, the script scan the hardware mac addresses, and when it gets the good one, the script rename the physical corresponding interface into a specific name and add this interface to a specific interface group as "if_upsteam". Further, packet filter firewall refers to this interface group "if_upstream" to refers to the Upstream link, so from computer to computer, i can use exactly the same Packet Filter configuration file as if_upstream is defined dynamically, and can be changed also dynamically further.

USB Nic can be not present at boot... so I use ifconfig command to dynamically assign it to the interface group if_upstream

This is not so simple to do... that requires to dig in Bourn Shell, but frankly I am not sure at all you want to connect more than one USB ASIX nic....
thanks for your reply,
Perhaps you can tell devd(8) to run your script when this internal network interface goes up? See devd.conf(5).

thanks for that ,
but how to know the Interface name if it is ue1 or ue0 etc ..
 
Well, there is no reliable way to tell which interface is which. Normally the numbers are assigned in the order they're probed, but since USB can be hot-plugged any time, the probe order can be different, and so the numbering of the interfaces may vary.

One way to solve the problem would be to record all the MAC addresses of your ue NICs in a text file. Then your script could look up the MAC address in that text file.

If that's not feasible, the only way is to probe the networks connected to the interfaces. That is, first get the list of interfaces from the output of ifconfig -l. Then, for each interface, configure it and try to ping a known IP address (or try a DHCP broadcast, or whatever will work for your situation). If it succeeds, use that interface. If it fails, unconfigure it and try the next one. Once you found out the correct interface, you probably save its MAC address somewhere in a file, so you don't have to do all the probing again next time the script runs.
 
Back
Top