Skip to content

Instantly share code, notes, and snippets.

@hijak
Created October 31, 2013 14:34
Show Gist options
  • Save hijak/7250826 to your computer and use it in GitHub Desktop.
Save hijak/7250826 to your computer and use it in GitHub Desktop.
Ethernet Nic Name Remapping
###For RedHat distros
lspci -vv | grep 'Ethernet\|Serial' | awk 'NR == 1{ printf $1 } NR == 2 { print " mac " $7 }' | sed –e 's/-/:/g' -e 's/:f[ef]:f[ef]//g' -e 's/01:00.0/eth0/g' -e 's/01:00.1/eth1/g' -e 's/01:00.2/eth2/g' -e 's/01:00.3/eth3/g' > /etc/iftab && ifrename
###For Debian distros
lspci -vv | grep 'Ethernet\|Serial' | awk 'NR == 1{ printf $1 } NR == 2 { print $7 }' | sed –e 's/-/:/g' -e 's/:f[ef]:f[ef]//g' -e 's/01:00.0/eth0/g' -e 's/01:00.1/eth1/g' -e 's/01:00.2/eth2/g' -e 's/01:00.3/eth3/g' > /etc/mactab && nameif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment