Angel Tsankov wrote:
Now there is one more thing about the PPPoE connection I would like to
setup - I want to have it established at boot time. As far as I know I
need to have the following files:
1) /etc/sysconfig/network-devices/ifconfig.eth0/pppoe:
ONBOOT="yes"
SERVICE="pppoe"
2) /etc/sysconfig/network-devices/services/pppoe:
#!/bin/sh
. /etc/sysconfig/rc
. $rc_functions
case "$2" in
up)
boot_mesg "Bringing up the PPPoE interface..."
ip link set <ethN> up
pppd call <peername>
evaluate_retval
;;
down)
boot_mesg "Bringing down the PPPoE interface..."
killall pppd
evaluate_retval
;;
*)
echo "Usage: $0 {up|down}"
exit 1
;;
esac
The question is how do I know the value of N in <ethN>.
ethN is passed as the argument to the bootscript and, thus, is accessible as
${1}.
Probably (untested, I have a custom script not using the service model) you can
do the following:
1) Don't specify the network interface name in /etc/ppp/peers/pppoe
2) In the "up" part, run this:
ip link set ${1} up
loadproc -p /var/run/ppp-${1}.pid pppd call pppoe nic-${1} updetach linkname
${1}
No need to evaluate_retval
(the "nic-" prefix is needed so that it works even with network interfaces
renamed to "realtek" or something like that. "updetach" is needed so that you
can be 100% sure that pppd doesn't go into background until establishing the
connection, so that e.g. ntpd could start correctly. "linkname" is for a
predictable pid file name)
3) In the "down" part, it is better to do this:
killproc -p /var/run/ppp-${1}.pid
Again, no need to evaluate_retval
Please report if this works for you with or without modifications.
The other thing I want is to have the PPPoE connection reestablished if
it breaks. Is this automatically handled or do I need to setup smth?
You have to add the following options to /etc/ppp/peers/pppoe:
persist
holdoff 15
lcp-echo-interval 30
lcp-echo-failure 3
This way, pppd will retry in 15 seconds after it knows that the connection
broke. Also, it will send echo requests to the peer every 30 seconds, and
failure to answer 3 requests counts as link failure.
--
Alexander E. Patrakov
--
http://linuxfromscratch.org/mailman/listinfo/blfs-support
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page