Skip to content

filipnet/routeros-pppoe-status

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

RouterOS Compatible ROSv6 Supported ROSv7 Supported

PPPoE Connection Status RouterOS Script

RouterOS PPPoE Status Logo

This script, designed for network administrators, retrieves and exports detailed information about the PPPoE client connection status on a RouterOS device. It includes parameters such as status, remote IP address, access concentrator name, AC MAC, MTU, MRU, connection time, and more. The script saves the output to a file on the RouterOS device, providing a simple way to monitor PPPoE connections.

Table of Contents

Overview

This script connects to the PPPoE client on a RouterOS device, collects connection status data, and formats it into a structured plaintext output. The data is written into a .txt file, which can be easily reviewed or transferred for further analysis.

This tool is useful for network administrators who need to monitor and log PPPoE connection status information on RouterOS devices.

Requirements

Before running the script, ensure that you have the following:

  • A MikroTik RouterOS device running version 6.45 or later (or a compatible version that supports the required scripting features).

Before running the script, ensure that you have the following:

  • A MikroTik RouterOS device.
  • Administrative access to the RouterOS device via Winbox, SSH, or WebFig.
  • Basic understanding of MikroTik RouterOS scripting.

The script uses the RouterOS scripting environment, which is native to MikroTik devices and does not require any additional software installation on your local machine.

Installation

To install the script on your RouterOS device, follow these steps:

Note: Ensure that the user account used to run the script has sufficient permissions to access PPPoE client details and manage files on the RouterOS device. Administrative privileges are recommended. To install the script on your RouterOS device, follow these steps:

  1. Login to RouterOS
    Use Winbox, SSH, or WebFig to access the RouterOS device.

  2. Create the Script

    • Navigate to System > Scripts in RouterOS.
    • Click the "+" button to add a new script.
    • Name the script (e.g., pppoe-status).
    • Comment cound be Generates PPPoE status report and capped reconnect log to CLI and files
    • Copy and paste the script (provided below) into the Source field.
    • Assign required permissions:
Policy Required Reason (English)
Don't Require Permissions
ftp
read Required to read PPPoE interface status, system clock, and files
write Required to create, remove, and update files
policy Required to allow execution of scripts with policy permissions
password
sensitive
reboot
test Required to execute scripts and system commands
sniff
romon
  1. Save the Script
    • Click OK to save the script.

Script Details

Script Functionality

This RouterOS script exports/append detailed PPPoE connection information to a plaintext file pppoe-reconnect-log.txt on the RouterOS device. It retrieves the status of the PPPoE client, including parameters like MTU, MRU, uptime, and more, and stores this information in a structured, human-readable format.

Parameters Retrieved

The script retrieves the following PPPoE client parameters:

  • Timestamp: Time of the event
  • PPP-Interface: Name of the PPPoE interface
  • ETH-Interface: Associated Ethernet interface
  • Link Status: Current link status (e.g., link-ok / N/A)
  • Status: Connection status (e.g., connected / disconnected)
  • AC Name: Name of the Access Concentrator
  • AC MAC Address: MAC address of the Access Concentrator
  • Local IPv4: Local IPv4 address
  • Remote IPv4: Remote IPv4 address
  • Local IPv6: Local IPv6 address
  • Remote IPv6: Remote IPv6 address
  • Prefix: Assigned IPv6 prefix
  • Prefix Expires After: Time until the prefix expires
  • MTU: Maximum Transmission Unit
  • MRU: Maximum Receive Unit
  • Current Uptime: Duration the connection has been active

Usage

Running the Script

After saving the script in RouterOS, you can run it manually through the RouterOS console or schedule it to run periodically.

Option 1 – Run the script via the RouterOS GUI:

  1. Navigate to System > Scripts in RouterOS.
  2. Select the script you created (e.g., pppoe-status).
  3. Click Run.

Option 2 – Run the script via the Command Line:

  • Open a terminal session on your MikroTik device.
  • Execute the script using the following command:
/system script run pppoe-status
  • The script will execute immediately and output the results in the terminal.

Sample Output

The console output and file pppoe-reconnect-log.txt will contain the following information:

[PPPoE Reconnect Event]
Timestamp           : 2025-09-04 19:49:14
PPP-Interface       : pppoe-out1
ETH-Interface       : ether7-pppoe
Link Status         : link-ok
Status              : connected
AC Name             : AC_01
AC MAC Address      : 12:34:56:78:9A:BC
Local IPv4          : 203.0.113.25
Remote IPv4         : 198.51.100.45
Local IPv6          : fe80::abcd:1234:5678:9abc
Remote IPv6         : fe80::dcba:4321:8765:cba9
Prefix              : 2003:fb:e700:5600::/56
Prefix Expires After: 17h48m14s
MTU                 : 1492
MRU                 : 1492
Current Uptime      : 7w2d06:11:52

Accessing the File

To access the file:

  1. Go to Files in RouterOS.
  2. Locate the pppoe-reconnect-log.txt file.
  3. Download or open it to view the PPPoE connection details.

PPPoE Monitoring with Netwatch

Netwatch is a RouterOS tool that monitors the reachability of a host by pinging it periodically. You can trigger scripts when the host goes up or down, making it ideal for monitoring PPPoE connectivity.

How to Set Up Netwatch

Via GUI:

  1. Go to Tools > Netwatch.
  2. Click Add New.
  3. Configure the entry:
    • Host: 8.8.8.8
    • Type: simple
    • Interval: 30s
    • Ignore Initial Up: Yes (prevents the Up script from running immediately if the host is already reachable)
    • Up Script: /system script run pppoe-status
    • Down Script: optional, e.g., /system script run pppoe-status to log disconnections
    • Comment: PPPoE Watchdog (for clarity)
  4. Click OK to save.

Via CLI:

/tool netwatch add host=8.8.8.8 type=simple interval=30s ignore-initial-up=yes \
up-script="/system script run pppoe-status" \
down-script="/system script run pppoe-status" \
comment="PPPoE Watchdog"

How to Check Netwatch Status

Via GUI:

  • Go to Tools > Netwatch.
  • Look at the Status column for each entry:
    • up → host is reachable
    • down → host is unreachable

Via CLI:

/tool netwatch print detail

This command will display all configured Netwatch entries, including:

  • Host being monitored
  • Interval between pings
  • Up Script and Down Script
  • Current status (up or down)
  • Any comments for clarity

By checking the status, you can verify that your PPPoE watchdog is working as expected.

Contributing

We welcome contributions! Feel free to fork the repository, make improvements, and submit a pull request. Your help is appreciated!

License

This script is provided as-is and is free to use and modify under the terms of the BSD 3-Clause License.

About

A simple RouterOS script that monitors PPPoE connection details and logs reconnect events, including link status, local IPs, AC information, and uptime statistics.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors