Iptables and Firewalld - Linux Video Tutorial | LinkedIn Learning, formerly Lynda.com (2024)

From the course: Linux: Firewalls and SELinux

Iptables and Firewalld

- [Instructor] As we get started, I want to get some basic concepts out of the way. Firewalls, in general, are complicated. The entire subject is complicated. But here, on our Fedora 25 Server, the concept of a firewall is more specifically complicated because in an opensource universe, there are many add-ons and services that interact with the functional kernel of the system. Firewalls in Linux, in general, all function within, and because of, the existence of something called Netfilter, which is the networking guts of the Linux kernel. But you can't directly configure Netfilter, so you need some tools to get in there and make things work. After years of foundational technology coming to life and passing away, today, we have two conflicting demons, that both can be used to make Netfilter do its firewalling thing. One is called Iptables, the other is called Firewalld. So, Iptables. Iptables has been around longer, but, as such, even though you can still install it and run it, ya may find it becomes deprecated in the near future, so you might not want to use it. Firewalld is relatively newer. It functions on a different security metaphor, and in certain ways, can be thought of as easier to configure. Iptables and Firewalld cannot, however, run at the same time, on the same system. And they require some mutual exclusion rules before we can get started. And setting that up properly, so you can move forward in this course, is exactly what we're going to do now. First, you want to see if Iptables is running on your system. It might be, if you've upgraded from a previous installation of Linux, or if you've tried your hand at setting up a firewall on your system before. So, we do this by first entering into a sudoer session. We're going to type sudo -s, and we'll put in our password, that would your password on your system, and that gives us a root session. You can tell the difference instantly whenever you're logged in. The dollar sign indicates that you are logged in as your primary user or the user account that you authenticated with. The little number sign here, the hashtag, that indicates that you're logged in as root. You can also see the name of the user next to your insertion prompt all the way over here to the left. And the user that I was logged into, initially, is sean and the one that I'm logged into now is root. So, we're going to issue these commands. Not all of these require root, but it's nice to be in as root to just run these things so we don't have to worry about which one's which. And here we are, systemctl. That's the command we're going to use. And we're going to just do a quick status check on Iptables. See if it is running. And on my system, because mine is a new development system, on which I've never configured Iptables before, it says nope, sorry, not found. So, Iptables is installed, I will point out. If we were to go and cd into sbin and hit Return, that's cd /sbin/ and hit Return, then we would do an ls -fla, and whoah that's a lot of stuff. So, that's probably way more than I want to look at. If I go to ls, and I just type iptables, there it is. And so I can see that Iptables is, in fact, installed. That ls at iptables just said hey, list out Iptables for me in the current directory. If I wanted to see more information about Iptables, I could just up arrow, and back arrow, and then I could type Fla, capital F, lowercase la, and hit iptables, and look, there it goes. Sees, there, that it's a redirect over to xtables-multi. It's there, it is installed, and that is good to know. But it's also important to know that it's not running. Because it is installed, it's important that we mask it out, so that it can't run on its own in the future. And that is what we're going to do next. So, if we go systemctl mask iptables and hit Return, it's going to say well, you know, the service doesn't exist, that's because it's not running, but I'm going to proceed anyway, and it creates the symlink and we're set. So, that is masked out and it won't run on its own. Now, what happens if you, when you ran your systemctl status iptables, what if it said it was running? Or if it said it was not running? Well, in that case, you can run systemctl. Again, this is not what you have to do if you saw the results that I saw. But, if your results were different, and you saw that Iptables is, in fact, running, you would run systemctl stop iptables and you would hit Return. And it would be stopped. So, those are the three steps that you need to take. You need to check to see if Iptables is running. If it is running, you need to stop it, and then mask it. If it is not present, or it's not installed, not running, then you need to simply mask Iptables so that it won't run on its own in the future. And, at that point, you are ready to start your configuration and running of FirewallD, which we'll take care of in later movies.

Contents

    • Welcome to firewalls and SELinux 49s
    • Prerequisites 1m 32s
    • Iptables and Firewalld 4m 48s
    • Installing Firewalld 1m 7s
    • Installing the Firewalld GUI controls 2m 5s
    • Installing GUI controls with no GUI 50s
    • Understand Firewalld zones 2m 21s
    • Understand Firewalld services 2m 1s
    • Zones explored 7m 22s
    • Firewall-cmd configuration preparation 10m 15s
    • Allowing the Apache web server 2m 54s
    • Allowing any mail server 4m 6s
    • Allowing an XMPP server 2m 59s
    • Allowing an SMB server 3m 8s
    • Allowing an NFS server 3m 33s
    • Allowing an LDAP server 4m 49s
    • Allowing a PostgreSQL server 3m 41s
    • Allowing FTP and SFTP servers 4m 25s
    • VM Port Forwarding 2m 4s
    • ShieldsUP! panic mode 2m 35s
    • Installing SELinux utils 4m 50s
    • Discretionary vs. mandatory access 5m 56s
    • Understanding contexts 6m 48s
    • Installing SELinux man pages 5m 14s
    • Understanding Booleans 4m 39s
    • Enabling SELinux and modes 4m 40s
    • Graphical management tools 3m 51s
    • Changing context labels 6m 7s
    • Changing ports on services 4m 42s
    • Copying files 5m 3s
    • Moving files 2m 31s
    • Running sepolicy 3m 13s
    • Finding SELinux logs 3m 8s
    • Making domains permissive 2m 40s
    • Disabling and reenabling SELinux 8m 14s
    • Next steps 3m 4s
Iptables and Firewalld - Linux Video Tutorial | LinkedIn Learning, formerly Lynda.com (2024)
Top Articles
Latest Posts
Article information

Author: Prof. Nancy Dach

Last Updated:

Views: 6346

Rating: 4.7 / 5 (57 voted)

Reviews: 88% of readers found this page helpful

Author information

Name: Prof. Nancy Dach

Birthday: 1993-08-23

Address: 569 Waelchi Ports, South Blainebury, LA 11589

Phone: +9958996486049

Job: Sales Manager

Hobby: Web surfing, Scuba diving, Mountaineering, Writing, Sailing, Dance, Blacksmithing

Introduction: My name is Prof. Nancy Dach, I am a lively, joyous, courageous, lovely, tender, charming, open person who loves writing and wants to share my knowledge and understanding with you.