- ИТ База знаний
- Полезно
- Навигация
- Серверные решения
- Телефония
- Корпоративные сети
- Высокая загрузка процессора Mikrotik. Что делать?
- Настройка Firewall в Mikrotik
- Alexell.Ru
- FastTrack на MikroTik — уменьшаем нагрузку на CPU
- Mikrotik загрузка процессора firewall
- Filter Drop — сильно грузит процессор
- Mikrotik загрузка процессора firewall
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
- Re: 100 CPU on any mikrotik router using basic rules
ИТ База знаний
Курс по Asterisk
Полезно
— Узнать IP — адрес компьютера в интернете
— Онлайн генератор устойчивых паролей
— Онлайн калькулятор подсетей
— Калькулятор инсталляции IP — АТС Asterisk
— Руководство администратора FreePBX на русском языке
— Руководство администратора Cisco UCM/CME на русском языке
— Руководство администратора по Linux/Unix
Навигация
Серверные решения
Телефония
FreePBX и Asterisk
Настройка программных телефонов
Корпоративные сети
Протоколы и стандарты
Высокая загрузка процессора Mikrotik. Что делать?
4 минуты чтения
Сетевое оборудование вендора Mikrotik является весьма любопытным и привлекательным продуктом в сегменте SOHO (Small office/home office). Соотношение цены, качества, функционала и стабильности обеспечивает все большее распространение небольших белых коробочек в офисах небольших компаний.
Онлайн курс по Кибербезопасности
Изучи хакерский майндсет и научись защищать свою инфраструктуру! Самые важные и актуальные знания, которые помогут не только войти в ИБ, но и понять реальное положение дел в индустрии
Но спустя какое-то время беззаботного пользования, пользователи начинают жаловаться. Администратор, открыв Winbox, переходит в раздел System → Resources и видит, что загрузка процессора 100%:
Не стоит волноваться. У нас есть решение. Все настройки и «траблшутинг» будем осуществлять с помощью Winbox.
Настройка Firewall в Mikrotik
Первым делом давайте проверим службу, которая больше всего «отъедает» ресурсов процессор. Для этого, перейдем в раздел Tools → Profile:
Как видно из скриншота, львиную долю ресурсов нашего процессора занимает служба DNS. Давайте посмотрим, что происходит на уровне обмена пакетами на основном интерфейс ether1. Для этого воспользуемся утилитой Tools → Torch:
Мы видим большое количество пакетов с различных IP – адресов на 53 порт. Наш Mikrotik отвечает на каждый из таких запросов, тем самым, нерационально используя ресурсы процессора и повышая температуру.
Эту проблему надо решать. Судя по снятому дампу, пакеты приходят с частотой 10-20 секунд с одного IP – адреса. Добавим в наш Firewall два правила:
- Все IP – адреса, пакеты с которых приходят на 53 порт нашего Микротика будут помещаться в специальный лист с названием dns spoofing на 1 час.
- Каждый IP – адрес, с которого будет поступать запрос на 53 порт будет проверяться на предмет нахождения в списке dns spoofing . Если он там есть, мы будем считать, что это DNS – спуфинг с частотой реже чем раз в час и будем дропать данный пакет.
Переходим к настройке. В разделе IP → Firewall → Filter Rules создаем первое правило нажав на значок «+». Во кладке General указываем следующие параметры:
- Chain = input — обрабатываем приходящие пакеты
- Protocol = UDP — нас интересуют пакеты, у которых в качестве транспорта используется UDP
- Dst. Port = 53 — портом назначения должен быть 53 порт, то есть DNS служба
- In. Interface = ether1 — проверка подвергаются все пакеты, которые приходят на интерфейс ether1, который смотрит в публичную сеть.
Переходим во вкладку Action:
- Action = add src to address list — в качестве действия, мы будем добавлять IP – адрес источника в специальный лист
- Address List = dns spoofing — указываем имя листа, в который добавляем IP
- Timeout = 01:00:00 — добавляем на 1 час
Нажимаем Apply и OK. Настроим второе правило, так же нажав на «+»:
Как видно, настройки во вкладке General в данной вкладке идентичны первому правилу. Нажимаем на вкладку Advanced:
- Src. Address List= dns spoofing — указываем Микротику, производить проверку приходящего пакета на предмет нахождения в указанном листе
Переходим во вкладку Action:
- Action = drop — если IP – адрес пакета есть в указанном списке, то дропаем этот пакет.
После того, как оба правила стали активны переходи во вкладку IP → Firewall → Address Lists:
Как видно, адреса стали добавляться в список на 1 час. Теперь давайте проверим загрузку процессора:
Теперь загрузка процессора в пределах нормы. Проблема решена.
Онлайн курс по Кибербезопасности
Изучи хакерский майндсет и научись защищать свою инфраструктуру! Самые важные и актуальные знания, которые помогут не только войти в ИБ, но и понять реальное положение дел в индустрии
Alexell.Ru
Официальный сайт Alexell
FastTrack на MikroTik — уменьшаем нагрузку на CPU
Добрый вечер, уважаемые читатели моего скромного блога! Прошу прощения, что давно ничего не писал, я был занят одним проектом, да и идей особо не было. Однако сегодня я хочу поделиться с вами своей историей о нагрузке на CPU моего MikroTik hAP ac. Вы узнаете про FastTrack и оптимизацию Firewall.
Итак, что мы имеем:
- 2 постоянно работающих L2TP+IPSec подключения
- 18 правил Firewall
- 13 правил NAT
- 3 правила Mangle
- 10 скриптов в Scheduler (5 из которых выполняются каждую минуту)
- Один игровой сервер
- Один личный компьютер
- Мобильные устройства
Все это дело вроде бы работало без сбоев, пока однажды, когда я был на работе, у меня не пропала связь с Микротиком. Поскольку я работаю в провайдере и от него же у меня дома интернет, я зашел в биллинг — интернет оплачен, сессии нет. Зашел на свитч — линк на порту есть, ошибки не копятся, но маки не приходят. Перезагрузка порта не помогла.
Когда я наконец пришел домой после смены, было похоже что Микротик завис. Лампочки горели, но DHCP он не раздавал, по MAC к нему подключиться тоже не удалось. После его перезагрузки связь восстановилась. Подозреваю что причиной стала высокая и длительная нагрузка на CPU, но выяснил я это уже позже. Как оказалось, при скачивании торрента на компьютере со скоростью 25-30 МБ/сек, нагрузка на CPU Микротика держится в районе 90-100%. А перед уходом на работу я как раз поставил скачиваться 5 сезонов сериала.
Как же я решил проблему высокой нагрузки на CPU MikroTik?
Mikrotik загрузка процессора firewall
Бесплатный чек-лист
по настройке RouterOS
на 28 пунктов
Filter Drop — сильно грузит процессор
Разрешаем пинг роутера:
/ip firewall filter add chain=input action=accept protocol=icmp comment=»Accept PING»
Разрешаем успешно установленные соединения:
/ip firewall filter add chain=input action=accept in-interface=ether1-ext connection-state=established comment=»Accept established connections Mikrotik»
/ip firewall filter add chain=forward action=accept in-interface=ether1-ext connection-state=established comment=»Accept established connections LAN»
Разрешаем родственные соединения:
/ip firewall filter add chain=input action=accept in-interface=ether1-ext connection-state=related comment=»Accept related connections Mikrotik»
/ip firewall filter add chain=forward action=accept in-interface=ether1-ext connection-state=related comment=»Accept related connections LAN»
Здесь можно добавить правила разрешающие для NAT и входящие
/
Запрещаем недействительные соединения:
/ip firewall filter add chain=input action=drop in-interface=ether1-ext connection-state=invalid comment=»Drop invalid connections Mikrotik»
/ip firewall filter add chain=forward action=drop in-interface=ether1-ext connection-state=invalid comment=»Drop invalid connections LAN»
Запрещаем все остальные input соединения:
/ip firewall filter add chain=input action=drop in-interface=ether1-ext comment=»Drop all other input connections»
Разрешаем доступ в интернет из локальной сети:
/ip firewall filter add chain=forward action=accept src-address=192.168.1.0/24 comment=»Access Internet From LAN»
Запрещаем все остальные forward соединения:
/ip firewall filter add chain=forward action=drop comment=»Drop all other forward connections»
У меня вечер уже, и я мож не увидел замыленным глазом, но:
1) а зачем разрешать пинг (ЯВНО), если Вы его нигде и не закрываете?
То есть в данном случая я вижу, что правило с пингом — лишнее, оно описывает то,
что итак уже открыто по-умолчанию.
2) Посмотрите и попробуйте проанализировать какие именно атаки вешают Ваш роутер?
По каким портам чаще бьют?
Я прекрасно понимаю, что любую железку можно заДДоСить, но в целом, странно что весь роутер вешается?
2.1) надеюсь Вы обновили роутер, там были уязвимости, как бы Вы не попали в число возможных претендентов?
3) А все правила файрвола активны, вернее так спрошу: у всех правил файрвола счётчик срабатываний не нулевой?
То есть хочу сделать акцент на порядок правил, на сработку тех или иных праивл, может даже концепцию файрвола
проверить/пересмотреть?
И лично от меня совет: (другие коллеги могут его не поддержать), я всё же для сбережения ресурсов роутеров,
особенно не мощных, первым правилом «убиваю» инвалидные пакеты на интерфейсе(ах). Зачем обслуживать
пакет, и дальше, через 2-15 правил его так или иначе убивать, «файс контроль» должен быть при входе
(это я думаю тоже +5-15% даёт выигрыша (экономия ресурсов CPU)
1) связь с провайдером/адрес провайдерский/подключение точно на первом порту?
Нету случайно рррое или l2tp ?
2) про пинг странно
3) а Вы увидели на какие порты Вас атаковали?
Всё таки большая/основная масса должна быть идти на 1-10 портов одних и тех же, не успели посмотреть?
Или тем же Torch или в таблице Connections.
3.1) Кстати, о таблице Connections — зайдите туда (напоминаю, это в IP-Firewall-Connections)
там будет на панели одна единственная кнопка Tracking
и там будет такой параметр как » TCP Established Timeout »
обычно равен 1 дню, поставьте в Вашем случаи, хотя бы временно 1-2 час(а), и в Вашем случаи
проще и быстрее будет роутер перезагрузить(для обновления таблицы Connections).
Роутеру апосля будет полегче, пока Вы не решите тему с атаками.
4) Позвоните провайдеру, уточните у него, что/кто Вас атакует? Может провайдер
со своей стороны увидит какую-ту закономерность.
Да и когда идёт ДДоС на хость (много и долго), провайдеры или звонят/уточняют или отключают
обычно.
— NB —
Я склоняюсь (и могу ошибаться, но погадать охота) что Вы:
а) перемудрили с файрволом (ситуация с тем же пингом)?
б) файрвол Вас не защищает
в) атака идёт на 53 порт(ы) + ещё что-то.
Mikrotik загрузка процессора firewall
Wed Sep 07, 2016 4:16 pm
So im battling this problem for some time.
At our company iv set HAP AC as main router and have some basic firewall and mangle rules with QUEUES. (around 30 all togther).
We have 40mbit ADSL line and CPU already hits 100% often when PCSs on network download windows update or torrents.
TO make things even worse, if someone copies something over WLAN, it fully chokes router locking it to 100%, internet slows down, and even clients which are doing those WLAN transfer getting disconnects due extensive data loos error in router log.And max transfer speeds are up to 200mbit (Laptop connects 780mbit/s)
If i disable ALL mangle, firewall,and queue rules, CPU load barely drops.Only thing that helps is disabling firewall, than bridge fast path is active and client pulls over 500+mbit transfer speeds without problem or high CPU load.
So what exactly can i do?Other than buying another router just to serve WLAN and another one for basic QOS/Firewall?
Why cant i directly bridge one LAN port with WLAN interface bypassing all ip firewall thats active on other bridge port?Why is this not possible to do on Mikrotik router?
Re: 100 CPU on any mikrotik router using basic rules
Wed Sep 07, 2016 7:07 pm
Is perfectly possible. check that «Use IP Firewall» isn’t ticked on Bridge > Settings
Upgrade it to ROS 6.36.3, checking System > Routerboard Current firmware is the same as Upgrade firmware.
Post a configuration export, 40Mbps is way under Hap ac capabilities.
Re: 100 CPU on any mikrotik router using basic rules
Wed Sep 07, 2016 7:15 pm
Is perfectly possible. check that «Use IP Firewall» isn’t ticked on Bridge > Settings
Upgrade it to ROS 6.36.3, checking System > Routerboard Current firmware is the same as Upgrade firmware.
Post a configuration export, 40Mbps is way under Hap ac capabilities.
If i untick Use IP Firewall than ALL my firewall, mangle, and queue rules stop working.The setting is for all bridgets, you can untick it per bridges, that is what i asked
I can post configuration tomorrow, but as i said, its not that i have too many of them or what not, its enough that IP firewall is turned on without any rules to get this poor resoults.
And yes im using latest Software.
Re: 100 CPU on any mikrotik router using basic rules
Wed Sep 07, 2016 8:27 pm
without an export I can just speculate. you have every single detail in mind because you’re troubleshooting this, but I can’t see anywhere where did you ask for that detail. (the answer is no, it’s a global setting).
With an export, we will be able (hopefully) to see if you configured the router following best practices, or suggest improvements over specific configuration details.
Re: 100 CPU on any mikrotik router using basic rules
Thu Sep 08, 2016 12:42 am
Doubt this export will solve anything, basically just taking fresh rested router, creating simple wifi connectin with bridge and enabling IP filter will cause 100% CPU load and almost 4x times less performance making the router uselss for some basic expected functions..
In case someone going to say i have too much firewall rules or ordering is wrong or whatever, disabling all, deleting all this firewall rules, filter,mangle, queue, makes almost NO difference in CPU load!
Re: 100 CPU on any mikrotik router using basic rules
Thu Sep 08, 2016 1:50 pm
Sorry, but this config is far away from a «basic» one, you seem to have touched every imaginable knob available in the OS, so the possible variables are endless, making troubleshooting a shot in the dark.
Where are you seeing that «spike»? in winbox CPU load graph? winbox Dashboard > Cpu? or Tools > profile.
Suppossing you actually saw it on tools > Profile, or Winbox Dashboard > CPU, and not the bar graph, which can «peak» with 0% CPU load, and isn’t a reliable load indicator by any means.
Have you tried resetting it to defaults? does it have that 100% CPU spike?
If it persists: does it keep peaking the CPU after netinstalling it, and using a default config?
P.S: Can´t make any sense out of your setup, I’d start with a default one (Mikrotik engineers chose all these settings for a reason) and customize/evolve from there.
Re: 100 CPU on any mikrotik router using basic rules
Thu Sep 08, 2016 4:21 pm
Sorry, but this config is far away from a «basic» one, you seem to have touched every imaginable knob available in the OS, so the possible variables are endless, making troubleshooting a shot in the dark.
Where are you seeing that «spike»? in winbox CPU load graph? winbox Dashboard > Cpu? or Tools > profile.
Suppossing you actually saw it on tools > Profile, or Winbox Dashboard > CPU, and not the bar graph, which can «peak» with 0% CPU load, and isn’t a reliable load indicator by any means.
Have you tried resetting it to defaults? does it have that 100% CPU spike?
If it persists: does it keep peaking the CPU after netinstalling it, and using a default config?
P.S: Can´t make any sense out of your setup, I’d start with a default one (Mikrotik engineers chose all these settings for a reason) and customize/evolve from there.
I had to do all this settings and workarounds because of the this problem, if i reset router to default than things are even WORSE.
Freshly reseted router, creating simple bridge WLAN and one LAN PORT, with IP filter turned on, without single additional rule or setting causes the same issue, 100%cpu load in profiler, around 50% firewall, and wireless around 30% + some other services the rest.
File transfers than drop, packets drop, and even client gets disconnected by router due extensive data lost.
Re: 100 CPU on any mikrotik router using basic rules
Thu Sep 08, 2016 7:11 pm
Re: 100 CPU on any mikrotik router using basic rules
Thu Sep 08, 2016 7:59 pm
How else I can create guest wifi network for example with another dhcp range from main wifi and this 2 networks must be isolated from each other?
Other than that, I also need queues or one pc downloads Windows updates and than web browsing simple dies due upload beeing choked on adsl router. With mine queues it works perfect, I can saturate full adsl link, and yet web pages reload near instant.
Re: 100 CPU on any mikrotik router using basic rules
Thu Sep 08, 2016 8:16 pm
Re: 100 CPU on any mikrotik router using basic rules
Thu Sep 08, 2016 8:23 pm
Ip firewall is the one causing slowdowns, i didint add anything in bridge firewall And as i mention rules means nothing, IP firewall once activated without rules drops speeds by almost 4x and hits CPU 100%.
And they are not on same bridge.
WLAN1 = BRIDGE ONE
WLAN2 (guest) = BRIDGE 2
Than i did masquerade for WLAN2.
I mean i got everything set up and i know how to do it, and everything works, but performance is killing me on this routers.
Dont even want to mention what happend when i implemented transparent proxy in order to cache all common downloads like windows updates, antivirus defintions etc..
CPU was screaming on 100% all the time.
Do i need much powerful mikrotik switch for this?Or maybe even build an PC ruining RouterOS in HYPER-V for example?
Re: 100 CPU on any mikrotik router using basic rules
Thu Sep 08, 2016 10:30 pm
Re: 100 CPU on any mikrotik router using basic rules
Fri Sep 09, 2016 2:34 am
Re: 100 CPU on any mikrotik router using basic rules
Fri Sep 09, 2016 3:32 am
So many thoughts, not sure where to begin..
My thoughts on ip filter on a bridge. If you need filtering, why are you bridging?
When you filter a LAN bridge, ALL local traffic gets inspected by the CPU — if you need this, you should be using a CCR, not a RB.
Each lan segment should be a separate interface — not in a bridge.
You QoS should be on WAN interface only — again, if you need QoS on your LAN, you should be using a CCR.
I think you are pushing the hAP too hard. It will work just fine as a router and access point. but making it filter all your internal traffic, and apply QoS to all internal traffic is just too much for a MIPSBE cpu. The unit will likely do what you need, but you need to rethink the configuration.
Re: 100 CPU on any mikrotik router using basic rules
Fri Sep 09, 2016 11:16 am
I dont need QOS or Filtering of LAN, i just need QOS for WAN,
But i guess i have some general flaw in my configurations, i dont know how else to create QOS without bridge?And ip Filter enabled.
What i need is for simplest example.
LAN1 > CONNECTED TO ADSL ROUTER
LAN2 > OUTPUT TO MAIN SWTICH
I need QOS(QUEUES) on this interfaces to control ADSL traffic
How do i make mangle/firewall rules etc and route traffic between PORTS LAN1 and LAN2 without bridging them?
Just masquerading them should work?And firewall/mangle/queues should work without bridging them?
In addition i want to serve WLAN on the same router and i dont need any kind of traffic control for this(except WAN queue i mentioned above), but i need 2 SSIDS separated from each other.
Re: 100 CPU on any mikrotik router using basic rules
Fri Sep 09, 2016 12:33 pm
hAP ac is dual radio, so using one for users and one for guests is not optimal. Look into VirtualAP interfaces and create separate virtualAP for guests on both interfaces.
Then draw your setup and check with packet flow diagram what goes where and check ‘/tool profile’ what is eating away on your CPU.
Re: 100 CPU on any mikrotik router using basic rules
Fri Sep 09, 2016 2:16 pm
It will serve you as a very good, simple, best practice reference to evolve/add on top from there. Take another router not in production, load the config, and play with it.
RouterOS as its name implies, routes by default, i.e. forwards IP packets not addressed to itself to their destinations. Let’s consider the utmost basic routing setup that will provide internet access, from a router with a complete blank setup: i.e. resetted to no defaults, no bridges at all:
— WAN has an IP assigned (192.168.1.244/24 in your case)
— LAN has a different network range IP assigned (lets consider just one network for now, 192.168.2.1/24)
— A default route (0.0.0.0/0) is set with a reachable gateway; this is known as default gateway (192.168.1.254 in your case)
— A masquerade rule is in place for all traffic exiting (out-interface) by the WAN interface.
If you take a laptop, and plug it into the LAN ether port, setting its ethernet IP as 192.168.2.2/24, 192.168.2.1 as default GW, you’ll be able to reach internet (ping 8.8.8.8 for example), because the Hap will route (forward) anything addressed to other than its «known» networks through the default gw, 192.168.1.254.
192.168.1.0/24 and 192.168.2.0/24 are known networks for it because you set IPs in the 192.168.1.0/24 and 192.168.2.0/24 ranges to its interfaces. That’s all RouterOS need to know these networks are directly connected to it.
If you add another network, say LAN2 and assign an ip on top, say 192.168.3.1/24, and connect a laptop to LAN2, setting laptop’s ethernet IP in the 192.168.3.0/24 range, with default gw 192.168.3.1/24, it will be able also to reach internet, no need for any bridges.
Why? because the both the Hap knows how to reach 192.168.3.0/24 (through LAN2), and the laptop know who to hand out traffic addressed to any network other than those known to it (192.168.3.0/24) by forwarding to its default gw, 192.168.3.1, through its ethernet.
An important thing when routing between two hosts, is both hosts need to know how to reach each other. In this last example, the Hap knows all traffic addressed to 192.168.3.0/24 should exit by LAN2 due to the IP/mask assigned to it, and the laptop knows how to reach 192.168.3.0/24 for the same reason; setting the default GW on the laptop will instruct it to send any traffic addressed to any unknown networks through its default GW, 192.168.3.1.
Now to filtering:
You’ll had noticed firewall, filter, mangle, nat, use chains; the forward chain is the one for all forwarded traffic, i.e. All traffic traversing the router.
Now let’s pretend you don’t want the LAN1 network, 192.168.2.0/24 to be able to reach 192.168.3.0/24. Setting an ip > firewall > rule like
Will take care of that.
Suppose you don’t want 192.168.3.0/24 to reach 192.168.2.0/24 either; adding
Will be all the needed rules.
Suppose you want to completely isolate both LANs, regardless of the IPs involved (better practice); a firewall ruleset like