Using `iptables` on Linux

preview_player
Показать описание
In this video, I show you how to use iptables to firewall inbound traffic on your Linux server or home computer.

Here's some useful commands:

# enable all traffic on localhost
iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT
# list all rules
iptables -L -n
# accept traffic on HTTP and HTTPS
iptables -A INPUT -p tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp --dport 443 -j ACCEPT
# set the policy to DROP
iptables -P INPUT DROP

# an extra one not shown in the video: this will allow all outgoing traffic for already established TCP connections. This is important if you limit inbound traffic as well as outgoing traffic.
iptables -A OUTPUT -p tcp --dport 513:65535 --state ESTABLISHED -j ACCEPT

# delete the fifth input rule
iptables -D INPUT 5
Рекомендации по теме
Комментарии
Автор

Very nice. I like how you use a real life example

kalyanirajalingham
Автор

6 Years later and this video helped me out a ton! Thanks man!

anthonyashford
Автор

You've got an interesting channel and this is a nice video.

dsulvadarius
Автор

Is there a way to throttle bandwidth for specific applications (not ports)? Maybe using iptables or sth else.

Mono
Автор

What distro are you running on your Linux computer?

macuser
Автор

Thanks for the explanation, but I was hoping to see how to block specific servers using iptables, assuming that's possible.

VulcanOnWheels
Автор

i accidentally set policy to drop and now i cant connect to ssh help!!!

ianhuang
Автор

but nmap doesnot showing open ports how to see

abhisarkar
Автор

4K recording? what? how?... *mind explodes*

rocktheworldk