Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Problem with two identical usb network cards

    Scheduled Pinned Locked Moved Hardware
    12 Posts 4 Posters 1.1k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      Nazar @viktor_g
      last edited by

      @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 output

      Thank 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!

      1 Reply Last reply Reply Quote 0
      • GertjanG
        Gertjan
        last edited by

        @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.

        No "help me" PM's please. Use the forum, the community will thank you.
        Edit : and where are the logs ??

        N 1 Reply Last reply Reply Quote 0
        • N
          Nazar @Gertjan
          last edited by

          @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 &quot;TP-LINK USB 101001000 LAN&quot; | 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 ue1

          Thanks

          1 Reply Last reply Reply Quote 0
          • GertjanG
            Gertjan
            last edited by

            @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 &quot;TP-LINK USB 101001000 LAN&quot; | 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

            No "help me" PM's please. Use the forum, the community will thank you.
            Edit : and where are the logs ??

            N 1 Reply Last reply Reply Quote 0
            • N
              Nazar @Gertjan
              last edited by Nazar

              @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 &quot;TP-LINK USB 101001000 LAN&quot; | 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

              Yes 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 &quot;TP-LINK USB 101001000 LAN&quot; | head -n 1 | cut -c5-7` set_config 1
              		     usbconfig -d `usbconfig list | grep &quot;TP-LINK USB 101001000 LAN&quot; | 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!

              GertjanG 1 Reply Last reply Reply Quote 1
              • GertjanG
                Gertjan @Nazar
                last edited by

                @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.

                No "help me" PM's please. Use the forum, the community will thank you.
                Edit : and where are the logs ??

                1 Reply Last reply Reply Quote 0
                • stephenw10S
                  stephenw10 Netgate Administrator
                  last edited by

                  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

                  N 1 Reply Last reply Reply Quote 1
                  • N
                    Nazar @stephenw10
                    last edited by

                    @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!

                    1 Reply Last reply Reply Quote 0
                    • stephenw10S
                      stephenw10 Netgate Administrator
                      last edited by stephenw10

                      usbconfig dump_device_desc will give you that.

                      Steve

                      N 1 Reply Last reply Reply Quote 1
                      • N
                        Nazar @stephenw10
                        last edited by

                        @stephenw10
                        Thank you Steve

                        All working perfect!

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post
                        Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.