D
D
Dmitry Baskakov2022-03-19 10:17:32
linux
Dmitry Baskakov, 2022-03-19 10:17:32

How to set up a firewall?

I can't set up a firewall with iptables. It is necessary to allow the passage of traffic to the port SSH (tcp / 22) and WireGuard (udp, tcp / 51820), and the request from tcp / 80 and tcp / 443 ports.

Screenshot of what I have now

62358382ce59c862293737.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Karabanov, 2022-03-19
@karabanov

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A INPUT -p tcp -m multiport --dports 22,80,443 -j ACCEPT
iptables -A INPUT -p udp -m multiport --dports 51820 -j ACCEPT
iptables -A INPUT -j REJECT --reject-with icmp-host-prohibited

R
Ruslan Fedoseev, 2022-03-19
@martin74ua

https://www.opennet.ru/docs/RUS/iptables/
well, read it....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question