Problem with two identical usb network cards
-
Hi.
I am new in pfsense and freebsd. I install pfsense on intel NUC and i use internal network card and second USB TPLINK UE300.
I made usb card working by adding following line in to /cf/conf/config.xml<earlyshellcmd> usbconfig -d `usbconfig list | grep "TP-LINK USB 101001000 LAN" | cut -c5-7` set_config 1 </earlyshellcmd>
All works fine until i found that after some (random) period of time internal network card switch to down. (I tried different custom driver - but that is another story).
So i decide to use Second same external network card unsted of internal.
I did not change config.xml (because it is same usb card)During boot i can see that system recognize two cards .
ugen0.6
ugen0.7However it give me an error:
Finaly after boot it ask me to resign interfaces but it can't see any of two USB
(ue0 ) network cards. Only the integrated card is working - re0.Can any one help me with this.
Thank you!
-
@Nazar It seems that you need to check your
<earlyshellcmd>
script
Try to run it in the console after booting and show the output -
@viktor_g said in Problem with two identical usb network cards:
@Nazar It seems that you need to check your
<earlyshellcmd>
script
Try to run it in the console after booting and show the outputThank you for answer.
Yes i agree that something can be wrong with earlyshellcmd but strange that the same configuration earlyshellcmd works perfect if i disconnect second usb Card and reboot system.
It looks like system is confused because of two identical network cards - can i some how add uniqe name to each one? or may be put two earlyshellcmd in config file with different names?Again i am very new in pfsense.
And about output of shell - should it be usbconfig command?
Thank you! -
@Nazar said in Problem with two identical usb network cards:
earlyshellcmd
is far to late to be off any help.
I did see on this forum that instructions could be placed into the (to be created) /boot/loader.conf.local file.
This (should) helps the kernel to identify and name the devices at boot time. -
@Gertjan said in Problem with two identical usb network cards:
@Nazar said in Problem with two identical usb network cards:
earlyshellcmd
is far to late to be off any help.
I did see on this forum that instructions could be placed into the (to be created) /boot/loader.conf.local file.
This (should) helps the kernel to identify and name the devices at boot time.Well i am using /cf/conf/config.xml file and i insert in to it the line of code:
<earlyshellcmd> usbconfig -d `usbconfig list | grep "TP-LINK USB 101001000 LAN" | cut -c5-7` set_config 1 </earlyshellcmd>
But it's workign well only with one USB TPLINK card. When i connect second (identical) it give me error.
Is the file /boot/loader.conf.local file doing same stuff? I don't have this file on my system
What is the structure of that file and where can i set names of each USB card like ue0 ue1Thanks
-
@Nazar said in Problem with two identical usb network cards:
usbconfig
Your script is probably wrong.
Use some kind of loop that parses the usb devices, to find all devices one by one.Right now, this part
`usbconfig list | grep "TP-LINK USB 101001000 LAN" | cut -c5-7`
return 2 lines when there are two devices and the -d paramter should be a simple argument, not two lines.
See also : https://forum.netgate.com/topic/142932/having-pfsense-recognize-a-usb-ethernet-adapter-at-boot-time
https://forum.netgate.com/topic/83756/help-needed-forcing-usb-device-on-configuration-index-1 -
@Gertjan said in Problem with two identical usb network cards:
@Nazar said in Problem with two identical usb network cards:
usbconfig
Your script is probably wrong.
Use some kind of loop that parses the usb devices, to find all devices one by one.Right now, this part
`usbconfig list | grep "TP-LINK USB 101001000 LAN" | cut -c5-7`
return 2 lines when there are two devices and the -d paramter should be a simple argument, not two lines.
See also : https://forum.netgate.com/topic/142932/having-pfsense-recognize-a-usb-ethernet-adapter-at-boot-time
https://forum.netgate.com/topic/83756/help-needed-forcing-usb-device-on-configuration-index-1Yes that is correct! Thank you.
So i think i found some solution for this problem.
I use folowing code in config.xml file<earlyshellcmd> usbconfig -d `usbconfig list | grep "TP-LINK USB 101001000 LAN" | head -n 1 | cut -c5-7` set_config 1 usbconfig -d `usbconfig list | grep "TP-LINK USB 101001000 LAN" | tail -n 1 | cut -c5-7` set_config 1 </earlyshellcmd>
In this code i used head and tail. First line use first record from the list and the last using last line from list
All working well!Potentially this code may swap network cards around. Am i right? Are they listed strongly in same order?
Is there any better idea how to separate them by
names or some ID?usbconfig list - print two lines with the same names
Thank you!
-
@Nazar said in Problem with two identical usb network cards:
i used head and tail
Great !! Lean, mean, and it does the job in this typical situation.
-
Using a hardware quirk to set those to config index 1 is a much better solution here:
hw.usb.quirk.0="idVendor idProduct 0 0xffff UQ_CFG_INDEX_1"
Add that, with the correct vendor and product IDs, to /boot/loader.conf.local. It will be applied to the device every time it is connected not just at boot.
Steve
-
@stephenw10 said in Problem with two identical usb network cards:
Using a hardware quirk to set those to config index 1 is a much better solution here:
hw.usb.quirk.0="idVendor idProduct 0 0xffff UQ_CFG_INDEX_1"
Add that, with the correct vendor and product IDs, to /boot/loader.conf.local. It will be applied to the device every time it is connected not just at boot.
Steve
Hi Steve. Thanks you for answer!
Can u give me idea how can i get usb network card idVendor and idProduct, please? Is there some command like Get List of all usb idVendors?
Thanks you!
-
usbconfig dump_device_desc
will give you that.Steve
-
@stephenw10
Thank you SteveAll working perfect!