Monday, August 08, 2022

Re: Making pppoe more resiliant to outages?

On Mon, 8 Aug 2022 11:50:32 +0000
Felix Hanley <felix@userspace.com.au> wrote:

> I added an ifstatd config which seems to work and the ISP sees it as a
> disconnection and then reconnection:
>
> $ cat /etc/ifstated.conf
> init-state offline
>
> ppp_up = "pppoe0.link.up"
>
> ping_ok = '"ping -q -c 2 -w 2 8.8.4.4 >/dev/null 2>&1" every 10'
>
> state connected {
> init {
> run "logger -st ifstated 'ppp connected'"
> }
> if $ping_ok {
> set-state online
> }
> if ! $ppp_up {
> set-state disconnected
> }
> }
>
> state disconnected {
> init {
> run "logger -st ifstated 'ppp disconnected'"
> run "ifconfig pppoe0 down"
> run "sh /etc/netstart pppoe0"
> }
> if $ppp_up {
> set-state connected
> }
> }
>
> state online {
> init {
> run "logger -st ifstated 'ppp online'"
> }
> if ! $ping_ok {
> set-state offline
> }
> if $ping_ok {
> run "rcctl restart unbound"
> }
> }
>
> state offline {
> init {
> run "logger -st ifstated 'ppp offline'"
> }
> if $ping_ok {
> set-state online
> }
> if ! $ping_ok {
> set-state disconnected
> }
> }
>
> In hindsight is seems very hackish but like yourself it was driving me
> nuts. I may now try the other suggestion on this thread.

Aye, like a steering wheel in the groin, this is driving me nuts too.

That said, that script of yours looks _very_ handy. I was using a
`cron` job every minute to scrape `ifconfig` output with `sed` to
determine whether the link was up or down… I will have a look at
`ifstated` as that looks like a much better solution.
--
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
...it's backed up on a tape somewhere.

No comments:

Post a Comment