Mikrotik Ppp Profile Script -
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
| 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. mikrotik ppp profile script
/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). Here’s a practical piece covering MikroTik PPP profile
: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 :if ([:find $user "vip"] = 0) do= /queue


