EDUCBA

EDUCBA

MENUMENU
  • Blog
  • Free Courses
  • All Courses
  • All in One Bundle
  • Login
Home Software Development Software Development Tutorials Software Development Basics Firewall Rules

Firewall Rules

Updated April 1, 2023

Firewall Rules

Introduction to Firewall Rules

The firewall rules we need to use to manage the incoming traffic as well as the outgoing traffic. In the network, we are mainly following the two protocols like TCP and UDP. The TCP protocol will provide the message with acknowledging reliability. But on the other hand, in the UDP protocol, we are not getting any reliability on the message delivery to acknowledge. At the firewall level, generally, we are using the TCP protocol. Here, the firewall will work on level 7. Level 7 is nothing but an application level. On the firewall level, we can directly apply the policy at the application level also. The firewall rules management will vary from platform to platform like the OS, Hardware, etc. We can also manage the firewall rule in terms of the software level and the hardware level.

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

Syntax of Firewall Rules

In syntax, we can categories it into two different parts. First, it is on the actual hardware level, and second, it is on the operating system level.

  • Hardware Level: We are having a number of firewall hardware devices available in the market. Every device belongs to a different vendor and having different features as well as the configuration. Hence, there are different methods to configure the file rules.
  • Operating System: Every operating system like Linux, Windows, MAC has its own firewall. Here, if we need to do the firewall rule changes, you can use the UI or the CLI depending on the operating system availability.

Syntax:

firewalld [OPTIONS...]

  • firewalld: We can use the firewalld keyword in the syntax or command. It will accept different arguments like compatible options etc. As per the provided input, the firewalld will be able to do the changes in the firewall level. Therefore, the firewalld command will help to manage the different firewall related tasks as well.
  • OPTIONS: As per the requirement, we can provide the different flags as the option that is compatible with the firewalld command.
Note: The above syntax is for the Linux environment.

How Firewall Rules Works?

  • As we have seen, the firewall rules are for traffic filtration. While we are adding any firewall rules, the rules entry will be made in the firewall config. When any network traffic comes, then the files will check the set of rules available. As per the rules, the firewall will take the decision. The decision has three options like accept, drop, or reject. Every action has its own meaning. The same keyword will help the firewall to take the necessary action on the same. In other words, the accept, drop or reject is acts as an action for the firewall. As per the necessary action, the firewall will take the necessary action. If accepted, the firewall will allow the network traffic to flow on the specific URL or the port. If it is a reject action, then the firewall will block the network traffic to flow on the specific URL or the port and provide the error message like “unreachable” error. If it is a drop action, then the firewall will drop the network traffic to flow on the specific URL or the port without any error message.
  • In the firewall rules, it depends on the incoming and outgoing traffic. In the normal server and client communication, there is incoming and outgoing traffic. The incoming traffic will help to understand the network tariff or the network packet is coming from the external world. The traffic is having basic information like the port no, URL address, data information, etc. In the incoming firewall rule, we need to identify that the data or the network traffic comes from the external world. Which is correct or not. If it is correct, then only the firewall will allow passing the traffic to the system. Similarly, there is outgoing traffic. Normally in the outbound rule, we are open for all the network traffic. It will depend on the requirement that we need to define the outbound rule or not.

Examples of Firewall Rules

Given below are the examples of Firewall Rules:

Example #1

Firewall Rules: At the Windows Platform.

As we have seen, there are different firewall devices (from different vendors) available. Therefore, we need to follow different processes and methods in terms of the firewall rule. Similarly, we can manage the firewall rules in terms of the hardware or the software level also. Here, we are working on the windows operating system firewall rules.

Code:

It is not a specific syntax; we just need to follow the access flow.

Windows key -> search for control panel -> windows firewall -> Advance setting -> Click for the new rules.

Explanation:

  • As per the above flow, we are able to add the new firewall rule in the Windows environment. In the windows environment, it is a bit easy to do that. But we need an administrator or full access to the respective operating system.

Output:

Windows Platform

Firewall Rules 2

New Outbound Rule Wizard

Example #2

Firewall Rules: At the Linux Platform.

In every operating system, the firewall service is running on. We can also manage the firewall rules also. For example, it will help to allow or disable the network traffic in the system.

Code:

firewall-cmd --zone=public --permanent --add-port=25/tcp --add-port=549/tcp
firewall-cmd –reload
firewall-cmd --info-zone public

Explanation:

  • As per the above command, we are using the 3 commands. As per the below screenshot, we are getting the default firewall zone information. We are doing changes in the firewall rules and adding the new rule with the ports 25 and 549 ports.

Output:

Firewall Rules 4

Firewall Rules 5

Conclusion

We have seen the uncut concept of the “firewall rules” with the proper example, explanation and command with different outputs. It helps to filter the inbound network traffic as well as the outbound network traffic. The firewall is working on the TCP layer at level 7.

Recommended Articles

This is a guide to Firewall Rules. Here we discuss the introduction, how firewall rules works? And examples, respectively. You may also have a look at the following articles to learn more –

  1. Firewall Devices
  2. Firewall Uses
  3. Types of Firewalls
  4. What is a Firewall?
All in One Excel VBA Bundle
500+ Hours of HD Videos
15 Learning Paths
120+ Courses
Verifiable Certificate of Completion
Lifetime Access
Financial Analyst Masters Training Program
2000+ Hours of HD Videos
43 Learning Paths
550+ Courses
Verifiable Certificate of Completion
Lifetime Access
All in One Data Science Bundle
2000+ Hour of HD Videos
80 Learning Paths
400+ Courses
Verifiable Certificate of Completion
Lifetime Access
All in One Software Development Bundle
5000+ Hours of HD Videos
149 Learning Paths
1050+ Courses
Verifiable Certificate of Completion
Lifetime Access
Primary Sidebar
All in One Software Development Bundle5000+ Hours of HD Videos | 149 Learning Paths | 1050+ Courses | Verifiable Certificate of Completion | Lifetime Access
Financial Analyst Masters Training Program2000+ Hours of HD Videos | 43 Learning Paths | 550+ Courses | Verifiable Certificate of Completion | Lifetime Access
Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

ISO 10004:2018 & ISO 9001:2015 Certified

© 2023 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

By continuing above step, you agree to our Terms of Use and Privacy Policy.
*Please provide your correct email id. Login details for this Free course will be emailed to you

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more