Mikrotik Ppp Profile Script Apr 2026

:log info "PPP DOWN: $user disconnected from $interface" You can call external systems (e.g., RADIUS, webhook, billing server) using /tool fetch .

Here’s a practical piece covering MikroTik PPP profile scripting, including common use cases, script examples, and explanation. MikroTik RouterOS allows you to attach scripts to PPP profiles (for PPTP, L2TP, PPPoE, SSTP, etc.). These scripts run when a PPP session starts ( on-up ) or terminates ( on-down ), enabling dynamic control over user sessions, bandwidth management, routing, and logging. 1. Script Basics in PPP Profile Navigate to: PPP → Profiles → <your profile> → Scripts

/ip firewall address-list remove [find list="ppp-active" address=$remote-address] Log user connections with timestamps. mikrotik ppp profile script

/ip firewall address-list add address=$remote-address list="ppp-active" timeout=1d comment=$user

:if ([:find $user "vip"] = 0) do= /queue simple add name="queue-$user" target=$interface max-limit=100M/100M else= /queue simple add name="queue-$user" target=$interface max-limit=20M/5M :log info "PPP DOWN: $user disconnected from $interface"

/ip route remove [find comment="VPN route for $user"] Add the remote IP to an address list for firewall rules (e.g., allow only authenticated users).

| Variable | Description | |----------|-------------| | $user | PPP username | | $caller-id | Remote endpoint address (for PPTP/L2TP, often client’s public IP) | | $interface | Interface name (e.g., <pppoe-out1> , <l2tp-in2> ) | | $local-address | Local IP assigned to the tunnel | | $remote-address | Remote IP assigned to the client | | $pool-name | IP pool used (if any) | Example 1: Auto Bandwidth Limiting for PPPoE Users Apply different bandwidth limits based on username pattern. These scripts run when a PPP session starts

/ip route add dst-address=192.168.100.0/24 gateway=$remote-address comment="VPN route for $user"

/queue simple remove [find name="queue-$user"] Add a route to client’s LAN behind a PPP client (useful for site-to-site VPN).

:log info "PPP UP: $user logged in from $caller-id on $interface, remote IP $remote-address"

Cookies

Informacje dotyczące plików cookies

Ta witryna korzysta z własnych plików cookie, aby zapewnić Ci najwyższy poziom doświadczenia na naszej stronie . Wykorzystujemy również pliki cookie stron trzecich w celu ulepszenia naszych usług, analizy a nastepnie wyświetlania reklam związanych z Twoimi preferencjami na podstawie analizy Twoich zachowań podczas nawigacji.

Zarządzanie plikami cookies

O Cookies

Pliki cookie to niewielkie pliki tekstowe, które są zapisywane na komputerze lub urządzeniu mobilnym przez strony internetowe, które odwiedzasz. Służą do różnych celów, takich jak zapamiętywanie informacji o logowaniu użytkownika, śledzenie zachowania użytkownika w celach reklamowych i personalizacji doświadczenia przeglądania użytkownika. Istnieją dwa rodzaje plików cookie: sesyjne i trwałe. Te pierwsze są usuwane po zakończeniu sesji przeglądarki, podczas gdy te drugie pozostają na urządzeniu przez określony czas lub do momentu ich ręcznego usunięcia.