linux port control (open - Prohibition)

Block access to port 80
iptables -I INPUT -p tcp --dport 80 -j DROP

allows the machine to 192.168.1.1 ip access
iptables -I INPUT -p tcp -s 192.168.1.1 --dport 80 -j ACCEPT

allow ip 192.168 network of machines to access
iptables -I INPUT -p tcp -s 192.168.1.1/16 --dport 80 -j ACCEPT

allow access to all ip
iptables -I INPUT -p tcp --dport 80 -j ACCEPT

view the list of rules
iptables -L

Guess you like

Origin www.cnblogs.com/duanlinxiao/p/10929872.html