# Autoconfigure ue0 on device connection



## Nicola Mingotti (Mar 12, 2018)

Hi guys,

Finally I had a day free to do some first tests with my new BeagleBone(s) Green.
I did not change the OS on the BBG for now. I want to make some tests with
Grove stuff on Linux first.

When I first connect the BBG to FreeBSD-11.1 via usb, FreeBSD correctly
shows me in `dmesg`

```
urndis0 on uhub1
urndis0: <RNDIS Communications Control> on usbus1
ue0: <USB Ethernet> on urndis0
ue0: Ethernet address: c8:fd:19:c7:f1:07
```

Good, I can configure "ue0" via `ifconfig` and then `ssh` to the BBG.
Very smooth. It just works.

What I would like to do now is: each time I connect a device with ethernet
address, say "c8:fd:19:c7:f1:07", I wish I could automatically run the ifconfig stuff,
and then run some other scripts.

I have no idea where to look for to achieve this, can you give me some directions ?

bye
Nicola


----------



## SirDice (Mar 12, 2018)

Nicola Mingotti said:


> What I would like to do now is: each time I connect a device with ethernet
> address, say "c8:fd:19:c7:f1:07", I wish I could automatically run the ifconfig stuff,
> and then run some other scripts.


Possible, but you'll have to create some devd.conf(5) rules for it. 

It might be easier to simply use this in /etc.conf:

```
ifconfig_DEFAULT="DHCP"
```
The _DEFAULT will configure the first ethernet interface that's found during boot. But doesn't work if you plugin the device after the BB has booted.


----------



## Nicola Mingotti (Mar 12, 2018)

The devd.conf seems to fit perfectly my needs at first sight ! 
I will study that man page tomorrow. 

The `ifconfig_DEFAULT` is not ideal for my situation, I have a few BeagleBone(s)
and I need to plug them in and out without rebooting my main FreeBSD system.

Thank you again SirDice  !
Bye


----------



## mod3777 (Apr 27, 2019)

Nicola Mingotti said:


> The devd.conf seems to fit perfectly my needs at first sight !
> I will study that man page tomorrow.
> 
> The `ifconfig_DEFAULT` is not ideal for my situation, I have a few BeagleBone(s)
> ...



The actual way to set USB tethering is:
`ifconfig_ue0="SYNCDHCP`
This will assign an IP address at boot time. But I suggest you to statically assign IPs. Life is easier that way.


----------



## Nicola Mingotti (Apr 28, 2019)

mod3777 said:


> The actual way to set USB tethering is:
> `ifconfig_ue0="SYNCDHCP`
> This will assign an IP address at boot time. But I suggest you to statically assign IPs. Life is easier that way.



Umm, I solved the problem last summer. I ensure you devd is enough, it works well.

Your configuration is interesting though, I see what it does here,  but it supposes I want to install a DHCP server on the BBB, which, in general, it is not true.

bye
n.


----------

