0
0
Linux CLIscripting~10 mins

Firewall basics (ufw, iptables) in Linux CLI - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable the UFW firewall.

Linux CLI
sudo ufw [1]
Drag options to blanks, or click blank then click option'
Adisable
Benable
Cstatus
Dreset
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'disable' instead of 'enable' will turn the firewall off.
Using 'status' only shows the current state, it does not enable the firewall.
2fill in blank
medium

Complete the code to allow incoming SSH connections using UFW.

Linux CLI
sudo ufw [1] ssh
Drag options to blanks, or click blank then click option'
Areject
Bdeny
Callow
Dlimit
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'deny' or 'reject' blocks SSH connections.
Using 'limit' restricts connections but does not fully allow them.
3fill in blank
hard

Fix the error in the iptables command to list all rules with line numbers.

Linux CLI
sudo iptables -[1] --line-numbers
Drag options to blanks, or click blank then click option'
AL
Blist
CS
DN
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase 'l' causes an error.
Using 'list' as a full word is not valid in iptables options.
4fill in blank
hard

Fill both blanks to add a rule that drops incoming TCP packets on port 80 using iptables.

Linux CLI
sudo iptables -A INPUT -p [1] --dport [2] -j DROP
Drag options to blanks, or click blank then click option'
Atcp
Budp
C80
D22
Attempts:
3 left
💡 Hint
Common Mistakes
Using UDP instead of TCP will not match HTTP traffic.
Using port 22 blocks SSH, not HTTP.
5fill in blank
hard

Fill all three blanks to create a UFW rule that limits incoming connections on port 22.

Linux CLI
sudo ufw [1] [2]/[3]
Drag options to blanks, or click blank then click option'
Alimit
B22
Ctcp
Ddeny
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'deny' blocks all connections instead of limiting.
Omitting the protocol may cause the rule to be less specific.