Hi all

I wrote a while ago about a pppoe service script that would allow to integrate a pppoe-based network connections nicely into the normal boot sequence of a BLFS system and then manage them by ifup and ifdown.

I now have written such a script (well, I copied the bridge script and made some changes) and as I seem to remember that some people showed a bit of interest in it, I attach it to this mail. It is undoubtedly far from perfect, but it serves my purpose of getting the interface up after reboot without having to do ugly things with cron or rc.iptables.

My /etc/sysconfig/ifconfig.ppp0 now looks as  follows:

ONBOOT="yes"
IFACE="enp1s0"
SERVICE="pppoe"
PPP_IFACE="ppp0"
PEERNAME="iway"
MANAGE_IFACE="yes"

What it does is:
- calling /sbin/modprobe pppoe to ensure pppoe support by the kernel
- calling /sbin/ip link set dev ${IFACE} up, if MANAGE_IFACE="yes"
- calling /usr/sbin/pppd call ${PEERNAME}

It does not do anything that is then part of /etc/ppp/peers/${PEERNAME}, as I really don't know enough about ppp. But I have a customer with a dsl internnet connection.


I'm not asking for inclusion into blfs-bootscripts and also agree with Bruce that pppoe maybe is not the bright future of internet connectivity, I just wanted to share it in case someone has a similar setup.

The  script can just be copied to /lib/services on any recent blfs system.


Bye
Tim

#!/bin/sh
########################################################################
# Begin /lib/services/pppoe
#
# Description : pppoe Boot Script
#
# Authors     : Nathan Coulson - [email protected]
#               Bruce Dubbs - [email protected]
#               Tim Tassonis - [email protected]
#
# Version     : LFS-8.2
#
########################################################################

#ONBOOT="yes"
#IFACE="enp1s0"
#SERVICE="pppoe"
#PPP_IFACE="ppp0"
#PEERNAME="dslprovider"
#MANAGE_IFACE="yes"

. /lib/lsb/init-functions
. ${IFCONFIG}

# Make compatible with older versions of init-functions
unset is_true

is_true()
{
   [ "$1" = "1" ] || [ "$1" = "yes" ] || [ "$1" = "true" ] ||  
   [ "$1" = "y" ] || [ "$1" = "t"   ]
}

if [ -z "${IFACE}" ]; then
   log_failure_msg "IFACE variable missing from ${IFCONFIG}"
   exit 1
fi

if [ -z "${PPP_IFACE}" ]; then
   log_failure_msg "PPP_IFACE variable missing from ${IFCONFIG}"
   exit 1
fi

if [ -z "${PEERNAME}" ]; then
   log_failure_msg "PEERNAME variable missing from ${IFCONFIG}"
   exit 1
fi

case "${2}" in
   up)
      /sbin/modprobe pppoe
      log_info_msg2 "\n"
      if is_true ${MANAGE_IFACE}; then
        log_info_msg "Bringing up the ${IFACE} interface..."
        /sbin/ip link set dev ${IFACE} up
        evaluate_retval
        sleep 2
      fi

      log_info_msg "Calling peer ${PEERNAME}..."
      /usr/sbin/pppd call ${PEERNAME}
      evaluate_retval
   ;;
   
   down)
      log_info_msg "Bringing down the ${PPP_IFACE}..."
      killproc -p /run/${PPP_IFACE}.pid pppd
      if is_true ${MANAGE_IFACE}; then
        log_info_msg "Bringing down the ${IFACE} interface..."
        /sbin/ip link set dev ${IFACE} down
        evaluate_retval
      fi
   ;;
   
   *)
      echo "Usage: ${0} [interface] {up|down}"
      exit 1
   ;;
esac

# End /lib/services/pppoe

-- 
http://lists.linuxfromscratch.org/listinfo/blfs-dev
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page

Reply via email to