Defense
Firewalls
Commonly used commands for configuring firewalls
Iptables
- Targets
- ACCEPT - allow
- DROP - silently drop without a response
- REJECT - deny and send an ICMP message to indicate the denial
- Listing rules
Normal listing:
With line numbers:
Without reverse DNS lookup:
- Add Rules Block port 110:
Allow multiple ports in one rule:
Allow specific source IP address:
Allow established and related traffic in:
Allow new connections in on specific ports:
Allow outbound related traffic:
Allow new connections on a specific port to a specific destination IP address:
- Flush all rules
- Change default policy
- Delete a rule
Firewalld
- Start the Service
- Stop the Service
- Saving Current Rules
- List Rules
List all rules:
List allowed services:
List direct rules:
- Allow a Service
- Remove a Service
- Add a Rich Rule
- Add Rule to Iptables
Ufw
- Start the Service
- Check the Service Status Basic check:
Check with line numbers:
Verbose check:
- Reset the Rules
- Block Ports Drop packets:
Reject packets:
- Allow Ports For all sources:
For specific sources:
- Delete Rules
- Set Default Policy