Naming PPP interfaces

I have two PPP peers, dsl-line1 and dsl-line2 which are configured with pppd on Ubuntu (Server) Linux.

They are brought up by the /etc/network/interfaces file with the auto thingy however each PPP connection chooses the name pppX where X varies depending on which comes up first.

I would like to make it such that dsl-line1 comes up with a name such as “dsl0” and dsl-line2 with a name like “dsl1” so that I can create firewall rules more easily for each and set up routing (as well as having it easier to configure).

My question is how can I get the pppd’s interfaces to name themselves?

/etc/ppp/peers/dsl-line1 (dsl-line2 is basically the same apart from the default route being removed and the ethernet interface being different)

#lcp-echo-interval 30
#lcp-echo-failure 4
lcp-echo-interval 10
lcp-echo-failure 3
#mtu 1492
#maxfail 0
#holdoff 20
plugin eth1
user ""

/etc/network/interfaces (the line1 part, again, 2 is very similar)

auto dsl0
iface dsl0 inet ppp
    pre-up /sbin/ifconfig eth1 up # line maintained by pppoeconf
    post-up /bin/sh /home/callum/ # Route everything
    post-up /bin/sh /etc/miniupnpd/ # Start miniupnpd (if not alr$
    provider dsl-line1

Thanks in advance.

Asked By: CallumA


The best bet I found was the “unit” option in the /etc/ppp/peers/… file. This option is an integer which names the interface pppX where X is the int after “unit”.

I ended up just naming the interfaces pppX in /etc/network/interfaces and using “unit” in the peers files to ensure they are named that way.

Answered By: CallumA

The simplest way to do this is to have a script in /etc/ppp/ip-up.d/<script name>.

An example is:

#!/bin/sh -e
# only apply this when a connection to dsl10 has occurred
if [ "X$CALL_FILE" != "Xoptus" ]; then
     exit 0

echo $CALL_FILE is using the ppp device $IFNAME

You can see the full set of variables available in pppd(8) in the section SCRIPTS

Answered By: akumria

While older versions of pppd offer the unit option which @CallumA pointed out:

   unit num
          Sets the ppp unit number (for a ppp0 or ppp1 etc interface
          name) for outbound connections.

… more recent versions of pppd for Linux (e.g. 2.4.7) are patched to offer the ifname option, which allows you to set a totally arbitrary interface name, such as ppp_tunnel or magic0, etc.:

   ifname string
          Set the ppp interface name for outbound connections.
          If the interface name is already in use, or if the name 
          cannot be used for any other reason, pppd will terminate.

As pointed out in the comments, the ifname option is Linux-specific. On Linux, network interfaces can be set to arbitrary names using the SIOCSLIFNAME ioctl. (Example of using this ioctl in the OpenConnect VPN client, which I contribute to.)

I’d guess that it hasn’t been merged upstream because not all operating systems have the ability to set an arbitrary interface name. However, pppd already uses this ioctl on Solaris, so it doesn’t seem like it’d be a huge reach to include the ifname option on supporting platforms.

Answered By: Dan

Here’s a full example of renaming a pppoe connection on ppp0 to eth0 (for script compatibility):

Edit /etc/network/interfaces and set the ppp connection (here named dsl-provider) as:

auto dsl-provider
iface dsl-provider inet ppp
pre-up /bin/ip link set eth0 down
pre-up /bin/ip link set eth0 name eth99
pre-up /bin/ip link set eth99 up # line maintained by pppoeconf
provider dsl-provider

In /etc/ppp/peers/dsl-provider Add the following:

plugin eth99
ifname eth0

Now on boot your ppp0 device will be called eth0 (and your old eth0 has been renamed to eth99).

Answered By: A.Badger

My answer is not exactly about how to change the name but about how to find out the name.

I use it for CentOS 7

setup PPPoE (as root or running with sudo):

yum install rp-pppoe # rp-pppoe-3.11-7.el7.x86_64

Method 1:

/sbin/pppoe-status /etc/sysconfig/network-scripts/ifcfg-ppp4

Link is up and running on interface ppp0

Method 2:

Rename the pid file (PIDFILE=/var/run/ to what we like in the settings file (/etc/sysconfig/network-scripts/ifcfg-ppp4). Now using PID we can find the name pppX

# 02-02-2023
# /bin/bash /sys_script/lan_port4_pppx.bash
# /etc/sysconfig/network-scripts/ifcfg-ppp4
# PIDFILE=/var/run/
if [ -f "$PFILE" ]; then
    # check pppX name
    for ((i=0; i<=100; i++))
    if [ "$pppoe_pid" == "$(</var/run/ppp$" ]; then 
    echo $pppx
    echo "down"
Answered By: snex