A Fire wall could be a Software or Hardware device which filters the information coming in through your computer . Without a Firewall computer transmits all packets into or out from the computer without knowledge of the computer user .. so it is always compulsory to keep a Software Firewall .
Some Firewalls works only in one direction . so I always suggest Firewall which is able to control both inbound and outbound traffic.
Firewalls are just like gate keepers all the packets ( information data packets) going out and coming in are screened to meet certain selected security criteria .
Hardware Firewalls
Hardware Firwalls are secure when compare to Software Firewalls . b'cause some trojan horses or malicious programs hide from the software firwalls .
Router is one kind of Hardware Firewall, The router is connected to the cable or DSL modem , and functions as gateway ,you can configure the router via browser interface that ?resides on your computer by entering it's local IP address .
You can set many filters for each of the function of the router ..