# ifconfig on startup fails because usb ethernet adapter is not initialized yet



## soupdiver (Dec 22, 2020)

I have an ethernet adapter connected via usb-c. I added my `ifconfig_ue0=""` to /etc/rc.conf but it doesn't work because the USB devices are loaded afterwards.
Is there a way to create a dependency or delay startup or so?


----------



## Phishfry (Dec 22, 2020)

Check out the netwait feature. It is an rc.d script that can be enabled.





						⚙ D4608 Enhance rc.d/netwait script to wait for late-attaching interfaces such as USB NICs.
					






					reviews.freebsd.org
				




An example that uses IP address. You can also use device node ue0





						Netwait on FreeBSD – The Blog
					






					blog.danielisz.org


----------



## George (Dec 23, 2020)

You could put an `ifconfig` command in your ~/.login or .cshrc file or in your window managers autostart file.


----------



## soupdiver (Dec 23, 2020)

soupdiver said:


> I have an ethernet adapter connected via usb-c. I added my `ifconfig_ue0=""` to /etc/rc.conf but it doesn't work because the USB devices are loaded afterwards.
> Is there a way to create a dependency or delay startup or so?


I tried to add netwait to my rc.conf but with little success.
This is the output of `dmesg -a | grep ue0`

```
dmesg -a | grep ue0
ue0: <USB Ethernet> on ure0
ue0: Ethernet address: 58:ef:68:7f:a3:d8
ue0: link state changed to DOWN
Starting Network: ue0.
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ue0: link state changed to UP
ue0: link state changed to DOWN
ue0: link state changed to UP
ue0: link state changed to DOWN
ue0: promiscuous mode enabled
ue0: link state changed to UP
ue0: promiscuous mode disabled
ifconfig: BRDGADD ue0: No such file or directory
ue0: <USB Ethernet> on ure0
ue0: Ethernet address: 58:ef:68:7f:a3:d8
ue0: link state changed to DOWN
Starting Network: ue0.
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
Waiting for ue0, interface present
ue0: link state changed to UP
ue0: promiscuous mode enabled
ifconfig: BRDGADD ue0: No such file or directory
ue0: <USB Ethernet> on ure0
ue0: Ethernet address: 58:ef:68:7f:a3:d8
ue0: link state changed to DOWN
Starting Network: ue0.
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
Waiting for ue0, interface present
ue0: link state changed to UP
ifconfig: BRDGADD ue0: No such file or directory
ue0: <USB Ethernet> on ure0
ue0: Ethernet address: 58:ef:68:7f:a3:d8
ue0: link state changed to DOWN
Starting Network: ue0.
ue0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
ue0: link state changed to UP
ue0: promiscuous mode enabled
```
It seems the devices comes up and down multiple times and two times I can see an error when it tries to add the device to the bridge. The last time however there is no error but the device is not added to the bridge.
I also wonder what this ure0 device is.


```
ure0 on uhub1
ure0: <Belkin Belkin USB-C LAN, class 0/0, rev 3.00/30.00, addr 1> on usbus1
```
Not sure what this tells me.

> You could put an ifconfig command in your ~/.login or .cshrc file or in your window managers autostart file.

It's intended to run on a server without anyone to login. Not sure this will work then.


----------



## ta0kira2 (Dec 25, 2020)

soupdiver said:


> It's intended to run on a server without anyone to login. Not sure this will work then.


Take a look at `netwait_if` in rc.conf(5). Alternatively, it's very simple to create your own rc.d script to handle this; see Practical rc.d scripting in BSD or just copy something from /etc/rc.d.


----------



## Phishfry (Dec 25, 2020)

soupdiver said:


> ifconfig_ue0=""


Maybe you need to point to the ure(4) driver instead and start it up in /boot/loader.conf:
if_ure_load="YES"
This should load a driver blob.


Plus you _might_ need to adjust your rc.conf to use the ure interface..
ifconfig_ure0="DHCP"


----------



## soupdiver (Dec 28, 2020)

Thanks for the input!
I changed my plan and ditched the USB ethernet completely. Not sure why but running pppoe over that usb ethernet interface maxed out at around 100Mbit/s even if the dongle managed to easily transfer 1GBit/s when used in a "normal" network scenario.

> Take a look at netwait_if in rc.conf(5). Alternatively, it's very simple to create your own rc.d script to handle this; see Practical rc.d scripting in BSD or just copy something from /etc/rc.d.

I guess I would have done something like that.

> Maybe you need to point to the ure(4) driver instead

I think I tried that but that also did not work. It was not recognized as a network interface. Only ue0 was but on startup it was toggled on/off a couple of times every time.


----------



## Phishfry (Dec 28, 2020)

soupdiver said:


> ditched the USB ethernet completely


Good move. I don't know about your virtualized pfSense plan though.
The Intel NUC is great but you are really asking alot from it.
That platform is best at desktops and multimedia. Not a router.


----------

