Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Apr 2004 19:33:51 -0400
From:      Peter Tokanel <peter.tokanel@samsys.com>
To:        freebsd-questions@freebsd.org
Subject:   Newbie:Home network mail forwarding
Message-ID:  <408704DF.5070907@samsys.com>

next in thread | raw e-mail | index | archive | help
Hi,

  I am new to unix but I have managed to setup a home network using  
Free BSD. The
FreeBSD box is a gateway/firewall/router for my Windows XP box and a 
wireless access
point. The XP box can access the web just great using the shared connection.
  My problem is when email is used on the WindowsXP box , no messages can be
sent out. I can receive email from my ISP's pop-server just fine. I am 
not sure if I need
to start some kind of mail daemon or what???? Is it my firewall 
configuration????
  I have included some of my setup files, hopefully someone can tell me 
what I am doing
wrong. Thanks in advance......
___________________________________
rc.conf
hostname=".SNOOPY"
network_interfaces="vr0 rl0 lo0"
ifconfig_vr0="DHCP"
ifconfig_rl0="inet 192.168.1.1  netmask 255.255.255.0"
linux_enable="YES"
moused_enable="YES"
moused_port="/dev/psm0"
moused_type="auto"
usbd_enable="YES"
#defaultrouter=`ifconfig vr0 |grep "inet "|awk '{print $6}'`
gateway_enable="YES"

firewall_enable="YES"
firewall_type="simple"
firewall_quiet="NO"
natd_enable="YES"
natd_interface="vr0"
natd_flags="-f /etc/natd.conf"

tcp_drop_synfin="YES"

# Enable ip6fw.
#ipv6_firewall_enable="YES"
#ipv6_firewall_type="type"    # see rc.firewall6 for what goes here
#ipv6_firewall_quiet="NO"

# Setup caching only name server
named_enable="YES"

# This file now contains just the overrides from /etc/defaults/rc.conf.
# Please make all changes to this file, not to /etc/defaults/rc.conf.

# Enable network daemons for user convenience.
# Created: Sat Apr 17 09:50:48 2004

linux_enable="YES"

# This file now contains just the overrides from /etc/defaults/rc.conf.
# Please make all changes to this file, not to /etc/defaults/rc.conf.

# Enable network daemons for user convenience.
# Created: Sat Apr 17 12:58:28 2004
# -- sysinstall generated deltas -- # Sat Apr 17 12:58:28 2004
inetd_enable="YES"
_______________________________________________________

rc.firewall using natd & the simple define

#!/bin/sh -
# Copyright (c) 1996  Poul-Henning Kamp
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD: src/etc/rc.firewall,v 1.47 2003/11/02 07:31:44 ru Exp $
#

#
# Setup system for firewall service.
#

# Suck in the configuration variables.
if [ -z "${source_rc_confs_defined}" ]; then
    if [ -r /etc/defaults/rc.conf ]; then
        . /etc/defaults/rc.conf
        source_rc_confs
    elif [ -r /etc/rc.conf ]; then
        . /etc/rc.conf
    fi
fi

############
# Define the firewall type in /etc/rc.conf.  Valid values are:
#   open     - will allow anyone in
#   client   - will try to protect just this machine
#   simple   - will try to protect a whole network
#   closed   - totally disables IP services except via lo0 interface
#   UNKNOWN  - disables the loading of firewall rules.
#   filename - will load the rules in the given filename (full path 
required)
#
# For ``client'' and ``simple'' the entries below should be customized
# appropriately.



setup_loopback () {
    ############
    # Only in rare cases do you want to change these rules
    #
    ${fwcmd} add 100 pass all from any to any via lo0
    ${fwcmd} add 200 deny all from any to 127.0.0.0/8
    ${fwcmd} add 300 deny ip from 127.0.0.0/8 to any
}

if [ -n "${1}" ]; then
    firewall_type="${1}"
fi


############
# Flush out the list before we begin.
#
${fwcmd} -f flush

############
# Network Address Translation.  All packets are passed to natd(8)
# before they encounter your remaining rules.  The firewall rules
# will then be run again on each packet after translation by natd
# starting at the rule number following the divert rule.
#
# For ``simple'' firewall type the divert rule should be put to a
# different place to not interfere with address-checking rules.
#
case ${firewall_type} in
[Oo][Pp][Ee][Nn]|[Cc][Ll][Ii][Ee][Nn][Tt])
    case ${natd_enable} in
    [Yy][Ee][Ss])
        if [ -n "${natd_interface}" ]; then
            ${fwcmd} add 50 divert natd all from any to any via 
${natd_interface}
        fi
        ;;
    esac
esac


[Ss][Ii][Mm][Pp][Ll][Ee])
    ############
    # This is a prototype setup for a simple firewall.  Configure this
    # machine as a DNS and NTP server, and point all the machines
    # on the inside at this machine for those services.
    ############

    # set these to your outside interface network and netmask and ip
    oif="vr0"
    onet=`ifconfig vr0 | grep "inet "| awk '{print $6}'`
    omask=`ifconfig vr0 | grep "inet "| awk '{print $4}'`
#"255.255.255.255"
    oip=`ifconfig vr0 | grep "inet "| awk '{print $2}'`

    # set these to your inside interface network and netmask and ip
    iif="rl0"
    inet="192.168.1.0"
    imask="255.255.255.0"
    iip="192.168.1.1"

    # My ISP's DNS servers
    dns1="24.25.5.50"
    dns2="24.25.5.106"
    dns3="24.25.5.107"

    setup_loopback

    # Add internal traffic
    ${fwcmd} add allow all from any to any via ${iif}

    # Stop spoofing
    ${fwcmd} add deny all from ${inet}:${imask} to any in via ${oif}
    ${fwcmd} add deny all from ${onet}:${omask} to any in via ${iif}

    # Stop RFC1918 nets on the outside interface
    ${fwcmd} add deny all from any to 10.0.0.0/8 via ${oif}
    ${fwcmd} add deny all from any to 172.16.0.0/12 via ${oif}
    ${fwcmd} add deny all from any to 192.168.0.0/16 via ${oif}

    # Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1,
    # DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E)
    # on the outside interface
    ${fwcmd} add deny all from any to 0.0.0.0/8 via ${oif}
    ${fwcmd} add deny all from any to 169.254.0.0/16 via ${oif}
    ${fwcmd} add deny all from any to 192.0.2.0/24 via ${oif}
    ${fwcmd} add deny all from any to 224.0.0.0/4 via ${oif}
    ${fwcmd} add deny all from any to 240.0.0.0/4 via ${oif}

    # Network Address Translation.  This rule is placed here deliberately
    # so that it does not interfere with the surrounding address-checking
    # rules.  If for example one of your internal LAN machines had its IP
    # address set to 192.0.2.1 then an incoming packet for it after being
    # translated by natd(8) would match the `deny' rule above.  Similarly
    # an outgoing packet originated from it before being translated would
    # match the `deny' rule below.
    case ${natd_enable} in
    [Yy][Ee][Ss])
        if [ -n "${natd_interface}" ]; then
            ${fwcmd} add divert natd all from any to any via 
${natd_interface}
        fi
        ;;
    esac

    # Stop RFC1918 nets on the outside interface
    ${fwcmd} add deny all from 10.0.0.0/8 to any via ${oif}
    ${fwcmd} add deny all from 172.16.0.0/12 to any via ${oif}
    ${fwcmd} add deny all from 192.168.0.0/16 to any via ${oif}

    # Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1,
    # DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E)
    # on the outside interface
    ${fwcmd} add deny all from 0.0.0.0/8 to any via ${oif}
    ${fwcmd} add deny all from 169.254.0.0/16 to any via ${oif}
    ${fwcmd} add deny all from 192.0.2.0/24 to any via ${oif}
    ${fwcmd} add deny all from 224.0.0.0/4 to any via ${oif}
    ${fwcmd} add deny all from 240.0.0.0/4 to any via ${oif}

    # Allow TCP through if setup succeeded
    ${fwcmd} add pass tcp from any to any established

    # Allow IP fragments to pass through
    ${fwcmd} add pass all from any to any frag

    # Allow setup of incoming email
    ${fwcmd} add pass tcp from any to ${oip} 25 setup in via {oif}
    ${fwcmd} add pass tcp from any to ${oip} 110 setup in via {oif}
    ${fwcmd} add pass tcp from any to ${oip} 995 setup in via {oif}

    # Allow access to our DNS
    ${fwcmd} add pass tcp from any to ${oip} 53 setup
    ${fwcmd} add pass udp from any to ${oip} 53
    ${fwcmd} add pass udp from ${oip} 53 to any

    # Allow access to our WWW
    ${fwcmd} add pass tcp from any to ${oip} 80 setup

    # Reject&Log all setup of incoming connections from the outside
    ${fwcmd} add deny log tcp from any to any in via ${oif} setup

    # Allow setup of any other TCP connection
    ${fwcmd} add pass tcp from any to any setup

    # Allow DNS queries out in the world
    ${fwcmd} add pass udp from ${oip} to any 53 keep-state
# DNS - Allow queries out in the world
${fwcmd} add pass udp from any to ${dns1} 53
${fwcmd} add pass udp from any to ${dns2} 53
${fwcmd} add pass udp from any to ${dns3} 53
${fwcmd} add pass udp from ${dns1} 53 to any
${fwcmd} add pass udp from ${dns2} 53 to any
${fwcmd} add pass udp from ${dns3} 53 to any

    # Allow NTP queries out in the world
    ${fwcmd} add pass udp from ${oip} to any 123 keep-state

### ICMP RULES

# ICMP packets
# Allow all ICMP packets on internal interface
${fwcmd} add pass icmp from any to any via ${iif}

# Allow outgoing pings
${fwcmd} add pass icmp from any to any icmptypes 8 out via ${oif}
${fwcmd} add pass icmp from any to any icmptypes 0 in via ${oif}

# Allow Destination Unreachable, Source Quench, Time Exceeded, and Bad 
Header
${fwcmd} add pass icmp from any to any icmptypes 3,4,11,12 via ${oif}

# Deny the rest of them
#${fwcmd} add deny icmp from any to any


    # Everything else is denied by default, unless the
    # IPFIREWALL_DEFAULT_TO_ACCEPT option is set in your kernel
    # config file.
    ;;

___________________________________________
-- 
Any help will be greatly appreciated. Peter



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?408704DF.5070907>