IPTables - не видит сервер в мониторинге.

Rolzzandik

Участник
Сообщения
492
Реакции
234
Всем привет! Нуждаюсь в вашей помощи, уже кукуха едет от IPTABLES.
Rules:
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -t nat -X
iptables -t mangle -X
//Затираю все правила(тк проверяю)
iptables -P INPUT DROP


iptables -A INPUT -p tcp --dport 80 -j ACCEPT  //http
iptables -A INPUT -p tcp --dport 443 -j ACCEPT  //https
iptables -A INPUT -p udp --dport 80 -j ACCEPT  //http
iptables -A INPUT -p udp --dport 443 -j ACCEPT  //https
iptables -A INPUT -p tcp --dport 22 -j ACCEPT  //ssh
iptables -A INPUT -p udp --dport 22 -j ACCEPT  //ssh
iptables -A INPUT -p tcp --dport 64926 -j ACCEPT //wireguard vpn
iptables -A INPUT -p udp --dport 64926 -j ACCEPT //wireguard vpn
iptables -A INPUT -p tcp --dport 3306 -j ACCEPT //mysql
iptables -A INPUT -p udp --dport 3306 -j ACCEPT //mysql
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT //ping
iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT  //ping

iptables -A INPUT -p udp --dport 27014 -m hashlimit --hashlimit 100/s --hashlimit-burst 100 --hashlimit-mode srcip --hashlimit-name arena -j ACCEPT
iptables -A INPUT -p udp --dport 27014 -j DROP                 //хешлимит 1 сервер
iptables -A INPUT -p udp --dport 27015 -m hashlimit --hashlimit 100/s --hashlimit-burst 100 --hashlimit-mode srcip --hashlimit-name mmhvh -j ACCEPT
iptables -A INPUT -p udp --dport 27015 -j DROP                 //хешлимит 2 сервер
iptables -A INPUT -p udp --dport 27016 -m hashlimit --hashlimit 100/s --hashlimit-burst 100 --hashlimit-mode srcip --hashlimit-name dmhvh -j ACCEPT
iptables -A INPUT -p udp --dport 27016 -j DROP                  //хешлимит 3 сервер
iptables -A INPUT -p udp --dport 27017 -m hashlimit --hashlimit 100/s --hashlimit-burst 100 --hashlimit-mode srcip --hashlimit-name legacy -j ACCEPT
iptables -A INPUT -p udp --dport 27017 -j DROP                  //хешлимит 4 сервер


iptables -t nat -A POSTROUTING -s 10.141.236.0/24 -o ens3 -j SNAT --to-source 95.214.10.171 //трансляция подсети на реальный ip
iptables -t nat -A POSTROUTING -s 10.141.236.0/24 -j MASQUERADE //транслитерация подсети
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27015 -j DNAT --to-destination 10.141.236.10:27015 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27015 -j DNAT --to-destination 10.141.236.10:27015 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27014 -j DNAT --to-destination 10.141.236.10:27014  //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27014 -j DNAT --to-destination 10.141.236.10:27014 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27016 -j DNAT --to-destination 10.141.236.10:27016 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27016 -j DNAT --to-destination 10.141.236.10:27016 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 40819 -j DNAT --to-destination 10.141.236.10:3389 //переадресация порта (rdp)
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 40819 -j DNAT --to-destination 10.141.236.10:3389 //переадресация порта (rdp)
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27017 -j DNAT --to-destination 10.141.236.11:27017 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27017 -j DNAT --to-destination 10.141.236.11:27017 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 222 -j DNAT --to-destination 10.141.236.11:22 //переадресация порта (ssh)
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 222 -j DNAT --to-destination 10.141.236.11:22 //переадресация порта (ssh)

В чем мем? Все правила работают отлично, но с одним исключением.
Сейчас стоят такие правила iptables и к серверу можно подключиться, и он показывается в мониторинге csgo:
1593836137427.png

Но в sb/lk он не показывается:
1593836183279.png

sb_debug_connection:
1593836235141.png



В чем может быть проблема?
 
Решение
Всем привет! Нуждаюсь в вашей помощи, уже кукуха едет от IPTABLES.
Rules:
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -t nat -X
iptables -t mangle -X
//Затираю все правила(тк проверяю)
iptables -P INPUT DROP


iptables -A INPUT -p tcp --dport 80 -j ACCEPT  //http
iptables -A INPUT -p tcp --dport 443 -j ACCEPT  //https
iptables -A INPUT -p udp --dport 80 -j ACCEPT  //http
iptables -A INPUT -p udp --dport 443 -j ACCEPT  //https
iptables -A INPUT -p tcp --dport 22 -j ACCEPT  //ssh
iptables -A INPUT -p udp --dport 22 -j ACCEPT  //ssh
iptables -A INPUT -p tcp --dport 64926 -j ACCEPT //wireguard vpn
iptables -A INPUT -p udp --dport 64926 -j ACCEPT //wireguard vpn
iptables -A INPUT -p tcp --dport 3306 -j ACCEPT...

Rolzzandik

Участник
Сообщения
492
Реакции
234
Нужно отдельно разрешить RCON-порт.
а rcon порт каким является?
просто мне понадобилась примитивная ddos защита и я использовал такие правила раньше(без примитивной DDOS защиты) и все работало
Правила:
iptables -t nat -A POSTROUTING -s 10.141.236.0/24 -o ens3 -j SNAT --to-source 95.214.10.171
iptables -t nat -A POSTROUTING -s 10.141.236.0/24 -j MASQUERADE
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27015 -j DNAT --to-destination 10.141.236.10:27015
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27015 -j DNAT --to-destination 10.141.236.10:27015
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27014 -j DNAT --to-destination 10.141.236.10:27014
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27014 -j DNAT --to-destination 10.141.236.10:27014
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27016 -j DNAT --to-destination 10.141.236.10:27016
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27016 -j DNAT --to-destination 10.141.236.10:27016
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 40819 -j DNAT --to-destination 10.141.236.10:3389
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 40819 -j DNAT --to-destination 10.141.236.10:3389
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27017 -j DNAT --to-destination 10.141.236.11:27017
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27017 -j DNAT --to-destination 10.141.236.11:27017
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 222 -j DNAT --to-destination 10.141.236.11:22
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 222 -j DNAT --to-destination 10.141.236.11:22
 

NaN

FPE_INTDIV_TRAP
Сообщения
1,513
Реакции
1,487
а rcon порт каким является?
просто мне понадобилась примитивная ddos защита и я использовал такие правила раньше(без примитивной DDOS защиты) и все работало
Правила:
iptables -t nat -A POSTROUTING -s 10.141.236.0/24 -o ens3 -j SNAT --to-source 95.214.10.171
iptables -t nat -A POSTROUTING -s 10.141.236.0/24 -j MASQUERADE
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27015 -j DNAT --to-destination 10.141.236.10:27015
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27015 -j DNAT --to-destination 10.141.236.10:27015
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27014 -j DNAT --to-destination 10.141.236.10:27014
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27014 -j DNAT --to-destination 10.141.236.10:27014
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27016 -j DNAT --to-destination 10.141.236.10:27016
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27016 -j DNAT --to-destination 10.141.236.10:27016
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 40819 -j DNAT --to-destination 10.141.236.10:3389
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 40819 -j DNAT --to-destination 10.141.236.10:3389
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27017 -j DNAT --to-destination 10.141.236.11:27017
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27017 -j DNAT --to-destination 10.141.236.11:27017
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 222 -j DNAT --to-destination 10.141.236.11:22
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 222 -j DNAT --to-destination 10.141.236.11:22
А, забейте, фигню написал. Думаю нужно дождаться большего эксперта в IPTables)
Можно попробовать переключить INPUT в ACCEPT по-умолчанию и посмотреть. Тогда точно можно будет понять правила это виноваты или что-то не добавили.
 

Rolzzandik

Участник
Сообщения
492
Реакции
234
Можно попробовать переключить INPUT в ACCEPT по-умолчанию и посмотреть. Тогда точно можно будет понять правила это виноваты или что-то не добавили.
если правил нету(за исключением тех, что ниже, тк они нужны для nat форвардинга) - то все работает

Rules:
iptables -t nat -A POSTROUTING -s 10.141.236.0/24 -o ens3 -j SNAT --to-source 95.214.10.171
iptables -t nat -A POSTROUTING -s 10.141.236.0/24 -j MASQUERADE
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27015 -j DNAT --to-destination 10.141.236.10:27015
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27015 -j DNAT --to-destination 10.141.236.10:27015
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27014 -j DNAT --to-destination 10.141.236.10:27014
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27014 -j DNAT --to-destination 10.141.236.10:27014
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27016 -j DNAT --to-destination 10.141.236.10:27016
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27016 -j DNAT --to-destination 10.141.236.10:27016
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 40819 -j DNAT --to-destination 10.141.236.10:3389
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 40819 -j DNAT --to-destination 10.141.236.10:3389
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27017 -j DNAT --to-destination 10.141.236.11:27017
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27017 -j DNAT --to-destination 10.141.236.11:27017
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 222 -j DNAT --to-destination 10.141.236.11:22
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 222 -j DNAT --to-destination 10.141.236.11:22
 

White Wolf

🍉
Сообщения
2,382
Реакции
2,187
  • Команда форума
  • #6
Всем привет! Нуждаюсь в вашей помощи, уже кукуха едет от IPTABLES.
Rules:
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -t nat -X
iptables -t mangle -X
//Затираю все правила(тк проверяю)
iptables -P INPUT DROP


iptables -A INPUT -p tcp --dport 80 -j ACCEPT  //http
iptables -A INPUT -p tcp --dport 443 -j ACCEPT  //https
iptables -A INPUT -p udp --dport 80 -j ACCEPT  //http
iptables -A INPUT -p udp --dport 443 -j ACCEPT  //https
iptables -A INPUT -p tcp --dport 22 -j ACCEPT  //ssh
iptables -A INPUT -p udp --dport 22 -j ACCEPT  //ssh
iptables -A INPUT -p tcp --dport 64926 -j ACCEPT //wireguard vpn
iptables -A INPUT -p udp --dport 64926 -j ACCEPT //wireguard vpn
iptables -A INPUT -p tcp --dport 3306 -j ACCEPT //mysql
iptables -A INPUT -p udp --dport 3306 -j ACCEPT //mysql
iptables -A INPUT -p icmp --icmp-type echo-request -j ACCEPT //ping
iptables -A OUTPUT -p icmp --icmp-type echo-reply -j ACCEPT  //ping

iptables -A INPUT -p udp --dport 27014 -m hashlimit --hashlimit 100/s --hashlimit-burst 100 --hashlimit-mode srcip --hashlimit-name arena -j ACCEPT
iptables -A INPUT -p udp --dport 27014 -j DROP                 //хешлимит 1 сервер
iptables -A INPUT -p udp --dport 27015 -m hashlimit --hashlimit 100/s --hashlimit-burst 100 --hashlimit-mode srcip --hashlimit-name mmhvh -j ACCEPT
iptables -A INPUT -p udp --dport 27015 -j DROP                 //хешлимит 2 сервер
iptables -A INPUT -p udp --dport 27016 -m hashlimit --hashlimit 100/s --hashlimit-burst 100 --hashlimit-mode srcip --hashlimit-name dmhvh -j ACCEPT
iptables -A INPUT -p udp --dport 27016 -j DROP                  //хешлимит 3 сервер
iptables -A INPUT -p udp --dport 27017 -m hashlimit --hashlimit 100/s --hashlimit-burst 100 --hashlimit-mode srcip --hashlimit-name legacy -j ACCEPT
iptables -A INPUT -p udp --dport 27017 -j DROP                  //хешлимит 4 сервер


iptables -t nat -A POSTROUTING -s 10.141.236.0/24 -o ens3 -j SNAT --to-source 95.214.10.171 //трансляция подсети на реальный ip
iptables -t nat -A POSTROUTING -s 10.141.236.0/24 -j MASQUERADE //транслитерация подсети
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27015 -j DNAT --to-destination 10.141.236.10:27015 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27015 -j DNAT --to-destination 10.141.236.10:27015 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27014 -j DNAT --to-destination 10.141.236.10:27014  //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27014 -j DNAT --to-destination 10.141.236.10:27014 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27016 -j DNAT --to-destination 10.141.236.10:27016 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27016 -j DNAT --to-destination 10.141.236.10:27016 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 40819 -j DNAT --to-destination 10.141.236.10:3389 //переадресация порта (rdp)
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 40819 -j DNAT --to-destination 10.141.236.10:3389 //переадресация порта (rdp)
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 27017 -j DNAT --to-destination 10.141.236.11:27017 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 27017 -j DNAT --to-destination 10.141.236.11:27017 //переадресация порта
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p tcp -m tcp --dport 222 -j DNAT --to-destination 10.141.236.11:22 //переадресация порта (ssh)
iptables -t nat -A PREROUTING -d 95.214.10.171/32 -i ens3 -p udp -m udp --dport 222 -j DNAT --to-destination 10.141.236.11:22 //переадресация порта (ssh)

В чем мем? Все правила работают отлично, но с одним исключением.
Сейчас стоят такие правила iptables и к серверу можно подключиться, и он показывается в мониторинге csgo:
Посмотреть вложение 61093
Но в sb/lk он не показывается:
Посмотреть вложение 61094
sb_debug_connection:
Посмотреть вложение 61095


В чем может быть проблема?
не вижу где вы разрешили TCP для игровых портов. Если бездумно копировать то ничего не заработает.
 
Решение

Rolzzandik

Участник
Сообщения
492
Реакции
234
не вижу где вы разрешили TCP для игровых портов. Если бездумно копировать то ничего не заработает.
дурачек я.
сам указывал на сервер, сюда в вопрос забыл вставить, тк отдельно были.
 

Rolzzandik

Участник
Сообщения
492
Реакции
234

WeSTMan

А вот тут текст!
Сообщения
833
Реакции
516
не, мем в другом был.
Даже не TCP открытии портов.
у меня 2 сервера за NAT, из-за него были некоторые проблемы
Проблему решил?
И вот тебе еще для понимания.
Ты ставишь ограничение кол-во пакетов с адреса в цепочке INPUT, НО если ты используешь PREROUTING, то пакеты попадает в цепочку FORWARD и не попадают в цепочку INPUT.
Если ты хочешь поставить ограничение на кол-во пакетов через NAT, то надо ставить правила на FORWARD. И не забывай, что FORWARD работает в обе стороны
 
Сверху Снизу