tambahkan script di scheduler dengan run startup
:if ([:len ($000 || $150 || $200 || $250 || $300 || $350)] = 0) do={
:global 000 10.8.8.0/27
:global 150 10.8.8.32/27
:global 200 10.8.8.64/26
:global 250 10.8.8.128/26
:global 300 10.8.8.192/27
:global 350 10.8.8.224/27
}
kemudian bikin pool-ip
/ip pool
add name=000 ranges=10.8.8.2-10.8.8.30
add name=150 ranges=10.8.8.33-10.8.8.62
add name=200 ranges=10.8.8.65-10.8.8.126
add name=250 ranges=10.8.8.129-10.8.8.191
add name=300 ranges=10.8.8.193-10.8.8.222
add name=350 ranges=10.8.8.225-10.8.8.254
tambahkan di profile-pppoe on login
:local parent PPPOE
:local ippppoe [/ip address get [/ip address find interface=$user] network]
:local ipclient
:local iprouter [/ip address get [find comment=$user] address ]
:for i from=( [:len $iprouter] - 1) to=0 do={
:if ( [:pick $iprouter $i] = "/") do={
:set $ipclient ([:pick $iprouter 0 $i] +1)
}
}
:if ($ippppoe in $suspend) do={
:if ([:len [/ip firewall address-list find list=cidr_suspend comment=$user]] = 0 ) do={
/ip firewall address-list add address=$ipclient list=cidr_suspend comment=$user
}
/queue simple add target=$ipclient name=$user parent=$parent max-limit=5000000/5000000
}
:if ($ippppoe in $150) do={
/queue simple add target=$ipclient name=$user parent=$parent max-limit=2000000/2000000
/ip firewall address-list remove [find list=cidr_suspend comment=$user]
}
:if ($ippppoe in $200) do={
/queue simple add target=$ipclient name=$user parent=$parent max-limit=2500000/2500000
/ip firewall address-list remove [find list=cidr_suspend comment=$user]}
:if ($ippppoe in $300) do={
/queue simple add target=$ipclient name=$user parent=$parent max-limit=3000000/3000000
/ip fire mangle add chain=postrouting dst-address=$ipclient connection-mark=ggc_conn action=mark-packet new-packet-mark="ggc_$user" comment=$user
/queue tree add name=$user limit-at=2000000 max-limit=5000000 parent=DN-PPPOE packet-mark="ggc_$user"
/ip firewall address-list remove [find list=cidr_suspend comment=$user]
}
:if ($ippppoe in $350) do={
/queue simple add target=$ipclient name=$user parent=$parent max-limit=3000000/3500000
/ip fire mangle add chain=postrouting dst-address=$ipclient connection-mark=ggc_conn action=mark-packet new-packet-mark="ggc_$user" comment=$user
/queue tree add name=$user limit-at=2000000 max-limit=8000000 parent=DN-PPPOE packet-mark="ggc_$user"
/ip firewall address-list remove [find list=cidr_suspend comment=$user]
}
tambahkan di profile-pppoe on logout
:log error "$user logout $ipclient"
/queue simple remove [find name=$user]
/queue tree remove [find name=$user]
/ip fire mangle remove [find comment=$user]
0 comments:
Post a Comment