natd демон использует 100% CPU

Простые/общие вопросы по UNIX системам. Спросите здесь, если вы новичок

Модераторы: vadim64, terminus

Правила форума
Убедительная просьба юзать теги [cоde] при оформлении листингов.
Сообщения не оформленные должным образом имеют все шансы быть незамеченными.
Arnezami
рядовой
Сообщения: 49
Зарегистрирован: 2008-04-19 17:51:46

natd демон использует 100% CPU

Непрочитанное сообщение Arnezami » 2016-10-28 19:31:13

Добрый день ув. господа!

Неделю назад начались чудеса с маршрутизатором, настроенным на FreeBSD 7.2-RELEASE FreeBSD 7.2-RELEASE. Работает успешно уже много лет, я уже и консоль начал забывать. Но случилась беда:

Регулярно вечером, по непонятным причинам процесс natd загружает в полку процессор, возрастают пинги до 500 мс, падает инет у всех.
При изменении внешнего IP все становится в норму (провайдер выделил два айпи), через время ситуация повторяется уже с новым IP. Приходится прыгать между айпишниками. Спустя 10-30 минут все становиться в норму.
Было подозрение на атаку (добродетелей хватает), но трафик очень низкий, может какой то особый вид атаки на nat?
Прошу срочной помощи, очень сильно страдают пользователи.
У кого какие идеи? Заранее спасибо.
Последний раз редактировалось f_andrey 2016-10-28 19:58:36, всего редактировалось 1 раз.
Причина: Автору. пожалуйста, выбирайте соответствующий раздел форума, приводите больше данных, это повысит вероятность ответа

Хостинговая компания Host-Food.ru
Хостинг HostFood.ru
 

Услуги хостинговой компании Host-Food.ru

Хостинг HostFood.ru

Тарифы на хостинг в России, от 12 рублей: https://www.host-food.ru/tariffs/hosting/
Тарифы на виртуальные сервера (VPS/VDS/KVM) в РФ, от 189 руб.: https://www.host-food.ru/tariffs/virtualny-server-vps/
Выделенные сервера, Россия, Москва, от 2000 рублей (HP Proliant G5, Intel Xeon E5430 (2.66GHz, Quad-Core, 12Mb), 8Gb RAM, 2x300Gb SAS HDD, P400i, 512Mb, BBU):
https://www.host-food.ru/tariffs/vydelennyi-server-ds/
Недорогие домены в популярных зонах: https://www.host-food.ru/domains/

Аватара пользователя
Neus
капитан
Сообщения: 1980
Зарегистрирован: 2008-09-08 21:59:56

natd демон использует 100% CPU

Непрочитанное сообщение Neus » 2016-10-28 20:09:03

Какие-то изменения предшествовали чудесам?
Количество юзеров увеличилось?
Кто-то с локалки бомбит пакетами (торренты?)
Сетевуха глючит, старая стала, устаёт …
•••
В логах есть чего?
Physics is mathematics with the constraint of reality.
Engineering is physics with the constraint of money.

LOR захватили ситхи.
Добро пожаловать на светлую сторону!

snorlov
подполковник
Сообщения: 3927
Зарегистрирован: 2008-09-04 11:51:25
Откуда: Санкт-Петербург

natd демон использует 100% CPU

Непрочитанное сообщение snorlov » 2016-10-29 0:23:29

Arnezami,
Если считаете, что все в локалки чисто, то попробуйте перейти на ядерный нат... А так ..., обновитесь хотя до 9.3.

Arnezami
рядовой
Сообщения: 49
Зарегистрирован: 2008-04-19 17:51:46

natd демон использует 100% CPU

Непрочитанное сообщение Arnezami » 2016-10-29 1:46:24

Neus писал(а):Какие-то изменения предшествовали чудесам?
Количество юзеров увеличилось?
Кто-то с локалки бомбит пакетами (торренты?)
Сетевуха глючит, старая стала, устаёт …
•••
В логах есть чего?
1. Кол-во юзеров не увеличивалось
2. Канал стабильный, когда начинаются чудеса, канал свободный, не нагружен
3. По локалке все чисто
4. Сетевухи профессиональные PCI-E Intel, работают верой и правдой уже много лет.
5. Логи выложу

Дисковое пространство

Код: Выделить всё

[root@arnezami ~]# df -h
Filesystem     Size    Used   Avail Capacity  Mounted on
/dev/ad4s2a    224G     19G    186G     9%    /
devfs          1.0K    1.0K      0B   100%    /dev
devfs          1.0K    1.0K      0B   100%    /var/named/dev
Интересные вещи нашел в логах: Кто то с Индии пытается прорваться, не очень настойчиво
/var/log/auth.log

Код: Выделить всё

Oct 26 11:10:11 arnezami sshd[902]: Server listening on :: port 22.
Oct 26 11:10:11 arnezami sshd[902]: Server listening on 0.0.0.0 port 22.
Oct 26 11:12:46 arnezami sshd[1004]: error: PAM: authentication error for root from 192.168.0.2
Oct 26 11:12:54 arnezami sshd[1004]: Accepted keyboard-interactive/pam for root from 192.168.0.2 port 1043 ssh2
Oct 26 11:19:11 arnezami sshd[1337]: Accepted keyboard-interactive/pam for root from 192.168.0.2 port 1104 ssh2
Oct 26 13:01:34 arnezami sshd[2372]: Accepted keyboard-interactive/pam for root from 192.168.0.2 port 4389 ssh2
[b]Oct 27 04:16:16 arnezami ftpd[10244]: FTP LOGIN FAILED FROM 61.5.206.130, www-data
Oct 27 09:23:51 arnezami ftpd[12926]: FTP LOGIN FAILED FROM 117.239.186.154, test[/b]
Oct 27 23:58:32 arnezami sshd[21033]: Accepted keyboard-interactive/pam for root from 192.168.0.216 port 50141 ssh2
Oct 28 16:57:22 arnezami sshd[33899]: Accepted keyboard-interactive/pam for root from 192.168.0.2 port 10162 ssh2
[b]Oct 28 18:14:09 arnezami ftpd[35365]: FTP LOGIN FAILED FROM 169.149.165.85, admin[/b]
Oct 28 18:40:56 arnezami sshd[35671]: Accepted keyboard-interactive/pam for root from 192.168.0.216 port 1591 ssh2
Oct 28 23:06:09 arnezami sshd[42092]: Accepted keyboard-interactive/pam for root from 192.168.0.216 port 15732 ssh2
Oct 28 23:16:18 arnezami webmin[42238]: Non-existent login as root from 192.168.0.216 
Oct 28 23:16:22 arnezami webmin[42236]: Non-existent login as root from 192.168.0.216 
Oct 28 23:16:27 arnezami webmin[42237]: Non-existent login as arnezami from 192.168.0.216 
Oct 28 23:16:47 arnezami webmin[42276]: Invalid login as admin from 192.168.0.216 
Oct 28 23:16:49 arnezami webmin[858]: Security alert: Host 192.168.0.216 blocked after 5 failed logins for user admin 
Oct 28 23:16:50 arnezami webmin[42281]: Invalid login as admin from 192.168.0.216 
Oct 28 23:19:15 arnezami webmin[42328]: Invalid login as admin from 192.168.0.216 
Oct 28 23:20:25 arnezami webmin[42332]: Invalid login as admin from 192.168.0.216 
Oct 28 23:20:35 arnezami webmin[42365]: Successful login as admin from 192.168.0.216 
Вот еще очень интересный список коннектов к Webmin, вероятно здесь зарыто "чудо": Кто то очень настойчиво пытается прорваться

Код: Выделить всё

Failed to initialize SSL connection
[27/Oct/2016:15:24:07 +0000] [173.224.126.219] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[27/Oct/2016:15:24:07 +0000] [173.224.126.219] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[27/Oct/2016:15:51:53 +0000] [204.93.154.217] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[27/Oct/2016:17:19:00 +0000] [104.152.52.71] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[27/Oct/2016:18:02:36 +0000] [104.152.52.58] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[27/Oct/2016:20:22:19 +0000] [204.93.154.208] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[27/Oct/2016:20:47:11 +0000] [62.168.227.162] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[27/Oct/2016:20:47:11 +0000] [62.168.227.162] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[27/Oct/2016:20:47:11 +0000] [62.168.227.162] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[27/Oct/2016:20:56:16 +0000] [104.152.52.55] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[27/Oct/2016:22:09:52 +0000] [104.152.52.55] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[27/Oct/2016:23:17:27 +0000] [104.152.52.60] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:00:02:17 +0000] [104.152.52.73] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:01:06:35 +0000] [104.152.52.56] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:01:53:48 +0000] [104.152.52.67] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:03:11:47 +0000] [104.152.52.62] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:04:13:49 +0000] [204.93.154.208] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:04:49:07 +0000] [104.152.52.74] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:05:44:39 +0000] [104.152.52.55] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:06:53:49 +0000] [104.152.52.75] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:07:58:38 +0000] [104.152.52.68] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:09:07:07 +0000] [204.93.154.208] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:10:14:39 +0000] [104.152.52.70] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:10:59:39 +0000] [104.152.52.55] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:12:08:52 +0000] [104.152.52.70] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:13:07:01 +0000] [104.152.52.59] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:13:57:56 +0000] [104.152.52.62] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:15:32:45 +0000] [204.93.154.217] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:15:48:48 +0000] [104.152.52.70] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:16:57:55 +0000] [104.152.52.55] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:19:15:55 +0000] [104.152.52.56] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:20:04:10 +0000] [104.152.52.71] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
[28/Oct/2016:20:57:52 +0000] [104.152.52.65] Bad Request : This web server is running in SSL mode. Try the URL <a href='https://202.54.87.109.triolan.net:10000/'>https://202.54.87.109.triolan.net:10000/</a> instead.<br>
Отправлено спустя 50 секунд:
snorlov писал(а):Arnezami,
Если считаете, что все в локалки чисто, то попробуйте перейти на ядерный нат... А так ..., обновитесь хотя до 9.3.
Согласен, уже давно пора обновиться, сервер так стабильно трудился, что уже 11 релиз вышел, а я и не заметил)

Отправлено спустя 16 минут 40 секунд:
Еще заметил сообщения в дополнение, их очень много, почти 1GB накопилось, с такого рода содержанием
Видимо кто то из Индии настойчиво пытается ломануть.
Видимо надо просто индусские сети все в бан.

Код: Выделить всё

Checking setuid files and devices:

Checking for uids of 0:
root 0
toor 0

Checking for passwordless accounts:

Checking login.conf permissions:

arnezami.com ipfw denied packets:
+++ /tmp/security.uRzh2cYQ	2016-10-22 03:02:31.000000000 +0000
+00078        213        11380 deny tcp from any to me dst-port 22 via em0

arnezami.com login failures:
Oct 21 16:03:35 arnezami ftpd[73231]: FTP LOGIN FAILED FROM 77.81.224.70, admin
Oct 21 21:56:12 arnezami ftpd[76762]: FTP LOGIN FAILED FROM 109.172.78.171, test

arnezami.com refused connections:

-- End of security output --

snorlov
подполковник
Сообщения: 3927
Зарегистрирован: 2008-09-04 11:51:25
Откуда: Санкт-Петербург

natd демон использует 100% CPU

Непрочитанное сообщение snorlov » 2016-10-29 11:07:54

сети 192.168.*.* на внешнем интерфейсе заблокированы?

Arnezami
рядовой
Сообщения: 49
Зарегистрирован: 2008-04-19 17:51:46

natd демон использует 100% CPU

Непрочитанное сообщение Arnezami » 2016-10-29 20:32:36

snorlov писал(а):сети 192.168.*.* на внешнем интерфейсе заблокированы?

add 50 allow ip from any to any in via em1
add 51 allow ip from any to any out via em1
add 52 allow ip from 109.87.54.202 to any out via em0
add 53 divert natd ip from any to 109.87.54.202 in via em0
add 54 deny ip from any to any via em1
add 55 allow all from any to 127.0.0.0/8
add 56 allow all from any to any via lo0
add allow all from 127.0.0.0/8 to any
add 57 allow udp from any to me 53 in recv em1
add 58 allow udp from me 53 to any out xmit em1
add 59 allow udp from any 53 to me in recv em1
add 60 allow udp from me to any 53 out xmit em1
add 61 allow tcp from any to me 53 in recv em1 setup
add 62 allow udp from any to me 53 in recv em0
add 63 allow udp from me 53 to any out xmit em0
add 64 allow udp from any 53 to me in recv em0
add 65 allow udp from me to any 53 out xmit em0
add 66 allow tcp from any to me 53 in recv em0 setup
add 69 deny ip from any to 169.254.0.0/16 in via em1
add 71 allow udp from any to any in via em1
add 72 allow udp from any to any in via em0
add 74 allow tcp from me 1723 to any keep-state
add 75 allow gre from any to any
add 76 allow tcp from 192.168.0.0/24 to me 22 via em1
add 77 allow tcp from 217.12.211.177 to me 22 via em0
add 78 allow tcp from 178.151.225.248 to me 22 via em0
add 78 deny tcp from any to me 22 via em0

snorlov
подполковник
Сообщения: 3927
Зарегистрирован: 2008-09-04 11:51:25
Откуда: Санкт-Петербург

natd демон использует 100% CPU

Непрочитанное сообщение snorlov » 2016-10-30 17:55:32

А сами то как думаете, у вас есть файер на компе или нет, по вашим правилам я считаю его нет...

Arnezami
рядовой
Сообщения: 49
Зарегистрирован: 2008-04-19 17:51:46

natd демон использует 100% CPU

Непрочитанное сообщение Arnezami » 2016-10-30 20:06:03

snorlov писал(а):А сами то как думаете, у вас есть файер на компе или нет, по вашим правилам я считаю его нет...
согласен, я настройку делал когда только изучал фрю
немного дописал правил, уже получше стало, по серым адресам большое кол-во пакетов дропнуто.

если есть какие рекомендации по улучшению, буду благодарен.

Код: Выделить всё

add 50 allow ip from any to any in via em1
add 51 allow ip from any to any out via em1
add 52 allow ip from 109.87.54.202 to any out via em0
add 53 divert natd ip from any to 109.87.54.202 in via em0
add 55 allow all from any to 127.0.0.0/8
add 56 allow all from any to any via lo0
add 57 allow udp from any to me 53 in recv em1
add 58 allow udp from me 53 to any out xmit em1
add 59 allow udp from any 53 to me in recv em1
add 60 allow udp from me to any 53 out xmit em1
add 61 allow tcp from any to me 53 in recv em1 setup
add 62 allow udp from any to me 53 in recv em0
add 63 allow udp from me 53 to any out xmit em0
add 64 allow udp from any 53 to me in recv em0
add 65 allow udp from me to any 53 out xmit em0
add 66 allow tcp from any to me 53 in recv em0 setup
add 71 allow udp from any to any in via em1
add 72 allow udp from any to any in via em0
add 74 allow tcp from me 1723 to any keep-state
add 75 allow gre from any to any
add 76 allow tcp from 192.168.0.0/24 to me 22 via em1
add 77 allow tcp from 217.12.213.84 to me 22 via em0
add 78 deny tcp from any to me 22 via em0

[b]add 79 deny all from 192.168.0.0/16 to any in via em0
add 80 deny all from 172.16.0.0/12 to any in via em0
add 81 deny all from 10.0.0.0/8 to any in via em0
add 82 deny all from 127.0.0.0/8 to any in via em0
add 83 deny all from 0.0.0.0/8 to any in via em0
add 84 deny all from 169.254.0.0/16 to any in via em0
add 85 deny all from 192.0.2.0/24 to any in via em0
add 86 deny all from 204.152.64.0/23 to any in via em0
add 87 deny all from 224.0.0.0/3 to any in via em0
add 54 deny ip from any to any via em1[/b]

[b]add 69 deny ip from any to 169.254.0.0/16 in via em1
add 88 deny tcp from any to any 137 in via em0
add 89 deny tcp from any to any 138 in via em0
add 90 deny tcp from any to any 139 in via em0
add 91 deny tcp from any to any 81 in via em0[/b]