#=========================================================================
# Auto PPPoE Script
# by: RedFox INet / Wilfredo Intoy Escano
# GCash: 09177029868
# Tested: ROS 7.10 and 7.12
#=========================================================================
{
local apppclient "pppoe-clients"
local anetwork "20.0.0.1"
local arange "20.0.0.2-20.0.3.254"
local aservice "pppoe-server"
local abridge "PPPoE_HS"
local z 0
local alimit [toarray "5Mbps, 10Mbps, 15Mbps, 20Mbps, 25Mbps, 30Mbps, 35Mbps,
40Mbps, 45Mbps, 50Mbps, 100Mbps"]
local aspeed [toarray "5m/5m, 10m/10m, 15m/15m, 20m/20m, 25m/25m, 30m/30m,
35m/35m, 40m/40m, 45m/45m, 50m/50m, 100m/100m"]
if ([/interface bridge find name=$abridge]="") do={
/interface bridge add name=$abridge
}
if ([/ip pool find name=$apppclient]="") do={
/ip pool add name=$apppclient ranges=$arange
}
if ([/interface pppoe-server server find service-name=$aservice]="") do={
/interface pppoe-server server
add authentication=pap disabled=no interface=$abridge \
one-session-per-host=yes service-name=$aservice
}
foreach item in=$alimit do={
local arate [:pick $aspeed $z]
if ([/ppp profile find name =$item]="") do={
/ppp profile
add dns-server=8.8.8.8,1.1.1.1 local-address=$anetwork name=\
$item rate-limit=$arate remote-address=$apppclient
}
if ([/ppp secret find name=test]="") do={
/ppp secret
add name=test password=1234 profile=$item service=pppoe
}
set z ($z+1);
}