Here is the situation:
I just installed Ubuntu Server 14.04 and then noticed a change when it ask me to configure the network.
Instead of the traditional “eth0” and “eth1” I had “p2p1” and “p2p2”
My first question was: What is p2p1 mean?
Servers often have multiple Ethernet ports, either embedded on the motherboard, or on add-in PCI cards.
Linux has traditionally named these ports ethX, but there has been no correlation of the ethX names to the chassis labels – the ethX names are non-deterministic. Starting in your brand new Linux distribution, Ethernet ports will have a new naming scheme corresponding to physical locations, rather than ethX.
Ethernet ports embedded on server motherboards will be named em<port_number>, while ports on PCI cards will be named p<slot_number>p<port_number>, corresponding to the chassis labels.
Additionally, if the network device is an SR-IOV Virtual Function or has Network Partitioning (NPAR) capability, the name will have a suffix of _<virtual_function> or _.
Second question was: How do I fix it?
First we need to pass some parameters at the booting sequence so launch your favorite editor and open the following file /etc/default/grub
$server> vi /etc/default/grub
Look for the line GRUB_CMDLINE_LINUX_DEFAULT and add the following:
GRUB_CMDLINE_LINUX_DEFAULT="net.ifnames=1 biosdevname=0"
Now if you want to lock the interface with its correspondent name based on the mac address you can create or modify the file:
/etc/udev/rules.d/70-persistent-rules
But first we need to know the MAC address or Hardware Address
$server> ifconfig
Take note of the content of HWaddr (MAC Address)
p2p1 Link encap:Ethernet HWaddr 1F:2E:19:10:3B:52
inet addr:192.168.0.10 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
....
....
p2p2 Link encap:Ethernet HWaddr 1F:2E:19:10:3B:53
Launch your text editor:
$server> vi /etc/udev/rules.d/70-persistent-rules
Then add accordingly:
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="1F:2E:19:10:3B:52 ", NAME="eth0"
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="1F:2E:19:10:3B:53", NAME="eth1"
Or if you rather something else than ethX
SUBSYSTEM=="net", ACTION=="add", ATTR{address}=="1F:2E:19:10:xx:xx", NAME="lan0/wan0"
Configure the IP address for your network:
$server /etc/network/interfaces
In my case from this:
auto p2p1
iface p2p1 inet static
address 192.168.0.10
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 173.195.48.97
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 8.8.8.8
To
auto eth0
iface eth0 inet static
address 192.168.0.10
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 173.195.48.97
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 8.8.8.8
Restart and voila!
Links:
http://fedoraproject.org/wiki/Features/ConsistentNetworkDeviceNaming