Magneticore

Development, Operations and Design

  • Articles
  • Resume
  • About Me
  • Contact
  • DevOps
  • Featured
  • Astronomy
  • Portfolio
  • UI/UX
You are here: Home / Articles / Ubuntu Change Network Interface from p2p1 to eth0

Ubuntu Change Network Interface from p2p1 to eth0

August 15, 2014 by Jorge Morales

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

Ubuntu Forums

 

Filed Under: Articles Tagged With: linux, ubuntu

About the author

My name is Jorge Morales and I am an Electronics Engineer by training, a technology starter by choice and Open Source fan.
My curiosity led me to get involved in many areas from Instrumentation, Support, Operations to Development.
Often as a member of multidisciplinary teams, sometimes leading or working as a senior individual contributor.

I spend my time remixing the web Open Source style!
UNAM and Ottawa Startup Weekend Alumni, Co-founder of @YourBookBuddy.
I lead the implementation on Coral platform and production systems at CoralCEA.

Recent Articles

  • Kano Computer for Kids based on Raspberry pi
  • Welcome Home App and Meteor part 2
  • Welcome Home App and Meteor
  • Are we alone in the universe?
  • A new car UI
I'm currently looking for new opportunities. Are you interested, let's chat!

Work with Jorge Now

Previous role

Project Lead at CoralCEA where I led the implementation on Coral platform and Coral's production systems.

 

I’m also in here…

  • Email
  • GitHub
  • LinkedIn
  • Twitter

Copyright © 2025 · Magneticore · My online Resume

Copyright © 2025 · Log in