NICs devices switches "pshycial" place on each boot (SOLVED)
Warren Block
wblock at wonkity.com
Thu Dec 4 23:36:33 UTC 2014
On Thu, 4 Dec 2014, Martin Hanson wrote:
> I managed to get this working.
>
> It is a dirty hack and I REALLY wish FreeBSD would make documentation
> as high a priority as the guys at OpenBSD.
>
> It is difficult to locate correct and updated documentation, especially
> about devd. Yes, the man page has information about devd, and devd.conf
> even come with examples, but those examples are too sparsome to be of
> any real use when things get just a little bit complicated.
>
> It is extremely frustration to spend hour of hours of wasted time
> getting something to work, not because it doesn't work, but simply
> because you're "throwing stones in the dark" in the hopes of hitting
> the right target - because the correct and comprehensive documentation
> is lacking.
>
> A quality product HAS to have correct, updated and comprehensive
> documentation. This is one point that really makes the OpenBSD guys
> stand out deserving laud applause.
We work at it, but it is difficult to cover everything. It would be
nice to have a section in the Handbook on devd. If you would like to
submit or work on something like that, I can help (I'm a doc committer).
> attach 100 {
> device-name "axge[0-9]+";
> match "vendor" "0x0b95";
> match "product" "0x1790";
> match "sernum" "0000249B0DE00C";
> # We need to wait a little for the interface to get up.
> action "sleep 3";
> # We don't know what number the interface has been assigned, but we know it is from axgeX,
> # so we get the X, use it in "ueX" and then rename the interface which is then bound to the
> # serialnumber, so the correct card will always get the right interface, ie. our own, not ueX.
> action "ifconfig ue`echo $device-name | tr -dc '[0-9]'` name olan";
> action "ifconfig olan inet 192.168.1.1 netmask 255.255.255.0";
> };
>
> I hope someone else might find this useful or perhaps even provide a cleaner approach.
There are several similar ways to deal with the device name. For
example:
action "ifconfig `echo $device-name | sed -e 's/axge/ue/'` name olan inet 192.168.1.1/24";
action "ifconfig ue${device-name##axge} name olan inet 192.168.1.1/24";
(Untested, and sorry about wrapping.) Both examples use the shorter
CIDR notation for the netmask, and set the name and IP address at the
same time... which ought to work, but I did not test.
More information about the freebsd-net
mailing list