Hi all,
I have a home network with the following:
gateway & router - 192.168.2.1 (RH 6.2)
zeus - 192.168.2.2 (RH 7.1)
windows - 192.168.2.3 (win 2000)
I use a hub and a PPP connection from the router to dial out to the
internet, and then use masquerading to connect the internal machines
to the outside.
My problem is as follows:
Last week, I decided to install a ipchains firewall on router. I got
the chains from the Robert Ziegler website, and made a few changes at
the end to include masquerading. Then, I wanted to forward ports 80 &
8080 to my internal linux machine (zeus), so I added the lines using
'ipmasqadm portfw' after the masquerading. The current scene is that
the firewall is working, masquerading is working, but I am not able to
get to ports 80 & 8080 on the internal machines. I tried to access the
external ipaddress externally, not from within my network...says the
connection was refused.
So, I ran a nmap on the router machine to check on ports 80 & 8080 and
it reported that they were closed. So I ran ipchains from the command
line to accept data on 80 & 8080, but it still doesn't work. What am I
not doing?
The rc.firewall is as below.
Thanks very much for any help.
Krishna.
# Script generated Mon Oct 14 23:14:55 2002
# --------------------------------------------------------------------------- # /etc/rc.d/rc.firewall echo "Starting firewalling... " # --------------------------------------------------------------------------- EXTERNAL_INTERFACE="ppp0" # Internet connected interface IPADDR=$(/sbin/ifconfig | /bin/grep P-t-P | /usr/bin/cut -c 21-38 | echo "IP Address = " $IPADDR DHCP_SERVER="any/0" POP_SERVER="mail.uccs.edu" # Your ISP pop mail server. LOOPBACK="127.0.0.0/8" # reserved loopback address range # --------------------------------------------------------------------------- NFS_PORT="2049" # (TCP/UDP) NFS # X Windows port allocation begins at 6000 and increments to 6063 # traceroute usually uses -S 32769:65535 -D 33434:33523 # --------------------------------------------------------------------------- # Remove all existing rules belonging to this filter # Set the default policy of the filter to deny. echo "Default policy is DENY....end." echo "Echoing 1 to /proc/sys files...start" # Enable always defragging Protection # Enable broadcast echo Protection # Enable bad error message Protection # Enable IP spoofing protection echo "Echoing 0 to /proc/sys files...start" for f in /proc/sys/net/ipv4/conf/*/send_redirects; do # Disable Source Routed Packets # Log Spoofed Packets, Source Routed Packets, Redirect Packets # --------------------------------------------------------------------------- echo "Unlimited traffic on the loopback interface...start" ipchains -A input -i $LOOPBACK_INTERFACE -j ACCEPT # --------------------------------------------------------------------------- echo "Refuse spoofed packets...start" # --------------------------------------------------------------------------- # --------------------------------------------------------------------------- # NFS: establishing a TCP connection # Xwindows: establishing a connection ipchains -A output -i $EXTERNAL_INTERFACE -p tcp -y \ # SOCKS: establishing a connection # --------------------------------------------------------------------------- ipchains -A input -i $EXTERNAL_INTERFACE -p udp \ # UDP INCOMING TRACEROUTE ipchains -A input -i $EXTERNAL_INTERFACE -p udp \ # --------------------------------------------------------------------------- ipchains -A input -i $EXTERNAL_INTERFACE -p tcp ! -y \ echo "UDP UNPRIVILEGED PORTS....end." # DNS client (53) ipchains -A input -i $EXTERNAL_INTERFACE -p udp \ ipchains -A output -i $EXTERNAL_INTERFACE -p tcp \ ipchains -A output -i $EXTERNAL_INTERFACE -p udp \ ipchains -A input -i $EXTERNAL_INTERFACE -p udp \ ipchains read more »
# Copyright (C) 1997, 1998, 1999, 2000 Robert L. Ziegler
#
# Permission to use, copy, modify, and distribute this software and
its
# documentation for educational, research, private and non-profit
purposes,
# without fee, and without a written agreement is hereby granted.
# This software is provided as an example and basis for individual
firewall
# development. This software is provided without warranty.
#
# Any material furnished by Robert L. Ziegler is furnished on an
# "as is" basis. He makes no warranties of any kind, either
expressed
# or implied as to any matter including, but not limited to, warranty
# of fitness for a particular purpose, exclusivity or results
obtained
# from use of the material.
# ---------------------------------------------------------------------------
# Invoked from /etc/ppp/ip-up, or
# from /sbin/ifup-local, or
# from /etc/sysconfig/network-scripts/ifup-post.
# Some definitions for easy maintenance.
# EDIT THESE TO SUIT YOUR SYSTEM AND ISP.
LOOPBACK_INTERFACE="lo" # Loopback interface
NETWORK_INTERFACE1="eth0" # Primary network interface
/bin/awk '{print $1}' )
ANYWHERE="any/0" # match any IP address
NAMESERVER_1="207.109.160.1" # everyone must have at least one
NAMESERVER_2="128.198.1.117"
NAMESERVER_3="128.198.1.51"
IMAP_SERVER="mail.uccs.edu" # Your ISP imap mail server.
NEWS_SERVER="news.uswest.net" # Your ISP news server
CLASS_A="10.0.0.0/8" # class A private networks
CLASS_B="172.16.0.0/12" # class B private networks
CLASS_C="192.168.0.0/16" # class C private networks
BROADCAST_SRC="0.0.0.0" # broadcast source address
BROADCAST_DEST="255.255.255.255" # broadcast destination address
PRIVPORTS="0:1023" # well known, privileged port range
UNPRIVPORTS="1024:65535" # unprivileged port range
SOCKS_PORT="1080" # (TCP) Socks
# for each additional server running.
XWINDOW_PORTS="6000:6063" # (TCP) X windows
XWINDOWS_EXCEPTION="192.168.2.0/24"
TRACEROUTE_SRC_PORTS="32769:65535"
TRACEROUTE_DEST_PORTS="33434:33523"
echo "Default policy is DENY...start"
# Default policy is DENY
# Explicitly accept desired INCOMING & OUTGOING connections
ipchains -F
ipchains -P input DENY
ipchains -P output ACCEPT
ipchains -P forward DENY
# ---------------------------------------------------------------------------
# Enable TCP SYN Cookie Protection
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
echo 1 > /proc/sys/net/ipv4/ip_always_defrag
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
# turn on Source Address Verification
for f in /proc/sys/net/ipv4/conf/*/rp_filter; do
echo 1 > $f
done
echo "Echoing 1 to /proc/sys files....end."
# Disable ICMP Redirect Acceptance
for f in /proc/sys/net/ipv4/conf/*/accept_redirects; do
echo 0 > $f
done
echo 0 > $f
done
for f in /proc/sys/net/ipv4/conf/*/accept_source_route; do
echo 0 > $f
done
for f in /proc/sys/net/ipv4/conf/*/log_martians; do
echo 1 > $f
done
echo "Echoing 0 to /proc/sys files....end."
# LOOPBACK
# Unlimited traffic on the loopback interface.
ipchains -A output -i $LOOPBACK_INTERFACE -j ACCEPT
echo "Unlimited traffic on the loopback interface....end."
# SPOOFING & BAD ADDRESSES
# Refuse spoofed packets.
# Ignore blatantly illegal source addresses.
# Protect yourself from sending to bad addresses.
# Refuse incoming packets pretending to be from the external
address.
ipchains -A input -s $IPADDR -j DENY -l
echo "Refuse spoofed packets....end."
# NOTE:
# The symbolic names used in /etc/services for the port numbers
vary by
# supplier. Using them is less error prone and more meaningful,
though.
# TCP UNPRIVILEGED PORTS
# Avoid ports subject to protocol & system administration problems.
echo "TCP UNPRIVILEGED PORTS...start"
ipchains -A input -i $EXTERNAL_INTERFACE -p tcp -y \
--destination-port $NFS_PORT -j DENY -l
ipchains -A output -i $EXTERNAL_INTERFACE -p tcp -y \
--destination-port $NFS_PORT -j REJECT
ipchains -A input -i $EXTERNAL_INTERFACE -p tcp -y \
-s 192.168.2.0/24 \
-d $IPADDR $XWINDOW_PORTS -j ACCEPT -l
ipchains -A input -i $EXTERNAL_INTERFACE -p tcp -y \
--destination-port $XWINDOW_PORTS -j DENY -l
ipchains -A output -i $EXTERNAL_INTERFACE -p tcp -y -d
192.168.2.0/24 $XWINDOW_PORTS -j ACCEPT
--destination-port $XWINDOW_PORTS -j REJECT
ipchains -A input -i $EXTERNAL_INTERFACE -p tcp -y \
--destination-port $SOCKS_PORT -j DENY -l
ipchains -A output -i $EXTERNAL_INTERFACE -p tcp -y \
--destination-port $SOCKS_PORT -j REJECT
echo "TCP UNPRIVILEGED PORTS....end."
# UDP UNPRIVILEGED PORTS
# Avoid ports subject to protocol & system administration problems.
echo "UDP UNPRIVILEGED PORTS...start"
--destination-port $NFS_PORT -j DENY -l
# traceroute usually uses -S 32769:65535 -D 33434:33523
-s 192.168.2.0/24 $TRACEROUTE_SRC_PORTS \
-d $IPADDR $TRACEROUTE_DEST_PORTS -j ACCEPT -l
ipchains -A input -i $EXTERNAL_INTERFACE -p udp \
--source-port $TRACEROUTE_SRC_PORTS \
--destination-port $TRACEROUTE_DEST_PORTS -j DENY -l
-d $IPADDR -j ACCEPT
# ------------------------------------------------------------------
# ---------------
echo "DNS client (53)...start"
ipchains -A output -i $EXTERNAL_INTERFACE -p udp \
-s $IPADDR $UNPRIVPORTS \
-d $NAMESERVER_1 53 -j ACCEPT
-s $NAMESERVER_1 53 \
-d $IPADDR $UNPRIVPORTS -j ACCEPT
-s $IPADDR $UNPRIVPORTS \
-d $NAMESERVER_1 53 -j ACCEPT
-s $IPADDR $UNPRIVPORTS \
-d $NAMESERVER_2 53 -j ACCEPT
-s $NAMESERVER_2 53 \
-d $IPADDR $UNPRIVPORTS -j ACCEPT
...