thảo luận Cộng đồng người dùng MikroTik Router

3Q1h5w4.jpg

Các bác có cao kiến fix lỗi này không ạ
Thiết bị là con mesh 12sw của vnpt lâu lâu nó lại dở chứng

via theNEXTvoz for iPhone
 
Firewall filter vài cái là tốc độ Wan giảm đáng kể rồi, do con 750gr3 yếu khoản pppoe, lên hap ac2 hoặc 4011 thì dư dả, chứ bình thường chạy 3 line wan > 600Mbps là thọt liền =((
Nhu cầu như bác thì nên lên dòng cao hơn, gr3 chỉ có chip dual core,mấy cái filter tốn cpu ghê lắm.
Hap ac3 mới hơn bác ạ, chip 64 bit chắc mạnh hơn nhiều đấy, m đang dùng ac2 mà dư quá.
 
1. Bạn thử vào phần IP - DNS - xem có đang tích tùy chọn: Allow Remote Request không?
View attachment 420339

2. Và xem phần IP - Firewall - Filter Rules, xem có sử dụng rule để protect DNS và web proxy chưa?
View attachment 420351

Nếu chưa sử dụng Rule như trên thì bỏ tích cái Allow Remote Request ở trên kia, rồi kiểm tra lại xem sao?

3. Bật chống DHCP snooping:

View attachment 420369

4. Kiểm tra xem DHCP Server đã tích chọn phát hiện conflict chưa?
View attachment 420390

5. Tùy chọn: nên thêm filter rule để chống DDoS, kiểm tra lại IP - Service: cái nào ko dùng thì tắt đi, cái nào dùng thì xem xét firewall + đổi port (nếu thấy cần thiết).

Vì hệ thống do bạn quản lý, nên bạn phải tự kiểm tra, xem xét thật kỹ và cẩn thận.
bác cho em xin config firewall Rule này được không ạ?
Em mới tắt các server chỉ dùng winbox thôi ạ
 
bác cho em xin config firewall Rule này được không ạ?
Em mới tắt các server chỉ dùng winbox thôi ạ
//Protect DNS and webproxy

Code:
/ip firewall filter
add protocol=udp dst-port=53 in-interface=pppoe-out1 chain=input action=drop comment=" Protect DNS and webproxy"
add protocol=tcp dst-port=53 in-interface=pppoe-out1 chain=input action=drop
add protocol=tcp dst-port=8080 in-interface=pppoe-out1 chain=input action=drop

//Protect WINBOX - recommended to change port 8291 to another port (IP -> Services)

Code:
/ip firewall filter
add chain=input protocol=tcp dst-port=8291 src-address-list=winbox_blacklist action=drop \
comment="Drop Winbox Brute Forcers" disabled=no

add chain=input protocol=tcp dst-port=8291 connection-state=new \
src-address-list=winbox_stage3 action=add-src-to-address-list address-list= winbox_blacklist \
address-list-timeout=10d comment="" disabled=no

add chain=input protocol=tcp dst-port=8291 connection-state=new \
src-address-list= winbox_stage2 action=add-src-to-address-list address-list= winbox_stage3 \
address-list-timeout=1m comment="" disabled=no

add chain=input protocol=tcp dst-port=8291 connection-state=new src-address-list= winbox_stage1 \
action=add-src-to-address-list address-list= winbox_stage2 address-list-timeout=1m comment="" disabled=no

add chain=input protocol=tcp dst-port=8291 connection-state=new action=add-src-to-address-list \
address-list= winbox_stage1 address-list-timeout=1m comment="" disabled=no

//DROP DDoS

Code:
/ip firewall address-list
add list=DDoS-attackers comment="List all IP of DDoS-attackers"
add list=DDoS-target comment="List all IP of DDoS-target"

/ip firewall filter
add action=jump chain=forward comment="Drop DDoS" connection-state=new \ jump-target=detect-DDoS

/ip firewall filter

add chain=detect-DDoS dst-limit=32,32,src-and-dst-address/1s action=return

/ip firewall filter

add chain=detect-DDoS action=add-dst-to-address-list address-list=DDos-target address-list-timeout=10m

add chain=detect-DDoS action=add-src-to-address-list address-list=DDos-attackers address-list-timeout=10m

/ip firewall raw

 add action=drop chain=prerouting dst-address-list=ddos-target src-address-list=ddos-attackers comment="Drop DDoS Raw"

/ip firewall filter

 add chain=forward connection-state=new src-address-list=DDos-attackers dst-address-list=DDos-target action=drop
 
Các bác cho e hỏi trường hợp này phát :( đang dùng mik rb760 + sfp Nokia, sau khi reboot mik thì ko quay đc pppoe, kĩ thuật bên F báo xung setting có qua đổi modem từ g97rg3 sang G-97RG6W, e có bridge và pppoe lại trên mik nhưng không được. Nếu có ai cũng từng gặp lỗi với con G-97RG6W mà bridge với quay đc cho e xin chỉ giáo với e cảm ơn nhiều ạ =(( (đã gọi tổng đài reset mac, modem đổi sang sfu,user pppoe giữ nguyên)
 
Last edited:
show hết cái scripts lên, mình xem thử

:local bot "5877335897:AAHmF_R31VQClLuubIusZSgph6RkDxdwkc"
:local ChatID "2133617709"
:local myserver ("\E2\84\B9"." "."MikroTik"." ".[/system identity get name]." ".[/system resource get board-name])
:local scheduleName "LogFilter"
:local startBuf [:toarray [/log find where message~"(login failure|loop|down|fcs|excessive|system|rebooted|ipsec|ike2)" \
or topics~"(error|critical)"
]
]
# :local removeThese [:toarray ""]
# END SETUP

# Convert 10/oct/2021 to numeric date: 10/10/2021 -> $mesnum
:global mesnum
:local date [/system clock get date]

# warn if schedule does not exist and create it
:if ([:len [/system scheduler find name="$scheduleName"]] = 0) do={
/log warning "[LogFilter] Alert : Schedule does not exist. Creating schedule ...."
/system scheduler add name=$scheduleName interval=60s start-date=dec/12/2022 start-time=12:00:00 on-event=LogFilter
/log warning "[LogFilter] Alert : Schedule created!"
}

# get last time from scheduler's comment
:local lastTime [/system scheduler get [find name="$scheduleName"] comment]
# for checking time of each log entry
:local currentTime
# log message
:local message
# final output
:local output

:local keepOutput false
# if lastTime is empty, set keepOutput to true
:if ([:len $lastTime] = 0) do={
:set keepOutput true
}

:local counter 0
# loop through all log entries that have been found

:foreach i in=$startBuf do={

# loop through all removeThese array items
:local keepLog true
:foreach j in=$removeThese do={
# if this log entry contains any of them, it will be ignored
:if ([/log get $i message] ~ "$j") do={
:set keepLog false
}
}

:if ($keepLog = true) do={
:set message [/log get $i message]
# LOG DATE
# depending on log date/time, the format may be different. 3 known formats

# format of jan/01/2002 00:00:00 which shows up at unknown date/time. Using as default
:set currentTime [ /log get $i time ]

# format of 00:00:00 which shows up on current day's logs
:if ([:len $currentTime] = 8 ) do={
:set currentTime ([:pick $date 4 6]."/".[$mesnum [:pick $date 0 3]]."/".[:pick $date 7 11]." ".$currentTime)
} else={

# format of jan/01 00:00:00 which shows up on previous day's logs
:if ([:len $currentTime] = 15 ) do={
:set currentTime ([:pick $currentTime 4 6]."/".[$mesnum [:pick $currentTime 0 3]]."/".[:pick $date 7 11]." ".[:pick $currentTime 7 15])
}
}

# if keepOutput is true, add this log entry to output
:if ($keepOutput = true) do={
:set output ($output.$currentTime." ".$message." %0A%0A ")
}
:if ($currentTime = $lastTime) do={
:set keepOutput true
:set output ""
}
}

:if ($counter = ([:len $startBuf])-1) do={
:if ($keepOutput = false) do={
:if ([:len $message] > 0) do={
:set output ($output.$currentTime." ".$message)
}
}
}

:set counter ($counter + 1)
}

if ([:len $output] > 0) do={
/system scheduler set [find name="$scheduleName"] comment=$currentTime
/tool fetch url="https://api.telegram.org/bot$bot/sendMessage\?chat_id=$ChatID&text=$myserver%0A%0A$output" keep-result=no;
}
đây thím

via theNEXTvoz for iPhone
 
:local bot "5877335897:AAHmF_R31VQClLuubIusZSgph6RkDxdwkc"
:local ChatID "2133617709"
:local myserver ("\E2\84\B9"." "."MikroTik"." ".[/system identity get name]." ".[/system resource get board-name])
:local scheduleName "LogFilter"
:local startBuf [:toarray [/log find where message~"(login failure|loop|down|fcs|excessive|system|rebooted|ipsec|ike2)" \
or topics~"(error|critical)"
]
]
# :local removeThese [:toarray ""]
# END SETUP

# Convert 10/oct/2021 to numeric date: 10/10/2021 -> $mesnum
:global mesnum
:local date [/system clock get date]

# warn if schedule does not exist and create it
:if ([:len [/system scheduler find name="$scheduleName"]] = 0) do={
/log warning "[LogFilter] Alert : Schedule does not exist. Creating schedule ...."
/system scheduler add name=$scheduleName interval=60s start-date=dec/12/2022 start-time=12:00:00 on-event=LogFilter
/log warning "[LogFilter] Alert : Schedule created!"
}

# get last time from scheduler's comment
:local lastTime [/system scheduler get [find name="$scheduleName"] comment]
# for checking time of each log entry
:local currentTime
# log message
:local message
# final output
:local output

:local keepOutput false
# if lastTime is empty, set keepOutput to true
:if ([:len $lastTime] = 0) do={
:set keepOutput true
}

:local counter 0
# loop through all log entries that have been found

:foreach i in=$startBuf do={

# loop through all removeThese array items
:local keepLog true
:foreach j in=$removeThese do={
# if this log entry contains any of them, it will be ignored
:if ([/log get $i message] ~ "$j") do={
:set keepLog false
}
}

:if ($keepLog = true) do={
:set message [/log get $i message]
# LOG DATE
# depending on log date/time, the format may be different. 3 known formats

# format of jan/01/2002 00:00:00 which shows up at unknown date/time. Using as default
:set currentTime [ /log get $i time ]

# format of 00:00:00 which shows up on current day's logs
:if ([:len $currentTime] = 8 ) do={
:set currentTime ([:pick $date 4 6]."/".[$mesnum [:pick $date 0 3]]."/".[:pick $date 7 11]." ".$currentTime)
} else={

# format of jan/01 00:00:00 which shows up on previous day's logs
:if ([:len $currentTime] = 15 ) do={
:set currentTime ([:pick $currentTime 4 6]."/".[$mesnum [:pick $currentTime 0 3]]."/".[:pick $date 7 11]." ".[:pick $currentTime 7 15])
}
}

# if keepOutput is true, add this log entry to output
:if ($keepOutput = true) do={
:set output ($output.$currentTime." ".$message." %0A%0A ")
}
:if ($currentTime = $lastTime) do={
:set keepOutput true
:set output ""
}
}

:if ($counter = ([:len $startBuf])-1) do={
:if ($keepOutput = false) do={
:if ([:len $message] > 0) do={
:set output ($output.$currentTime." ".$message)
}
}
}

:set counter ($counter + 1)
}

if ([:len $output] > 0) do={
/system scheduler set [find name="$scheduleName"] comment=$currentTime
/tool fetch url="https://api.telegram.org/bot$bot/sendMessage\?chat_id=$ChatID&text=$myserver%0A%0A$output" keep-result=no;
}
đây thím

via theNEXTvoz for iPhone
Chạy bình thường thím ơi.
 

Attachments

  • Screenshot_20221223-133549.png
    Screenshot_20221223-133549.png
    385 KB · Views: 61
Thím có chỉnh gì thêm ko? Trên con Rg3 logon sai vẫn ko thấy nó báo. Lần đầu chạy scripts thì báo rồi hết.

via theNEXTvoz for iPhone
Chỉnh
Code:
:global startBuf
thôi, chỉnh để xem nội dung nó thôi
Code:
:global botID
:global mychat
:local myserver ("\E2\84\B9"." "."MikroTik"." ".[/system identity get name]." ".[/system resource get board-name])
:local scheduleName "LogFilter"
:global startBuf [:toarray [/log find where message~"(login failure|loop|down|fcs|excessive|system|rebooted|ipsec|ike2)" or topics~"(error|critical)"]]
# :local removeThese [:toarray ""]
# END SETUP

# Convert 10/oct/2021 to numeric date: 10/10/2021 -> $mesnum
:global mesnum
:local date [/system clock get date]

# warn if schedule does not exist and create it
:if ([:len [/system scheduler find name="$scheduleName"]] = 0) do={
/log warning "[LogFilter] Alert : Schedule does not exist. Creating schedule ...."
/system scheduler add name=$scheduleName interval=60s start-date=jan/01/2000 start-time=12:00:00 on-event=LogFilter
/log warning "[LogFilter] Alert : Schedule created!"
}

# get last time from scheduler's comment
:local lastTime [/system scheduler get [find name="$scheduleName"] comment]
# for checking time of each log entry
:local currentTime
# log message
:local message
# final output
:local output

:local keepOutput false
# if lastTime is empty, set keepOutput to true
:if ([:len $lastTime] = 0) do={
:set keepOutput true
}

:local counter 0
# loop through all log entries that have been found

:foreach i in=$startBuf do={

# loop through all removeThese array items
:local keepLog true
:foreach j in=$removeThese do={
# if this log entry contains any of them, it will be ignored
:if ([/log get $i message] ~ "$j") do={
:set keepLog false
}
}

:if ($keepLog = true) do={
:set message [/log get $i message]
# LOG DATE
# depending on log date/time, the format may be different. 3 known formats

# format of jan/01/2002 00:00:00 which shows up at unknown date/time. Using as default
:set currentTime [ /log get $i time ]

# format of 00:00:00 which shows up on current day's logs
:if ([:len $currentTime] = 8 ) do={
:set currentTime ([:pick $date 4 6]."/".[$mesnum [:pick $date 0 3]]."/".[:pick $date 7 11]." ".$currentTime)
} else={

# format of jan/01 00:00:00 which shows up on previous day's logs
:if ([:len $currentTime] = 15 ) do={
:set currentTime ([:pick $currentTime 4 6]."/".[$mesnum [:pick $currentTime 0 3]]."/".[:pick $date 7 11]." ".[:pick $currentTime 7 15])
}
}

# if keepOutput is true, add this log entry to output
:if ($keepOutput = true) do={
:set output ($output.$currentTime." ".$message." %0A%0A ")
}
:if ($currentTime = $lastTime) do={
:set keepOutput true
:set output ""
}
}

:if ($counter = ([:len $startBuf])-1) do={
:if ($keepOutput = false) do={
:if ([:len $message] > 0) do={
:set output ($output.$currentTime." ".$message)
}
}
}

:set counter ($counter + 1)
}

if ([:len $output] > 0) do={
/system scheduler set [find name="$scheduleName"] comment=$currentTime
/tool fetch url="https://api.telegram.org/bot$botID/sendMessage\?chat_id=$mychat&text=$myserver%0A%0A$output" keep-result=no;
}
 
TjRcldf.png
sao mình ko thấy báo gì hết nhỉ. Xoá add lại cũng chỉ thế này. Login sai cũng ko thấy bao gì hết😞

via theNEXTvoz for iPhone
Code:
:global botID
:global mychat
:local myserver ("\E2\84\B9"." "."MikroTik"." ".[/system identity get name]." ".[/system resource get board-name])
:local scheduleName "LogFilter"
:global startBuf [:toarray [/log find where message~"(login failure|loop|down|fcs|excessive|system|rebooted|ipsec|ike2)" or topics~"(error|critical)"]]
:global removeThese [:toarray ""]
# END SETUP

# Convert 10/oct/2021 to numeric date: 10/10/2021 -> $mesnum
:local mesnum
:local date [/system clock get date]

# warn if schedule does not exist and create it
:if ([:len [/system scheduler find name="$scheduleName"]] = 0) do={
/log warning "[LogFilter] Alert : Schedule does not exist. Creating schedule ...."
/system scheduler add name=$scheduleName interval=60s start-date=jan/01/2000 start-time=12:00:00 on-event=LogFilter
/log warning "[LogFilter] Alert : Schedule created!"
}

# get last time from scheduler's comment
:local lastTime [/system scheduler get [find name="$scheduleName"] comment]
# for checking time of each log entry
:global currentTime
# log message
:local message
# final output
:local output

:local keepOutput false
# if lastTime is empty, set keepOutput to true
:if ([:len $lastTime] = 0) do={
:set keepOutput true
}

:local counter 0
# loop through all log entries that have been found

:foreach i in=$startBuf do={

# loop through all removeThese array items
:local keepLog true
:foreach j in=$removeThese do={
# if this log entry contains any of them, it will be ignored
:if ([/log get $i message] ~ "$j") do={
:set keepLog false
}
}

:if ($keepLog = true) do={
:set message [/log get $i message]
# LOG DATE
# depending on log date/time, the format may be different. 3 known formats

# format of jan/01/2002 00:00:00 which shows up at unknown date/time. Using as default
:set currentTime [ /log get $i time ]

# format of 00:00:00 which shows up on current day's logs
:if ([:len $currentTime] = 8 ) do={
:set mesnum [:tostr ([:find "janfebmaraprmayjunjulaugsepoctnovdec" [:pick $date 0 3] ]/3+1)]
:if ([:tonum $mesnum]<10) do={:set mesnum "0$monthUp"}
:set currentTime ([:pick $date 4 6]."/".$mesnum."/".[:pick $date 7 11]." ".$currentTime)
} else={

# format of jan/01 00:00:00 which shows up on previous day's logs
:if ([:len $currentTime] = 15 ) do={
:set mesnum [:tostr ([:find "janfebmaraprmayjunjulaugsepoctnovdec" [:pick $currentTime 0 2] ]/3+1)]
:if ([:tonum $mesnum]<10) do={:set mesnum "0$monthUp"}
:set currentTime ([:pick $currentTime 4 6]."/".$mesnum."/".[:pick $date 7 11]." ".[:pick $currentTime 7 15])
}
}

# if keepOutput is true, add this log entry to output
:if ($keepOutput = true) do={
:set output ($output.$currentTime." ".$message." %0A%0A ")
}
:if ($currentTime = $lastTime) do={
:set keepOutput true
:set output ""
}
}

:if ($counter = ([:len $startBuf])-1) do={
:if ($keepOutput = false) do={
:if ([:len $message] > 0) do={
:set output ($output.$currentTime." ".$message)
}
}
}

:set counter ($counter + 1)
}
if ([:len $output] > 0) do={
/system scheduler set [find name="$scheduleName"] comment=$currentTime
/tool fetch url="https://api.telegram.org/bot$botID/sendMessage\?chat_id=$mychat&text=$myserver%0A%0A$output" keep-result=no;
}
Chạy ngon lành mà thím, chỉnh lại code cho cái thông báo "date" cho chính xác.
 
Bạn còn thiếu một bước quan trọng là phải xin IP từ interface gốc rồi mới tạo interface ảo trên interface gốc được.
Còn việc quay pppoe được hay không là do phía ISP có cho phép hay không.
Mấy bác chỉ e cách xin ip từ interface gốc đc k ạ? e đang chưa hiểu được đoạn này
 
Back
Top