WE CODE NOW
  • Home 
  • Blog 
  • Guides 
Guides
  1. Home
  2. Guides
  3. Networking
  4. Setting Up a Basic Firewall

Setting Up a Basic Firewall

Posted on June 1, 2024  (Last modified on June 26, 2024) • 1 min read • 95 words
Networking
 
Firewall
 
Security
 
Configuration
 
Networking
 
Firewall
 
Security
 
Configuration
 
Share via
WE CODE NOW
Link copied to clipboard

Learn how to set up a basic firewall to protect your network from unauthorized access and attacks.

On this page
  • Basic Firewall Configuration
    • Using iptables
    • Persistent Rules

Setting Up a Basic Firewall  

Basic Firewall Configuration  

Using iptables  

Set up a firewall using iptables to control incoming and outgoing traffic. Iptables is a powerful tool for managing network traffic rules.

# Example: Basic iptables rules
sudo iptables -A INPUT -p tcp --dport 22 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT
sudo iptables -A INPUT -j DROP

Persistent Rules  

Ensure iptables rules persist across reboots by saving them to a file and restoring them at boot.

# Example: Saving iptables rules
sudo iptables-save > /etc/iptables/rules.v4
 Network Security Best Practices
Using Wireshark for Network Analysis 
On this page:
  • Basic Firewall Configuration
    • Using iptables
    • Persistent Rules
Copyright © 2025 WE CODE NOW All rights reserved.
WE CODE NOW
Code copied to clipboard