Difference between revisions of "OPS335 Firewall Lab"

From CDOT Wiki
Jump to: navigation, search
(Building a Simple Firewall)
(Building a Simple Firewall)
Line 10: Line 10:
 
#Disable your current firewall. i.e. flush all rules in all chains in all tables.
 
#Disable your current firewall. i.e. flush all rules in all chains in all tables.
  
Now build a custom firewall by performing the following steps:
+
===Now build a custom firewall by performing the following steps:===
  
 
#Add appropriate rule(s) to allow all traffic to/from the loopback 'lo' interface.
 
#Add appropriate rule(s) to allow all traffic to/from the loopback 'lo' interface.
Line 25: Line 25:
 
#Add a rule to the INPUT chain of the filter table to send ICMP ping packets to your MYICMP chain.
 
#Add a rule to the INPUT chain of the filter table to send ICMP ping packets to your MYICMP chain.
 
#Change the default policy on the INPUT chain in the filter table to DROP.
 
#Change the default policy on the INPUT chain in the filter table to DROP.
Use nmap to scan your firewall from 142.204.141.XXX. If you don't have nmap on your system then install it.
+
#Use nmap to scan your firewall from 142.204.141.XXX. If you don't have nmap on your system then install it.
Use ping and ssh from 142.204.141.XXX (and elsewhere) to verify your firewall is working properly. Be sure to check the log file for your unsuccessful ssh attempts.
+
#Use ping and ssh from 142.204.141.XXX (and elsewhere) to verify your firewall is working properly. Be sure to check the log file for your unsuccessful ssh attempts.
Use iptables-save command to save your firewall rules.
+
 
 +
#Use iptables-save command to save your firewall rules.
  
 
Part B: Answer the following questions
 
Part B: Answer the following questions

Revision as of 21:52, 30 August 2011


Basic IP Tables

In this lab you will learn how to use iptables to build a simple Linux firewall.

Building a Simple Firewall

  1. Login as joker to your Fedora 13 PC. NOTE: It's not necessary to use a VM for this lab. Just use your original Fedora system created in lab #0.
  2. Open a terminal window and "su -" to root.
  3. Disable your current firewall. i.e. flush all rules in all chains in all tables.

Now build a custom firewall by performing the following steps:

  1. Add appropriate rule(s) to allow all traffic to/from the loopback 'lo' interface.
  2. Add a rule to the INPUT chain of the filter table to allow all UDP traffic coming from port 53. i.e. source port is 53.
  3. Add a rule to the INPUT chain of the filter table to allow all ESTABLISHED or RELATED incoming connections.
  4. Create a new chain named MYSSH in the filter table.
  5. Add a rule to the INPUT chain of your filter table that sends all tcp packets with destination port 22 to your MYSSH chain.
  6. Add a rule to your MYSSH chain to deny all traffic from 142.204.141.XXX (XXX is the PC beside you). Also log these denied packets with log level 'info'.
  7. Add a rule to the INPUT chain of the filter table that allows all new tcp ssh connections.
  8. Make a new chain named MYICMP in the filter table.
  9. Add a rule to your MYICMP chain that denies ICMP pings from 142.204.141.XXX (the PC beside you).
  10. Add a rule to your MYICMP chain that denies ICMP pings originating with MAC address of 11:22:33:44:55:66 (NOTE: to test this you'll have to change the MAC address of the PC beside you with the ifconfig command).
  11. Add a rule to your MYICMP chain that allows ICMP pings from anywhere.
  12. Add a rule to the INPUT chain of the filter table to send ICMP ping packets to your MYICMP chain.
  13. Change the default policy on the INPUT chain in the filter table to DROP.
  14. Use nmap to scan your firewall from 142.204.141.XXX. If you don't have nmap on your system then install it.
  15. Use ping and ssh from 142.204.141.XXX (and elsewhere) to verify your firewall is working properly. Be sure to check the log file for your unsuccessful ssh attempts.
  1. Use iptables-save command to save your firewall rules.

Part B: Answer the following questions What is your full name and Seneca student ID? Show your firewall rules using the output of the iptables-save command. Show the results of your nmap scans from part A. Be sure to also show the exact nmap command you used. Show the log records generated by your invalid ssh attempts in part A. What iptables rule would you need to add to your firewall to allow a maximum of 3 concurrent ssh connections from 142.204.141.XXX to your host?