service:netfilter
Различия
Показаны различия между двумя версиями страницы.
Предыдущая версия справа и слеваПредыдущая версияСледующая версия | Предыдущая версия | ||
service:netfilter [12.11.2021 06:09] – viacheslav | service:netfilter [30.07.2024 19:21] (текущий) – внешнее изменение 127.0.0.1 | ||
---|---|---|---|
Строка 1: | Строка 1: | ||
+ | <code bash> | ||
+ | # Запретить доступ на 80 порт | ||
+ | iptables -A INPUT -p tcp --destination-port 80 -j DROP | ||
+ | # Запретить пинг | ||
+ | iptables -A INPUT -p icmp -j DROP | ||
+ | # Запретить IP | ||
+ | iptables -I INPUT -s 1.2.3.4 -j DROP | ||
+ | # Запретить исходящий трафик с IP 192.168.1.200 | ||
+ | iptables -A OUTPUT -s 192.168.1.200 -j DROP | ||
+ | |||
+ | # Удалить правило запрета IP | ||
+ | iptables -D INPUT -s 1.2.3.4 -j DROP | ||
+ | |||
+ | # Вывести список правил | ||
+ | iptables -L -n -v --line-numbers | ||
+ | </ | ||
+ | |||
+ | https:// | ||
+ | https:// | ||
+ | |||
+ | Сделать правила постоянными (по умолчанию они живут до перезагрузки) | ||
+ | <code bash> | ||
+ | # In order to make your iptables rules persistent after reboot, install the iptables-persistent package using the apt package manager: | ||
+ | sudo apt install iptables-persistent | ||
+ | # Any currently erected iptables rules will be saved to the corresponding IPv4 and IPv6 files below: | ||
+ | / | ||
+ | / | ||
+ | # To update persistent iptables with new rules simply use iptables command to include new rules into your system. | ||
+ | # To make changes permanent after reboot run iptables-save command: | ||
+ | sudo iptables-save > / | ||
+ | # OR | ||
+ | sudo ip6tables-save > / | ||
+ | </ | ||
+ | To remove persistent iptables rules simply open a relevant ''/ | ||
+ | |||
+ | https:// | ||
+ | |||