Hi
Sorry it has been so long since the last post - Ive been trying to work it out, but not really getting anywhere.
The iptables stuff you suggested showed that the stuff being loaded matches that which was already there.
So I decided to try re-doing the whole thing. Only problem was, with the documentation, etc you had suggested before and the fact that I only know how to work around the rc... file, I decided to try re-writing it.
I figured it was that causing the issues mostly - the basic information is in there (as given in the example on
http://www.shad.net/tech/manuals/iptables/) but with several additions and detractions.
Firstly, the example is for 2 network cards. We have 3. and secondly, all our ports seemed to be forwarded to specific machines rather than just allowed through.
So, taking the example, I started to re-write... I now have sections for the standard stuff like config settings, loading the modules etc, prerouting, input, output, dns routing and forwarding. (the http stuff is forwarded/prerouted because it shares the 192 IP address with the firewall and dns box, and is then hopefully splitting out according to the port being used)
The file is below - Ive chopped the ip addresses as you suggested. Could you take a look at it and see if Im either over-killing, too open or just what is going on?
My explaination of whats going on is a tad simplistic I suspect, but we now have network a, b and c.
A is the firewall/dns box (they are on the same machine) into external world network
b is the servers DMZ
c is the workstations DMZ
A can see everything. Internet, b and c located machines but is not passing connections through from the internet to the servers or workstations
B can see everyone within itself and A but cannot get through A to the internet
C can also see everyone within itself and A but also cant pass through to the internet.
(when I say they can see themselves, Im using ping to test)
I guess its something simple???? Perhaps the Iptables stuff is getting in the way, or Ive just missed something simple or stuck it in the wrong place. I just dont see it. And now Im going around in circles getting nowhere!!!
Could you have a look for me???
#!/bin/sh
###########
# Configuration options
INET_IP="192."
INET_IFACE="eth0"
DMZ_IP="10"
DMZ_BCAST="10."
DMZ_IFACE="eth1"
LAN_IP="10"
LAN_BCAST_ADRESS="10"
LAN_IFACE="eth2"
DNS_IP="217."
DMZ_DNS_IP="192."
HTTP_IP="192."
DMZ_HTTP_IP="10."
MAIL_IP="192."
DMZ_MAIL_IP="10."
OEM_IP="192."
DMZ_OEM_IP="10."
LO_IP="127.0.0.1"
LO_IFACE="lo"
IPTABLES="/usr/local/sbin/iptables"
#########
# Load all required IPTables modules
/sbin/depmod -a
# Adds some iptables targets like LOG, REJECT and MASQUARADE.
/sbin/modprobe ipt_LOG
/sbin/modprobe ipt_REJECT
#/sbin/modprobe ipt_MASQUERADE
# Support for connection tracking of FTP and IRC.
/sbin/modprobe ip_conntrack_ftp
/sbin/modprobe ip_conntrack_irc
# CRITICAL: Enable IP forwarding since it is disabled by default.
echo "1" > /proc/sys/net/ipv4/ip_forward
# set default policies for the INPUT, FORWARD and OUTPUT chains
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP
# Enable simple IP FORWARDING
$IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_IP
$IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
$IPTABLES -A FORWARD -i $LAN_IFACE -o $DMZ_IFACE -j ACCEPT
$IPTABLES -A FORWARD -i $DMZ_IFACE -o $INET_IFACE -j ACCEPT
$IPTABLES -A FORWARD -i $INET_IFACE -o $DMZ_IFACE -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix "IPT FORWARD packet died: "
# Create separate chains for ICMP, TCP and UDP to traverse
$IPTABLES -N icmp_packets
$IPTABLES -N tcp_packets
$IPTABLES -N udpincoming_packets
# The allowed chain for TCP connections
$IPTABLES -N allowed
$IPTABLES -A allowed -p TCP --syn -j ACCEPT
$IPTABLES -A allowed -p TCP -m state --state ESTABLISHED,RELATED -j ACCEPT
#$IPTABLES -A allowed -m limit
$IPTABLES -A allowed -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix "IPT allowed packet died: "
$IPTABLES -A allowed -p TCP -j DROP
# ICMP rules
$IPTABLES -A icmp_packets -p ICMP -s 0/0 --icmp-type 0 -j ACCEPT #Echo Reply
$IPTABLES -A icmp_packets -p ICMP -s 0/0 --icmp-type 3 -j ACCEPT #Destination unreachable
$IPTABLES -A icmp_packets -p ICMP -s 0/0 --icmp-type 5 -j ACCEPT #Redirect
$IPTABLES -A icmp_packets -p ICMP -s 0/0 --icmp-type 8 -j ACCEPT #Echo
$IPTABLES -A icmp_packets -p ICMP -s 0/0 --icmp-type 11 -j ACCEPT #Time Exceeded
# TCP rules
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 21 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 22 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 53 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 80 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 113 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 50 -j allowed #Securemote Ports
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 256 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 257 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 258 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 259 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 260 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 261 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 262 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 263 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 264 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 265 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 500 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 2746 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 25 -j allowed #Exchange Ports
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 110 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 4899 -j allowed #Remote Admin
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 1478 -j allowed #OEM Ports
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 1754 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 7772 -j allowed
$IPTABLES -A tcp_packets -p TCP -s 0/0 --dport 7773 -j allowed
# UDP ports
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 53 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 123 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 2074 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 4000 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 50 -j ACCEPT #Securemote Ports
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 256 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 257 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 258 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 259 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 260 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 261 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 262 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 263 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 264 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 265 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 500 -j ACCEPT
$IPTABLES -A udpincoming_packets -p UDP -s 0/0 --source-port 2746 -j ACCEPT
# PREROUTING chain.
# Do some checks for obviously spoofed IP's
$IPTABLES -t nat -A PREROUTING -i $INET_IFACE -s 192.168.0.0/16 -j DROP
$IPTABLES -t nat -A PREROUTING -i $INET_IFACE -s 10.0.0.0/8 -j DROP
$IPTABLES -t nat -A PREROUTING -i $INET_IFACE -s 172.16.0.0/12 -j DROP
# INPUT chain
$IPTABLES -A INPUT -p ICMP -i $INET_IFACE -j icmp_packets
$IPTABLES -A INPUT -p TCP -i $INET_IFACE -j tcp_packets
$IPTABLES -A INPUT -p UDP -i $INET_IFACE -j udpincoming_packets
$IPTABLES -A INPUT -p ALL -i $LAN_IFACE -d $LAN_BCAST_ADRESS -j ACCEPT
$IPTABLES -A INPUT -p ALL -d $LO_IP -j ACCEPT
$IPTABLES -A INPUT -p ALL -d $LAN_IP -j ACCEPT
$IPTABLES -A INPUT -p ALL -d $DMZ_IP -j ACCEPT
$IPTABLES -A INPUT -p TCP -i $INET_IFACE --dport 53 -j allowed
$IPTABLES -A INPUT -p UDP -i $INET_IFACE --dport 53 -j ACCEPT
$IPTABLES -A INPUT -p ALL -d $INET_IP -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix "IPT INPUT packet died: "
# OUTPUT chain
$IPTABLES -A OUTPUT -p ALL -s $LO_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $LAN_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $DMZ_IP -j ACCEPT
$IPTABLES -A OUTPUT -p ALL -s $INET_IP -j ACCEPT
$IPTABLES -A OUTPUT -p TCP -i $INET_IFACE --dport 53 -j allowed
$IPTABLES -A OUTPUT -p UDP -i $INET_IFACE --dport 53 -j ACCEPT
$IPTABLES -A OUTPUT -m limit --limit 3/minute --limit-burst 3 -j LOG --log-level DEBUG --log-prefix "IPT OUTPUT packet died: "
# Enable advanced IP PREROUTING
# Web Server routing
$IPTABLES -t nat -A PREROUTING -p TCP -i $LAN_IFACE -d $HTTP_IP --dport 22 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $LAN_IFACE -d $HTTP_IP --dport 53 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $DMZ_IFACE -d $HTTP_IP --dport 53 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $HTTP_IP --dport 80 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $LAN_IFACE -d $HTTP_IP --dport 80 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $DMZ_IFACE -d $HTTP_IP --dport 109 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $LAN_IFACE -d $HTTP_IP --dport 109 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $LAN_IFACE -d $HTTP_IP --dport 110 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $HTTP_IP --dport 110 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $DMZ_IFACE -d $HTTP_IP --dport 110 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $HTTP_IP --dport 143 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $DMZ_IFACE -d $HTTP_IP --dport 143 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $LAN_IFACE -d $HTTP_IP --dport 143 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $HTTP_IP --dport 443 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p TCP -i $DMZ_IFACE -d $HTTP_IP --dport 443 -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p ICMP -i $INET_IFACE -d $HTTP_IP -j DNAT --to-destination $DMZ_HTTP_IP
$IPTABLES -t nat -A PREROUTING -p ICMP -i $LAN_IFACE -d $HTTP_IP -j DNAT --to-destination $DMZ_HTTP_IP
# DNS Server routing
$IPTABLES -t nat -A PREROUTING -p TCP -i $INET_IFACE -d $DNS_IP --dport 53 -j DNAT --to-destination $DMZ_DNS_IP
$IPTABLES -t nat -A PREROUTING -p UDP -i $INET_IFACE -d $DNS_IP --dport 53 -j DNAT --to-destination $DMZ_DNS_IP
# Enable advanced IP FORWARDING
# Web Server routing
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP --dport 22 -j allowed
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP --dport 80 -j allowed
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP --dport 109 -j allowed
$IPTABLES -A FORWARD -p TCP -i $DMZ_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP --dport 109 -j allowed
$IPTABLES -A FORWARD -p TCP -i $DMZ_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP --dport 110 -j allowed
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP --dport 110 -j allowed
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP --dport 143 -j allowed
$IPTABLES -A FORWARD -p TCP -i $DMZ_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP --dport 143 -j allowed
$IPTABLES -A FORWARD -p TCP -i $DMZ_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP --dport 443 -j allowed
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP --dport 443 -j allowed
$IPTABLES -A FORWARD -p ICMP -i $LAN_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP -j icmp_packets
$IPTABLES -A FORWARD -p ICMP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_HTTP_IP -j icmp_packets
# DNS Server routing
$IPTABLES -A FORWARD -p TCP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_DNS_IP --dport 53 -j allowed
$IPTABLES -A FORWARD -p UDP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_DNS_IP --dport 53 -j ACCEPT
$IPTABLES -A FORWARD -p ICMP -i $INET_IFACE -o $DMZ_IFACE -d $DMZ_DNS_IP -j icmp_packets
$IPTABLES -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
Thanks
Sue