From owner-freebsd-net@FreeBSD.ORG Thu Dec 4 23:36:33 2014 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F2E4A67E for ; Thu, 4 Dec 2014 23:36:32 +0000 (UTC) Received: from wonkity.com (wonkity.com [67.158.26.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "wonkity.com", Issuer "wonkity.com" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 98E7F95B for ; Thu, 4 Dec 2014 23:36:32 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.9/8.14.9) with ESMTP id sB4NaNiN096507 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 4 Dec 2014 16:36:23 -0700 (MST) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.9/8.14.9/Submit) with ESMTP id sB4NaNjR096504; Thu, 4 Dec 2014 16:36:23 -0700 (MST) (envelope-from wblock@wonkity.com) Date: Thu, 4 Dec 2014 16:36:23 -0700 (MST) From: Warren Block To: Martin Hanson Subject: Re: NICs devices switches "pshycial" place on each boot (SOLVED) In-Reply-To: <151421417731675@web18h.yandex.ru> Message-ID: References: <1511041417624247@web23g.yandex.ru> <212351417642134@web20h.yandex.ru> <2659291417665100@web17m.yandex.ru> <2704971417669266@web25m.yandex.ru> <20141204180007.Q85722@sola.nimnet.asn.au> <151421417731675@web18h.yandex.ru> User-Agent: Alpine 2.11 (BSF 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (wonkity.com [127.0.0.1]); Thu, 04 Dec 2014 16:36:23 -0700 (MST) Cc: "freebsd-net@freebsd.org" , Ian Smith X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2014 23:36:33 -0000 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.