Linux Commands Examples

A great documentation place for Linux commands

nameif

name network interfaces based on MAC addresses

Synopsis

nameif [-c configfile] [-s]
nameif [-c configfile] [-s] {interface macaddress}


add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!

examples

0
source
            
TEMP=/tmp/nameif.$$
TEMP=/tmp/nameif2.$$
downup() {
local mac=$1
awk '{print $5,$7}' $TEMP | while read oif nif
ifconfig $oif down
nameif $nif $mac 2> $TEMP2
ifconfig $nif up
if [ -h /sys/class/net/$nif/address ]

description

nameif renames network interfaces based on mac addresses. When no arguments are given /etc/mactab is read. Each line of it contains an interface name and a Ethernet MAC address. Comments are allowed starting with #. Otherwise the interfaces specified on the command line are processed. nameif looks for the interface with the given MAC address and renames it to the name given.

When the -s argument is given all error messages go to the syslog.

When the -c argument is given with a file name that file is read instead of /etc/mactab.

files

/etc/mactab

notes

nameif should be run before the interface is up, otherwise it’ll fail.


bugs

Only works for Ethernet currently.

How can this site be more helpful to YOU ?


give  feedback