linux iptables adding rules

View previous topic View next topic Go down

linux iptables adding rules

Post by jamied_uk on 8th October 2015, 01:00

For allowing port 80 in your iptables
Code:
sudo iptables -A INPUT -j ACCEPT -p tcp --destination-port 80 -i eth0


For allowing port 443 (secure web) in your iptables
Code:
sudo iptables -A INPUT -j ACCEPT -p tcp --destination-port 443 -i eth0

List all iptable rules

Code:
sudo iptables -L

To block ping requests (icmp)

Code:
sudo iptables -A INPUT -j DROP -p icmp -i eth0


Drop all that does not match a rule (aka catch all should be at the bottom of the list)
Code:
sudo iptables -A  INPUT -j DROP -p tcp -i eth0


To enable icmp (Ping)
Code:
sudo iptables -A  INPUT -j DROP -p icmp --icmp-type echo-reply -j ACCEPT

Code:
sudo iptables -A  INPUT -j DROP -p icmp --icmp-type echo-request -j ACCEPT









More advanced iptables Vid!



To Port Forward using iptables



~~~~~~~~~~~~~~~~~~~~

For linux firewall command line commands use

Code:
sudo ufw allow 80


Code:
sudo ufw allow 443
avatar
jamied_uk
Admin

Posts : 2199
Join date : 2010-05-09
Age : 34
Location : UK

http://address-shortner.co.uk

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum