Configure firewall rules to block Telnet (port 23) and allow SSH (port 22), test these rules, and restore the firewall to its original state. This task is performed on both Windows (using GUI) and Linux (using UFW).
- Opened Windows Defender Firewall with Advanced Security (
wf.msc). - Viewed current inbound rules.
- Created a new inbound rule to block TCP port 23 (Telnet).
- Tested Telnet connection to localhost on port 23 using Command Prompt. The connection failed, confirming the block.
- Created a new inbound rule to allow TCP port 22 (SSH) (optional if SSH server is present).
- Removed the block rule on port 23 to restore the original state.
-
Checked initial UFW status and rules:
sudo ufw status verbose
Enabled UFW firewall (if it was not enabled):
sudo ufw enable
Blocked inbound traffic on port 23 (Telnet):
sudo ufw deny 23/tcp
Tested Telnet connection to port 23 (expected to fail):
telnet <linux_machine_ip> 23
Allowed inbound SSH port 22:
sudo ufw allow 22/tcp
Removed the block rule on port 23 to restore original state:
sudo ufw delete deny 23/tcp
Verified final UFW status showing all rules:
sudo ufw status verbose
Summary and Conclusion Successfully added firewall rules on Windows via GUI and on Linux using UFW.
Tested blocking of Telnet (port 23) which failed as expected.
Allowed SSH (port 22) connections successfully.
Removed block rules to restore original firewall configuration.
Gained practical experience in managing firewall rules and understanding network traffic filtering.