Naming PPP interfaces

7,954

Solution 1

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.

Solution 2

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 .)

Share:
7,954

Related videos on Youtube

CallumA
Author by

CallumA

Updated on September 18, 2022

Comments

  • CallumA
    CallumA almost 2 years

    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 "[email protected]"
    

    /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.

  • Milos Ivanovic
    Milos Ivanovic over 7 years
    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.
  • Dan
    Dan over 7 years
    Yeah, that's a good point. I have no idea why it's not been merged upstream :(. Do you happen to know?