Date: Sat, 08 Apr 2006 17:28:21 -0700 From: Darren Pilgrim <darren.pilgrim@bitfreak.org> To: Mike Meyer <mwm-keyword-freebsdhackers.102a7e@mired.org> Cc: hackers@freebsd.org Subject: Re: Using any network interface whatsoever (solution?) Message-ID: <44385525.8000203@bitfreak.org> In-Reply-To: <17464.17494.251794.271711@bhuda.mired.org> References: <C05CAC06.C0BD%ceri@submonkey.net> <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>
next in thread | previous in thread | raw e-mail | index | archive | help
Mike Meyer wrote: > In <20060408224140.GA15366@outcold.yadt.co.uk>, David Taylor <davidt@yadt.co.uk> 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!
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44385525.8000203>