Sometimes, an ethernet interface will install itself as “p1p1″ or the like instead of the traditional “eth0″. Where most of documents related to openstack assume that the default name of NIC is eth* for configuring bridge interface.
It is not a big issue when you follow the document in step by step process. Since, we can just replace the eth0 with our NIC name such as p1p1.
But what if we choose to install openstack using automated script. It become hard to go through entire script to change the default name of NIC with specific new name.
So in that case, it will be better if we have the choice for renaming the NIC .
Renaming the NIC is simple process unless it is ubuntu 14.04. Since, there is a bug reported on renaming the NIC.
So, we need to do some changes in /etc/default/grub to fix this.
I confirm that setting the following to /etc/default/grub will fix the problem:
GRUB_CMDLINE_LINUX_DEFAULT=”net.ifnames=1 biosdevname=0″
followed by
$sudo update-grub
and setup the naming in
/etc/udev/rules.d/70-persistent-net.rules
To setup the naming in 70-persistent-net.rules:
In case of “70-persistent-net.rules” file not found in the /etc/udev/rules.d/ directory, We can regenerate the one using the following steps:
export INTERFACE=p2p1
export MATCHADDR=$(ip addr show $INTERFACE | grep ether | awk '{print $2}')
/lib/udev/write_net_rules
cat /etc/udev/rules.d/70-persistent-net.rules
repeat the above command for all the interface you have, with the appropriate name substitution.
Here’s how to rename your network card in Ubuntu 14.04:
- Get your ethernet card MAC address:
ifconfig | grep HWaddr
keep it handy (open a new Terminal window for following steps)
cd /etc/udev/rules.d
- backup your file:
cp 70-persistent-net.rules 70-persistent-net.rules.bak
- edit your file:
sudo nano 70-persistent-net.rules
- very carefully type:
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="xx:xx:xx:xx:xx:xx", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="p*", NAME="eth0"
where the xx:xx:xx are your MAC HWAddr from Step 1
Type this all as one big long line, then save and exit.
- edit /etc/network/interfaces to refer to eth0 instead of p1p1 or whatever
- $reboot
- login and type
ifconfig to confirm your network adapter is at eth0
Now you should see the new name for your NIC.
Before:
# lshw -businfo -C network
Bus info Device Class Description
===================================================
pci@0000:03:00.0 eth0 network NetXtreme II BCM5709 Gigabit Ethernet
pci@0000:03:00.1 eth1 network NetXtreme II BCM5709 Gigabit Ethernet
pci@0000:04:00.0 eth2 network NetXtreme II BCM5709 Gigabit Ethernet
pci@0000:04:00.1 p1p1 network NetXtreme II BCM5709 Gigabit Ethernet
After:
# lshw -businfo -C network
Bus info Device Class Description
================================================
pci@0000:03:00.0 eth0 network NetXtreme II BCM5709 Gigabit Ethernet
pci@0000:03:00.1 eth1 network NetXtreme II BCM5709 Gigabit Ethernet
pci@0000:04:00.0 eth2 network NetXtreme II BCM5709 Gigabit Ethernet
pci@0000:04:00.1 p1p1 network NetXtreme II BCM5709 Gigabit Ethernet
Cheers,
Vinoth
|