From the course: Protecting Your Network with Open Source Software

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Automating Netfilter configuration

Automating Netfilter configuration

From the course: Protecting Your Network with Open Source Software

Start my 1-month free trial

Automating Netfilter configuration

- [Instructor] It's cumbersome, to keep typing IP tables commands, into our command line interface or CLI. You can automate this process by creating a shell script. We'll start by creating a file for the shell script. Let's first change our working directory to Documents by typing cd Documents. Press Enter. Type nano, space, the name of the file, which is M-Y-F-W, standing for my firewall dot S-H. Press Enter, nano is one of the pre-installed Linux text editors. Let's start by typing iptables space dash P meaning the default firewall rule, space INPUT for all the incoming traffic. We'll be dropping all the incoming traffic which is why we type DROP next. Now the second rule is for the outgoing traffic. The net filter chain for that is output. We allow all the outgoing traffic which is why we type iptables, space, dash P, OUTPUT, space, ACCEPT. Press Enter. Next type iptables, space dash P space FORWARD. The…

Contents