How To Install And Configure The Firewall In Kali Linux

Step-1 In kali linux there are 2 methods to configure firewall

1 ufw {it is configured through command line}

2 gufu {it is configured through graphical user interface}

Step-2 Before configuring the firewall in kali linux we need to install the package of ufw firewall

Here is the command to install the package of ufw firewall

root@kali:~# apt-get install ufw

After installing the package of firewall now we have to check the statusby using this command here you can see the commands

root@kali:~# ufw status
root@kali:~# ufw status verbose
Screenshot (100)
Step-3 Now we have to allow the service by the name or port number
#root@kali:~# ufw allow 80/tcp #root@kali:~# ufw allow samba

Screenshot (101)

After this now check the rules by number

root@kali:~# ufw status numbered

Step-4 Now we have to secure the web server by blocking the http{40} service and the we have to allow the https{443} service
Here is the command you can see
root@kali:~# ufw deny 80 root@kali:~# ufw allow 443
Screenshot (103)


Step-5 Now Check the firewall rule by name


Here is the command to check the rule by name
root@kali:~# ufw status numbered
Step-6 After this now we have to allow or deny the certain ports so how can we do that

Here is the command to can see how to allow or deny the certain ports


root@kali:~# ufw allow 21:80/tcp root@kali:~# ufw deny 100:1000/tcp
Screenshot (104)
Step-7 After this now again check the rule
root@kali:~# ufw status numbered

Step-8 Now we have to allow or deny the certain ip addresses by using this ufw firewall
Here is the command you cann see how we allow or deny the ip by using ufw firewall

root@kali:~# ufw allow from 192.168.0.100 root@kali:~# ufw deny from 172.24.0.100
root@kali:~# ufw status numbered {To check the rule again}
Screenshot (105)
Step-9 Now I will tell you what is the configuration file of ufw firewall
root@kali:~# cat /etc/ufw/before.rules
root@kali:~# cat /etc/ufw/after6.rules

This is all how to install the package of firewall and how to configure firewall in kali linux

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.