Iptables - как как поменять политику по-умолчанию Default Policies Chain: различия между версиями

Материал из Wiki - Iphoster - the best ever hosting and support. 2005 - 2024
Перейти к:навигация, поиск
(Новая страница: «=== Iptables - как как поменять политику по-умолчанию Default Policies Chain === Сбросить все правила: # ipt...»)
 
Строка 17: Строка 17:
  
 
Описание опции для политики iptables:
 
Описание опции для политики iptables:
      -P, --policy chain target
+
  -P, --policy chain target
              Set the policy for the built-in (non-user-defined) chain to the given target.  The policy target must be either ACCEPT or DROP.
+
  Set the policy for the built-in (non-user-defined) chain to the given target.  The policy target must be either ACCEPT or DROP.

Версия 12:30, 30 марта 2023

Iptables - как как поменять политику по-умолчанию Default Policies Chain

Сбросить все правила:

# iptables -F

По-умолчанию - политика - разрешено - ACCEPT, изменить политика на блокировать - DROP для всех цепочек: INPUT, FORWARD, OUTPUT.

# iptables -P INPUT DROP
# iptables -P FORWARD DROP
# iptables -P OUTPUT DROP


Если наоборот стоит уже DROP - то тоже самое, только ACCEPT:

# iptables -P INPUT ACCEPT
# iptables -P FORWARD ACCEPT
# iptables -P OUTPUT ACCEPT

Описание опции для политики iptables:

  -P, --policy chain target
  Set the policy for the built-in (non-user-defined) chain to the given target.  The policy target must be either ACCEPT or DROP.