Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Trigger conditional reconnect on WAN (PPPoE)

    Scheduled Pinned Locked Moved Development
    1 Posts 1 Posters 280 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      joesl
      last edited by joesl

      Hello everyone,

      I would like to explore the possibility to add a custom script that triggers a reconnection of a PPPoE WAN if the IP received is not of my liking (i.e. if IP is 100.x.x.x then reconnect). I don't think this is possible via the GUI .. but please, feel free to correct me.

      Could someone please point me in the right direction?

      I was thinking of registering a cron to run each minute for a script like:

      #!/bin/bash 
      
      FIRST_IP_OCT=$(ifconfig | grep -A1 "pppoe0:" | tail -1 | awk '{print $2}' | sed 's/\..*//')
      
      if [[ $FIRST_IP_OCT = "100" ]]
      then
      	/usr/local/sbin/ppp-linkdown
      	/usr/local/sbin/ppp-linkup
      fi
      

      This is not tested, but you get the idea.

      Thanks a lot!

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.