![]() ![]() # iptables-restore <</a> /etc/iptables/rules.v4
To
To update iptables with new rules use IPtables Save command: # iptables-save > /etc/iptables/rules.v4įor IPV6: # ip6tables-save > /etc/iptables/rules.v6 Iptables Restore Now Iptables Configuration files rules.v4 and rules.v6 stored in /etc/iptables To make your iptables rules persistent install iptables-persistent package: # apt-get install iptables-persistent Iptables rules are not saved automatically. If we reboot the server we will loose configuration. Good job! The iptables UP and running with defined rules. Lets check iptables status again: # iptables -L -v Iptables -A INPUT -p icmp -icmp-type echo-request -j ACCEPT Iptables -A INPUT -p tcp -dport 443 -j ACCEPT Iptables -A INPUT -p tcp -dport 80 -j ACCEPT Iptables -A INPUT -p tcp -m tcp -m state -m comment -s /32 -dport 22 -state NEW -j ACCEPT -comment "Open SSH Port for your /32 IP only " Iptables -A INPUT -m state -state ESTABLISHED,RELATED -j ACCEPT Open SSH port and accept the incoming connections on port 22 only from your IP address.Ĭopy this example, don’t forget to edit your IP address and execute: iptables -A INPUT -i lo -j ACCEPT This is basic iptables configuration example to allow connections on HTTP, HTTPS ports and ping. # iptables -X Basic Iptables Example Configuration То clear iptables rules (open all ports) use the following command sequence: # iptables -P INPUT ACCEPT But all chains (INPUT, FORWARD, OUTPUT) are set to ACCEPT, and we have no security rules configured. For list all the rules we will use option -L.Īs you see on the screenshot just installed iptables firewall and it works. Now we can check the iptables status and list rules. # apt-get install iptables Debian IPtables Status Check To install iptables execute following commands: # apt-get update # apt-get purge nftables Install IPtables in Debian 11 SSH into your server and run the next commands: # apt-get remove -auto-remove nftables To install iptables first we need uninstall nftables and its dependencies. IPtables is being replaced by nftables starting with Debian 10 Buster. In this article you will learn how to uninstall default nftables framework, install iptables Debian 11 (Bullseye) and basic rules initial configuration. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |