How to setup standalone firewall using shorewall

In this tutorial, i will show you how to setup firewall for standalone server (redhat, centos based)
1.Install shorewall
$yum install shorewall 
2.Setup & configuration
$vi /etc/shorewall/zones
###############################################################################
#ZONE   TYPE            OPTIONS         IN                      OUT
#                                       OPTIONS                 OPTIONS
fw      firewall
net     ipv4
#LAST LINE – ADD YOUR ENTRIES ABOVE THIS ONE – DO NOT REMOVE

$vi /etc/shorewall/interfaces
#ZONE   INTERFACE       BROADCAST       OPTIONS
 net    eth0            detect          tcpflags,dhcp,routefilter,nosmurfs,logmartians
#LAST LINE — ADD YOUR ENTRIES BEFORE THIS ONE — DO NOT REMOVE

$vi /etc/shorewall/policy
#SOURCE         DEST            POLICY          LOG             LIMIT:BURST
 fw             net             ACCEPT
 net            fw              DROP            info
 all            all             DROP            info
#LAST LINE — DO NOT REMOVE
 

$vi /etc/shorewall/rules
ACCEPT          fw              net
ACCEPT          net             fw              tcp     22
ACCEPT         net             fw              tcp     80
ACCEPT          net             fw              icmp
#LAST LINE — ADD YOUR ENTRIES BEFORE THIS ONE — DO NOT REMOVE 

$vi /etc/shorewall/shorewall.conf  (Must have this to start shorewall)
Change 

STARTUP_ENABLED=No into STARTUP_ENABLED=Yes
 
$/etc/init.d/shorewall restart 
Advertisements

Share your thoughts with us!!!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s