Subject: Re: "A nick for a NIC" - question and/or feature suggestion...
To: Zbigniew Baniewski <zb@ispid.com.pl>
From: Tobias Nygren <tnn@NetBSD.org>
List: netbsd-users
Date: 05/19/2007 20:32:39
On Sat, 19 May 2007 18:09:57 +0200
Zbigniew Baniewski <zb@ispid.com.pl> wrote:

> I'm not sure: does there exist a possibility to assign kind of ID to network
> interfaces?
> 
> I guess, you all know, what I mean: suppose, I've got in my netbsd-router
> two NICs today: rtk0 and ep0. But tomorrow ep0 - which, for example, is the
> external interface - could be replaced by ex0 (because the motherboard will
> be replaced by different one, where there are no ISA slots). And in such
> case all the config files, where I wrote "ep0", must be updated.
> 
> It could be handy, if I could add to /etc/ifconfig.rtk0 something like:
> 
> LABEL=world_interface
> 
> (never mind the syntax)
> 
> ...and to use in the config files of every program (or f.e. ipf script),
> which wants to access rtk0, a term "world_interface". Is it possible - or
> planned for the (near) future?


I don't think it's _that_ much work involved in s/ep0/ex0/.
How often do you change your interfaces? :-)
But if you really need this, a trick is to use a bridge and attach
a dummy tap interface. Then you can use tap0 in your configuration
files and only change ifconfig.bridge0 when installing a new NIC:

# cat ifconfig.tap0
!sysctl -w net.link.tap.tap0=00:00:f8:06:f2:96
inet 85.8.3.143/24
# cat ifconfig.bridge0 
!brconfig $int add tap0 add hme0 up
# cat ifconfig.hme0    
media 10baset
tcp4csum udp4csum
up

-Tobias