#!/bin/sh #---------------------------------------------------------------------------- # /etc/rc.d/rc470.pppoe_server - configuration of PPPoE-Server # # Creation: 25.02.2006 tobiasw # Last Update: $Id$ #---------------------------------------------------------------------------- case $OPT_PPPOE_SERVER in yes) begin_script PPPoE-Server "starting pppoe-server ..." if [ 0$PPPOE_SERVER_USER_N -eq 0 ] then pppoe_auth=noauth else pppoe_auth=auth for i in $(seq 1 $PPPOE_SERVER_USER_N) do eval user="\$PPPOE_SERVER_USER_${i}_NAME" eval pass="\$PPPOE_SERVER_USER_${i}_PASS" echo "\"$user\" * \"$pass\" *" done >> /etc/ppp/pap-secrets fi session_offset=0 for i in $(seq 1 0$PPPOE_SERVER_N) do eval pppoe_server_dev=\$PPPOE_SERVER_${i}_ETH ip link set dev $pppoe_server_dev mtu 1500 up # set mtu to 1500 eval pppoe_debug=\$PPPOE_SERVER_${i}_DEBUG case "$pppoe_debug" in yes) pppoe_debug='debug' ;; *) pppoe_debug= ;; esac eval pppoe_type=\$PPPOE_SERVER_${i}_TYPE case "$pppoe_type" in daemon) do_modprobe ppp_async pppoe_type= ;; kernel) do_modprobe pppoe pppoe_type='-k' ;; esac eval pppoe_mtu=\$PPPOE_SERVER_${i}_MTU case "$pppoe_mtu" in '') ;; *) pppoe_mtu="mtu $pppoe_mtu" ;; esac eval pppoe_mru=\$PPPOE_SERVER_${i}_MRU case "$pppoe_mru" in '') ;; *) pppoe_mru="mru $pppoe_mru" ;; esac eval pppoe_dns1=\$PPPOE_SERVER_${i}_DNS1 case "$pppoe_dns1" in '') ;; *) pppoe_dns1="ms-dns $pppoe_dns1" ;; esac eval pppoe_dns2=\$PPPOE_SERVER_${i}_DNS2 case "$pppoe_dns2" in '') ;; *) pppoe_dns2="ms-dns $pppoe_dns2" ;; esac eval pppoe_ipv6=\$PPPOE_SERVER_${i}_IPV6 case "$pppoe_ipv6" in ''|no) pppoe_ipv6="noipv6" ;; *) pppoe_ipv6="ipv6 ::1,::2" ;; esac options_file=/etc/ppp/pppoe-server-options-$i cat < $options_file $pppoe_auth $pppoe_debug $pppoe_dns1 $pppoe_dns2 $pppoe_mru $pppoe_mtu $pppoe_ipv6 EOF eval pppoe_local_ip=\$PPPOE_SERVER_${i}_LOCAL_IP eval pppoe_remote_ip=\$PPPOE_SERVER_${i}_REMOTE_IP pppoe-server -I $pppoe_server_dev -L $pppoe_local_ip -R $pppoe_remote_ip -o $session_offset -O $options_file $pppoe_type eval pppoe_sessions=\$PPPOE_SERVER_${i}_SESSIONS : ${pppoe_sessions:=64} session_offset=$((session_offset+pppoe_sessions)) if [ -f /var/run/next_ppp_device ] then ppp_idx=`cat /var/run/next_ppp_device` else ppp_idx=0 fi [ $i -eq 1 ] && net_alias_add pppoe-server ppp$ppp_idx ppp_idx=$((ppp_idx+1)) echo $ppp_idx > /var/run/next_ppp_device done end_script ;; esac