5

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)

noipdefault
defaultroute
replacedefaultroute
hide-password
#lcp-echo-interval 30
#lcp-echo-failure 4
lcp-echo-interval 10
lcp-echo-failure 3
noauth
persist
#mtu 1492
#persist
#maxfail 0
#holdoff 20
plugin rp-pppoe.so eth1
user "xxxx@xxxx.xxx"

/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/ppp0_up.sh # Route everything
    post-up /bin/sh /etc/miniupnpd/ppp0_up.sh # Start miniupnpd (if not alr$
    provider dsl-line1

Thanks in advance.

8

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. My guess is that it hasn't become merged upstream because not all operating systems have the ability to set an arbitrary interface name. (On Linux the interface name is set with the SIOCSLIFNAME ioctl .)

2
  • 1
    Note that this parameter is not found in the official pppd sources; it is added via a patch that's only available in certain Linux distributions. – Milos Ivanovic Jan 14 '17 at 15:36
  • Yeah, that's a good point. I have no idea why it's not been merged upstream :(. Do you happen to know? – Dan Jan 14 '17 at 18:46
3

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.

0

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
fi

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

0

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 rp-pppoe.so eth99
ifname eth0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.