From owner-freebsd-hackers@FreeBSD.ORG Sun Apr 9 00:28:22 2006 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4D2E116A401 for ; Sun, 9 Apr 2006 00:28:22 +0000 (UTC) (envelope-from darren.pilgrim@bitfreak.org) Received: from mail.bitfreak.org (mail.bitfreak.org [65.75.198.146]) by mx1.FreeBSD.org (Postfix) with ESMTP id EC6E843D45 for ; Sun, 9 Apr 2006 00:28:21 +0000 (GMT) (envelope-from darren.pilgrim@bitfreak.org) Received: from [127.0.0.1] (mail.bitfreak.org [65.75.198.146]) by mail.bitfreak.org (Postfix) with ESMTP id BDE7319F2C; Sat, 8 Apr 2006 17:28:20 -0700 (PDT) Message-ID: <44385525.8000203@bitfreak.org> Date: Sat, 08 Apr 2006 17:28:21 -0700 From: Darren Pilgrim User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Mike Meyer References: <20060407225742.GA21619@odin.ac.hmc.edu> <20060407230247.GH16344@submonkey.net> <4437C9F6.5000008@samsco.org> <17463.65076.117616.563302@bhuda.mired.org> <20060408224140.GA15366@outcold.yadt.co.uk> <17464.17494.251794.271711@bhuda.mired.org> In-Reply-To: <17464.17494.251794.271711@bhuda.mired.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: hackers@freebsd.org Subject: Re: Using any network interface whatsoever (solution?) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 09 Apr 2006 00:28:22 -0000 Mike Meyer wrote: > In <20060408224140.GA15366@outcold.yadt.co.uk>, David Taylor typed: >> That doesn't quite work, though. Unless you require everyone wanting >> to distinguish between LAN and WAN interfaces uses different types >> of hardware for each card, they'll still end up with xl0 and xl1 >> (or whatever), which is in no way better than eth0 and eth1, > > You're right - but at least you have the option of using different > types of cards to get different names. I agree that this sucks, but > it's better than nothing. This is a script to rename interfaces based on the MAC address: #!/bin/csh set mac_list = "/etc/MACaddr_list" foreach ifn ( `ifconfig -l link` ) set ifn_mac = "`ifconfig $ifn link | grep ether | cut -d ' ' -f 2`" set ifn_name = "`grep $ifn_mac $mac_list | cut -d ' ' -f 2`" ifconfig $ifn name $ifn_name end Where /etc/MACaddr_list contains entries of the format: 00:00:00:00:00:00 NameLengthMax15 If you add something to /etc/rc.d so that a sh-ified version of this script runs after all interfaces have attached but before any numbering or cloning takes place you can have lines like this in /etc/rc.conf: ifconfig_PublicLAN="inet a.b.c.d/24" That's far better than trying to remember what's on em0. This is an off-the-top-of-my-head, 2-minute solution, largely untested due to present lack of a victim machine. pf doesn't seem to have any issue, but I haven't tested /etc/rc.d/netif, dhclient, wpa_supplicant, interface cloning and other things people do to their network interfaces. An rc-friendly version would probably make use of something like: ifconfig_UsefulName_linkaddr="00:00:00:00:00:00" in /etc/rc.conf rather than a seperate file, but this is just a proof of concept. Comments please!